From 5692072d36bb3bb1a1bce52986d7180122445e73 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Wed, 10 Mar 2021 13:56:53 +0100 Subject: [PATCH] * Fixed: [CLIXON is not waiting for the hello message #184](https://github.com/clicon/clixon/issues/184) * Hello message semantics has been made stricter according to RFC 6241 Sec 8.1, for example: * A client MUST send a element. * Each peer MUST send at least the base NETCONF capability, "urn:ietf:params:netconf:base:1.1" (or 1.0 for RFC 4741) * The netconf client will terminate (close the socket) if the client does not comply * You can set `CLICON_NETCONF_HELLO_OPTIONAL` to true to use the old behavior of essentially ignoring hellos. * New clixon-config@2020-03-08.yang revision * Added: `CLICON_NETCONF_HELLO_OPTIONAL` * The base capability has been changed to "urn:ietf:params:netconf:base:1.1" following RFC6241. --- CHANGELOG.md | 13 + apps/netconf/netconf_main.c | 242 +++++++++++++----- lib/clixon/clixon_netconf_lib.h | 25 ++ lib/clixon/clixon_xml.h | 12 - lib/src/clixon_client.c | 38 +++ lib/src/clixon_netconf_lib.c | 10 +- lib/src/clixon_proto_client.c | 5 +- lib/src/clixon_xml_bind.c | 32 ++- lib/src/clixon_xml_io.c | 2 +- lib/src/clixon_xml_nsctx.c | 1 + lib/src/clixon_xml_parse.y | 36 ++- lib/src/clixon_xpath_eval.c | 17 +- test/lib.sh | 59 +++-- test/test_augment.sh | 12 +- test/test_augment_state.sh | 10 +- test/test_augment_trans.sh | 6 +- test/test_c++.sh | 2 +- test/test_choice.sh | 66 ++--- test/test_cli_multikey.sh | 4 +- test/test_client.sh | 1 + test/test_copy_config.sh | 46 ++-- test/test_datastore_repair.sh | 2 +- test/test_feature.sh | 12 +- test/test_identity.sh | 50 ++-- test/test_leaf_default.sh | 24 +- test/test_leafref.sh | 32 +-- test/test_leafref_augment.sh | 24 +- test/test_leafref_state.sh | 34 +-- test/test_minmax.sh | 68 ++--- test/test_nacm.sh | 4 +- test/test_nacm_credentials.sh | 6 +- test/test_nacm_datanode.sh | 6 +- test/test_nacm_datanode_read.sh | 6 +- test/test_nacm_datanode_write.sh | 6 +- test/test_nacm_module_read.sh | 16 +- test/test_nacm_module_write.sh | 4 +- test/test_nacm_protocol.sh | 16 +- test/test_nacm_recovery.sh | 10 +- test/test_netconf.sh | 149 +++++------ test/test_netconf_filter.sh | 14 +- test/test_netconf_notifications.sh | 16 +- test/test_netconf_ssh_callhome.sh | 3 +- test/test_netconf_whitespace.sh | 40 +-- test/test_order.sh | 120 ++++----- test/test_pattern.sh | 8 +- test/test_perf_netconf.sh | 32 +-- test/test_perf_restconf.sh | 19 +- test/test_perf_state.sh | 10 +- test/test_perf_state_only.sh | 6 +- test/test_restconf.sh | 4 +- test/test_restconf_netns.sh | 4 +- test/test_restconf_rpc.sh | 13 +- test/test_rpc.sh | 41 ++- test/test_startup.sh | 6 +- test/test_submodule.sh | 10 +- test/test_transaction.sh | 48 ++-- test/test_transaction_restart.sh | 8 +- test/test_type.sh | 136 +++++----- test/test_type_range.sh | 18 +- test/test_unique.sh | 36 +-- test/test_upgrade_auto.sh | 2 +- test/test_upgrade_failsafe.sh | 4 +- test/test_upgrade_interfaces.sh | 2 +- test/test_upgrade_repair.sh | 14 +- test/test_upgrade_simple.sh | 6 +- test/test_when_must.sh | 24 +- test/test_with_default.sh | 4 +- test/test_xml.sh | 13 +- test/test_xpath_functions.sh | 38 +-- test/test_yang.sh | 70 ++--- test/test_yang_anydata.sh | 20 +- test/test_yang_default.sh | 2 +- test/test_yang_extension.sh | 6 +- test/test_yang_load.sh | 48 ++-- test/test_yang_namespace.sh | 10 +- yang/clixon/Makefile.in | 2 +- yang/clixon/clixon-config.yang | 2 +- ...-03.yang => clixon-config@2021-03-08.yang} | 149 +++++------ yang/clixon/clixon-lib@2020-04-23.yang | 112 -------- yang/clixon/clixon-lib@2020-12-08.yang | 175 ------------- yang/clixon/clixon-restconf@2020-10-30.yang | 137 ---------- 81 files changed, 1189 insertions(+), 1351 deletions(-) rename yang/clixon/{clixon-config@2020-11-03.yang => clixon-config@2021-03-08.yang} (91%) delete mode 100644 yang/clixon/clixon-lib@2020-04-23.yang delete mode 100644 yang/clixon/clixon-lib@2020-12-08.yang delete mode 100644 yang/clixon/clixon-restconf@2020-10-30.yang diff --git a/CHANGELOG.md b/CHANGELOG.md index e2754cf8..eb85f5b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,16 @@ ## 5.1.0 Expected: April +### API changes on existing protocol/config features + +* NETCONF Hello message semantics has been made stricter according to RFC 6241 Sec 8.1, for example: + * A client MUST send a element. + * Each peer MUST send at least the base NETCONF capability, "urn:ietf:params:netconf:base:1.1" (or 1.0 for RFC 4741) + * The netconf client will terminate (close the socket) if the client does not comply + * You can set `CLICON_NETCONF_HELLO_OPTIONAL` to true to use the old behavior of essentially ignoring hellos. +* New clixon-config@2020-03-08.yang revision + * Added: `CLICON_NETCONF_HELLO_OPTIONAL` + ### C/CLI-API changes on existing features Developers may need to change their code @@ -42,6 +52,7 @@ Developers may need to change their code ### Minor features +* The base capability has been changed to "urn:ietf:params:netconf:base:1.1" following RFC6241. * Made a separate Clixon datastore XML/JSON top-level symbol * Replaces the hardcoded "config" keyword. * Implemented by a compile-time option called `DATASTORE_TOP_SYMBOL` option in clixon_custom.h @@ -50,6 +61,8 @@ Developers may need to change their code ### Corrected Bugs +* Fixed: [CLIXON is not waiting for the hello message #184](https://github.com/clicon/clixon/issues/184) + * See also API changes * Fixed: [comma in yang list name will lead to cli setting error #186](https://github.com/clicon/clixon/issues/186) * Reverted blocked signal behavior introduced in 5.0. diff --git a/apps/netconf/netconf_main.c b/apps/netconf/netconf_main.c index 799cb87e..da79f895 100644 --- a/apps/netconf/netconf_main.c +++ b/apps/netconf/netconf_main.c @@ -84,20 +84,92 @@ /*! Ignore errors on packet errors: continue */ static int ignore_packet_errors = 1; +/* Hello request received */ +static int _netconf_hello_nr = 0; + +/*! Copy attributes from incoming request to reply. Skip already present (dont overwrite) + * + * RFC 6241: + * If additional attributes are present in an element, a NETCONF + * peer MUST return them unmodified in the element. This + * includes any "xmlns" attributes. + * @param[in] xrpc Incoming message on the form ... + * @param[in,out] xrep Reply message on the form ... + */ static int -netconf_hello(clicon_handle h, - cxobj *xn) +netconf_add_request_attr(cxobj *xrpc, + cxobj *xrep) { -#ifdef nyi - cxobj *x; + int retval = -1; + cxobj *xa; + cxobj *xa2 = NULL; - x = NULL; - - while ((x = xpath_each(xn, "//capability", x)) != NULL) { - + xa = NULL; + while ((xa = xml_child_each(xrpc, xa, CX_ATTR)) != NULL){ + /* If attribute already exists, dont copy it */ + if (xml_find_type(xrep, NULL, xml_name(xa), CX_ATTR) != NULL) + continue; /* Skip already present (dont overwrite) */ + if ((xa2 = xml_dup(xa)) ==NULL) + goto done; + if (xml_addsub(xrep, xa2) < 0) + goto done; } -#endif - return 0; + retval = 0; + done: + return retval; +} + +/* + * A server receiving a message with a element MUST + * terminate the NETCONF session. + */ +static int +netconf_hello_msg(clicon_handle h, + cxobj *xn) +{ + int retval = -1; + cvec *nsc = NULL; // namespace context + cxobj **vec = NULL; + cxobj *x; + cxobj *xcap; + size_t veclen; + int foundbase; + char *body; + + _netconf_hello_nr++; + if (xml_find_type(xn, NULL, "session-id", CX_ELMNT) != NULL) { + clicon_err(OE_XML, errno, "Server received hello with session-id from client, terminating (see RFC 6241 Sec 8.1"); + cc_closed++; + goto done; + } + if (xpath_vec(xn, nsc, "capabilities/capability", &vec, &veclen) < 0) + goto done; + /* Each peer MUST send at least the base NETCONF capability, "urn:ietf:params:netconf:base:1.1"*/ + foundbase=0; + if ((xcap = xml_find_type(xn, NULL, "capabilities", CX_ELMNT)) != NULL) { + x = NULL; + while ((x = xml_child_each(xcap, x, CX_ELMNT)) != NULL) { + if (strcmp(xml_name(x), "capability") != 0) + continue; + if ((body = xml_body(x)) == NULL) + continue; + /* When comparing protocol version capability URIs, only the base part is used, in the + * event any parameters are encoded at the end of the URI string. */ + if (strncmp(body, NETCONF_BASE_CAPABILITY_1_0, strlen(NETCONF_BASE_CAPABILITY_1_0)) == 0) /* RFC 4741 */ + foundbase++; + else if (strncmp(body, NETCONF_BASE_CAPABILITY_1_1, strlen(NETCONF_BASE_CAPABILITY_1_1)) == 0) /* RFC 6241 */ + foundbase++; + } + } + if (foundbase == 0){ + clicon_err(OE_XML, errno, "Server received hello without netconf base capability %s, terminating (see RFC 6241 Sec 8.1", + NETCONF_BASE_CAPABILITY_1_1); + cc_closed++; + goto done; + } + retval = 0; + done: + return retval; } /*! Process incoming Netconf RPC netconf message @@ -117,64 +189,69 @@ netconf_rpc_message(clicon_handle h, int ret; cbuf *cbret = NULL; cxobj *xc; - cxobj *xa; - cxobj *xa2; + if (_netconf_hello_nr == 0 && + clicon_option_bool(h, "CLICON_NETCONF_HELLO_OPTIONAL") == 0){ + if (netconf_operation_failed_xml(&xret, "rpc", "Client must send an hello element before any RPC")< 0) + goto done; + /* Copy attributes from incoming request to reply. Skip already present (dont overwrite) */ + if (netconf_add_request_attr(xrpc, xret) < 0) + goto done; + if ((cbret = cbuf_new()) == NULL){ + clicon_err(OE_XML, errno, "cbuf_new"); + goto done; + } + clicon_xml2cbuf(cbret, xret, 0, 0, -1); + netconf_output_encap(1, cbret, "rpc-error"); + cc_closed++; + goto ok; + } if ((ret = xml_bind_yang_rpc(xrpc, yspec, &xret)) < 0) goto done; if (ret > 0 && (ret = xml_yang_validate_rpc(h, xrpc, &xret)) < 0) goto done; if (ret == 0){ + if (netconf_add_request_attr(xrpc, xret) < 0) + goto done; if ((cbret = cbuf_new()) == NULL){ - clicon_err(LOG_ERR, errno, "cbuf_new"); + clicon_err(OE_XML, errno, "cbuf_new"); goto done; } clicon_xml2cbuf(cbret, xret, 0, 0, -1); - netconf_output_encap(1, cbret, "rpc-error"); + if (netconf_output_encap(1, cbret, "rpc-error") < 0) + goto done; goto ok; } if (netconf_rpc_dispatch(h, xrpc, &xret) < 0){ goto done; } - else{ /* there is a return message in xret */ - if (xret == NULL){ - if ((cbret = cbuf_new()) == NULL){ - clicon_err(LOG_ERR, errno, "cbuf_new"); - goto done; - } - if (netconf_operation_failed(cbret, "rpc", "Internal error: no xml return")< 0) - goto done; - netconf_output_encap(1, cbret, "rpc-error"); + /* Is there a return message in xret? */ + if (xret == NULL){ + if (netconf_operation_failed_xml(&xret, "rpc", "Internal error: no xml return")< 0) + goto done; + if (netconf_add_request_attr(xrpc, xret) < 0) + goto done; + if ((cbret = cbuf_new()) == NULL){ + clicon_err(OE_XML, errno, "cbuf_new"); goto done; } - if ((xc = xml_child_i(xret, 0))!=NULL){ - xa=NULL; - /* Copy message-id attribute from incoming to reply. - * RFC 6241: - * If additional attributes are present in an element, a NETCONF - * peer MUST return them unmodified in the element. This - * includes any "xmlns" attributes. - */ - while ((xa = xml_child_each(xrpc, xa, CX_ATTR)) != NULL){ - /* If attribute already exists, dont copy it */ - if (xml_find_type(xc, NULL, xml_name(xa), CX_ATTR) != NULL) - continue; - if ((xa2 = xml_dup(xa)) ==NULL) - goto done; - if (xml_addsub(xc, xa2) < 0) - goto done; - } - if ((cbret = cbuf_new()) == NULL){ - clicon_err(LOG_ERR, errno, "cbuf_new"); - goto done; - } - clicon_xml2cbuf(cbret, xml_child_i(xret,0), 0, 0, -1); - if (netconf_output_encap(1, cbret, "rpc-reply") < 0){ - cbuf_free(cbret); - goto done; - } + clicon_xml2cbuf(cbret, xret, 0, 0, -1); + if (netconf_output_encap(1, cbret, "rpc-error") < 0) + goto done; + goto ok; + } + if ((xc = xml_child_i(xret, 0))!=NULL){ + /* Copy attributes from incoming request to reply. Skip already present (dont overwrite) */ + if (netconf_add_request_attr(xrpc, xc) < 0) + goto done; + if ((cbret = cbuf_new()) == NULL){ + clicon_err(OE_XML, errno, "cbuf_new"); + goto done; } + clicon_xml2cbuf(cbret, xml_child_i(xret,0), 0, 0, -1); + if (netconf_output_encap(1, cbret, "rpc-reply") < 0) + goto done; } ok: retval = 0; @@ -199,44 +276,55 @@ netconf_input_packet(clicon_handle h, cxobj *xreq, yang_stmt *yspec) { - int retval = -1; - cbuf *cbret = NULL; - char *rpcname; - char *rpcprefix; - char *namespace = NULL; + int retval = -1; + cbuf *cbret = NULL; + char *rpcname; + char *rpcprefix; + char *namespace = NULL; + cxobj *xret = NULL; clicon_debug(1, "%s", __FUNCTION__); rpcname = xml_name(xreq); rpcprefix = xml_prefix(xreq); if (xml2ns(xreq, rpcprefix, &namespace) < 0) goto done; - /* Only accept resolved NETCONF base namespace */ - if (namespace == NULL || strcmp(namespace, NETCONF_BASE_NAMESPACE) != 0){ - if ((cbret = cbuf_new()) == NULL){ - clicon_err(LOG_ERR, errno, "cbuf_new"); - goto done; - } - if (netconf_unknown_namespace(cbret, "protocol", rpcprefix, "No appropriate namespace associated with prefix")< 0) - goto done; - netconf_output_encap(1, cbret, "rpc-error"); - } if (strcmp(rpcname, "rpc") == 0){ + /* Only accept resolved NETCONF base namespace */ + if (namespace == NULL || strcmp(namespace, NETCONF_BASE_NAMESPACE) != 0){ + if (netconf_unknown_namespace_xml(&xret, "protocol", rpcprefix, "No appropriate namespace associated with prefix")< 0) + goto done; + if (netconf_add_request_attr(xreq, xret) < 0) + goto done; + if ((cbret = cbuf_new()) == NULL){ + clicon_err(OE_XML, errno, "cbuf_new"); + goto done; + } + clicon_xml2cbuf(cbret, xret, 0, 0, -1); + netconf_output_encap(1, cbret, "rpc-error"); + goto ok; + } if (netconf_rpc_message(h, xreq, yspec) < 0) goto done; } else if (strcmp(rpcname, "hello") == 0){ - if (netconf_hello(h, xreq) < 0) + /* Only accept resolved NETCONF base namespace */ + if (namespace == NULL || strcmp(namespace, NETCONF_BASE_NAMESPACE) != 0){ + clicon_err(OE_XML, EFAULT, "No appropriate namespace associated with prefix:%s", rpcprefix); + goto done; + } + if (netconf_hello_msg(h, xreq) < 0) goto done; } else{ if ((cbret = cbuf_new()) == NULL){ - clicon_err(LOG_ERR, errno, "cbuf_new"); + clicon_err(OE_XML, errno, "cbuf_new"); goto done; } if (netconf_unknown_element(cbret, "protocol", rpcname, "Unrecognized netconf operation")< 0) goto done; netconf_output_encap(1, cbret, "rpc-error"); } + ok: retval = 0; done: if (cbret) @@ -250,6 +338,17 @@ netconf_input_packet(clicon_handle h, * @param[in] cb Packet buffer * @retval 0 OK * @retval -1 Fatal error + * @note there are errors detected here prior to whether you know what kind if message it is, and + * these errors are returned as "rpc-error". + * This is problematic since RFC6241 only says to return rpc-error on errors to . + * Not at this early stage, the incoming message can be something else such as or + * something else. + * In section 8.1 regarding handling of it says just to "terminate" the session which I + * interpret as not sending anything back, just closing the session. + * Anyway, clixon therefore does the following on error: + * - Before we know what it is: send rpc-error + * - Hello messages: terminate + * - RPC messages: send rpc-error */ static int netconf_input_frame(clicon_handle h, @@ -290,12 +389,16 @@ netconf_input_frame(clicon_handle h, } if (netconf_operation_failed(cbret, "rpc", clicon_err_reason)< 0) goto done; - netconf_output_encap(1, cbret, "rpc-error"); /* XXX */ + netconf_output_encap(1, cbret, "rpc-error"); goto ok; } if (ret == 0){ + /* Note: xtop can be "hello" in which case one (maybe) should drop the session and log + * However, its not until netconf_input_packet that rpc vs hello vs other identification is + * actually made + */ if ((cbret = cbuf_new()) == NULL){ - clicon_err(LOG_ERR, errno, "cbuf_new"); + clicon_err(OE_XML, errno, "cbuf_new"); goto done; } clicon_xml2cbuf(cbret, xret, 0, 0, -1); @@ -413,8 +516,9 @@ netconf_input_cb(int s, if (netconf_input_frame(h, cb) < 0 && !ignore_packet_errors) // default is to ignore errors goto done; - if (cc_closed) + if (cc_closed){ break; + } cbuf_reset(cb); } } diff --git a/lib/clixon/clixon_netconf_lib.h b/lib/clixon/clixon_netconf_lib.h index c417e415..64b5937a 100644 --- a/lib/clixon/clixon_netconf_lib.h +++ b/lib/clixon/clixon_netconf_lib.h @@ -40,6 +40,31 @@ #ifndef _CLIXON_NETCONF_LIB_H #define _CLIXON_NETCONF_LIB_H +/* + * Constants + */ +/* Default NETCONF namespace (see rfc6241 3.1) + * See USE_NETCONF_NS_AS_DEFAULT for use of this namespace as default + * Also, bind it to prefix:nc as used by, for example, the operation attribute + * (also in RFC4741 Sec 3.1) + * BTW this may not be the best way to keep them. + */ +#define NETCONF_BASE_NAMESPACE "urn:ietf:params:xml:ns:netconf:base:1.0" +#define NETCONF_BASE_PREFIX "nc" + +/* Netconf base capability as defined in RFC4741, Sec 8.1 + */ +#define NETCONF_BASE_CAPABILITY_1_0 "urn:ietf:params:netconf:base:1.0" + +/* Netconf base capability as defined in RFC6241, Sec 8.1 + */ +#define NETCONF_BASE_CAPABILITY_1_1 "urn:ietf:params:netconf:base:1.1" + +/* See RFC 7950 Sec 5.3.1: YANG defines an XML namespace for NETCONF + * operations, content, and the element. + */ +#define YANG_XML_NAMESPACE "urn:ietf:params:xml:ns:yang:1" + /* * Types */ diff --git a/lib/clixon/clixon_xml.h b/lib/clixon/clixon_xml.h index a54d8eb1..93c9410a 100644 --- a/lib/clixon/clixon_xml.h +++ b/lib/clixon/clixon_xml.h @@ -46,18 +46,6 @@ * Constants */ -/* Default NETCONF namespace (see rfc6241 3.1) - * See USE_NETCONF_NS_AS_DEFAULT for use of this namespace as default - * Also, bind it to prefix:nc as used by, for example, the operation attribute - */ -#define NETCONF_BASE_NAMESPACE "urn:ietf:params:xml:ns:netconf:base:1.0" -#define NETCONF_BASE_PREFIX "nc" - -/* See RFC 7950 Sec 5.3.1: YANG defines an XML namespace for NETCONF - * operations, content, and the element. - */ -#define YANG_XML_NAMESPACE "urn:ietf:params:xml:ns:yang:1" - /* Input symbol for netconf edit-config (+validate) * ietf-netconf.yang defines is as input: * choice edit-content { diff --git a/lib/src/clixon_client.c b/lib/src/clixon_client.c index 15b84d6d..7701bf02 100644 --- a/lib/src/clixon_client.c +++ b/lib/src/clixon_client.c @@ -195,6 +195,40 @@ clixon_client_lock(int sock, return retval; } +/*! Internal function to construct the encoding and hello message + * + * @param[in] sock Socket + * @param[in] namespace Default namespace used for non-prefixed entries in xpath. (Alt use nsc) + * @param[in] xpath XPath + * @param[out] xdata XML data tree (may or may not include the intended data) + * @retval 0 OK + * @retval -1 Error + */ +static int +clixon_client_hello(int sock) +{ + int retval = -1; + cbuf *msg = NULL; + + clicon_debug(1, "%s", __FUNCTION__); + if ((msg = cbuf_new()) == NULL){ + clicon_err(OE_PLUGIN, errno, "cbuf_new"); + goto done; + } + cprintf(msg, ""); + cprintf(msg, "", NETCONF_BASE_NAMESPACE); + cprintf(msg, "%s", NETCONF_BASE_CAPABILITY_1_1); + cprintf(msg, ""); + if (clicon_msg_send1(sock, msg) < 0) + goto done; + retval = 0; + done: + clicon_debug(1, "%s retval:%d", __FUNCTION__, retval); + if (msg) + cbuf_free(msg); + return retval; +} + /*! Connect client to clixon backend according to config and return a socket * @param[in] h Clixon handle * @param[in] socktype Type of socket, internal/external/netconf/ssh @@ -260,6 +294,9 @@ clixon_client_connect(clicon_handle h, if (clixon_proc_socket(argv, &cch->cch_pid, &cch->cch_socket) < 0){ goto err; } + /* Start with encoding and hello message */ + if (clixon_client_hello(cch->cch_socket) < 0) + goto err; break; case CLIXON_CLIENT_SSH: break; @@ -349,6 +386,7 @@ clixon_xml_bottom(cxobj *xtop, return retval; } + /*! Internal function to construct a get-config and query a value from the backend * * @param[in] sock Socket diff --git a/lib/src/clixon_netconf_lib.c b/lib/src/clixon_netconf_lib.c index c514a328..8762bbfc 100644 --- a/lib/src/clixon_netconf_lib.c +++ b/lib/src/clixon_netconf_lib.c @@ -1541,7 +1541,13 @@ netconf_hello_server(clicon_handle h, cprintf(cb, "", NETCONF_BASE_NAMESPACE, 42); cprintf(cb, ""); - cprintf(cb, "urn:ietf:params:netconf:base:1.0"); + /* Each peer MUST send at least the base NETCONF capability, "urn:ietf:params:netconf:base:1.1" + * RFC 6241 Sec 8.1 + */ + cprintf(cb, "%s", NETCONF_BASE_CAPABILITY_1_1); + /* A peer MAY include capabilities for previous NETCONF versions, to indicate + that it supports multiple protocol versions. */ + cprintf(cb, "%s", NETCONF_BASE_CAPABILITY_1_0); /* Check if RFC7895 loaded and revision found */ if ((ietf_yang_library_revision = yang_modules_revision(h)) != NULL){ if (xml_chardata_encode(&encstr, "urn:ietf:params:netconf:capability:yang-library:1.0?revision=%s&module-set-id=%s", @@ -1575,7 +1581,7 @@ netconf_hello_req(clicon_handle h, cprintf(cb, "", NETCONF_BASE_NAMESPACE); cprintf(cb, ""); - cprintf(cb, "urn:ietf:params:netconf:base:1.0"); + cprintf(cb, "%s", NETCONF_BASE_CAPABILITY_1_1); cprintf(cb, ""); cprintf(cb, ""); cprintf(cb, "]]>]]>"); diff --git a/lib/src/clixon_proto_client.c b/lib/src/clixon_proto_client.c index c4c90dc1..d090ed82 100644 --- a/lib/src/clixon_proto_client.c +++ b/lib/src/clixon_proto_client.c @@ -1187,9 +1187,10 @@ clicon_hello_req(clicon_handle h, int ret; username = clicon_username_get(h); - if ((msg = clicon_msg_encode(0, "urn:ietf:params:netconf:base:1.0", + if ((msg = clicon_msg_encode(0, "%s", username?username:"", - NETCONF_BASE_NAMESPACE)) == NULL) + NETCONF_BASE_NAMESPACE, + NETCONF_BASE_CAPABILITY_1_1)) == NULL) goto done; if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; diff --git a/lib/src/clixon_xml_bind.c b/lib/src/clixon_xml_bind.c index babfd50b..caa00725 100644 --- a/lib/src/clixon_xml_bind.c +++ b/lib/src/clixon_xml_bind.c @@ -543,8 +543,38 @@ xml_bind_yang_rpc(cxobj *xrpc, cxobj *xc; opname = xml_name(xrpc); - if ((strcmp(opname, "hello")) == 0) /* Hello: dont bind, dont appear in any yang spec */ + if ((strcmp(opname, "hello")) == 0){ + /* Hello: dont bind, dont appear in any yang spec, just ensure there is nothing apart from + * session-id or capabilities/capability tags + * If erro, just log, drop and close, rpc-error should not be sent since it is not rpc + */ + x = NULL; + while ((x = xml_child_each(xrpc, x, CX_ELMNT)) != NULL) { + name = xml_name(x); + if (strcmp(name, "session-id") == 0) + continue; + else if (strcmp(name, "capabilities") == 0){ + xc = NULL; + while ((xc = xml_child_each(x, xc, CX_ELMNT)) != NULL) { + if (strcmp(xml_name(xc), "capability") != 0){ + if (xerr && + netconf_unknown_element_xml(xerr, "protocol", xml_name(xc), + "Unrecognized hello/capabilities element") < 0) + goto done; + goto fail; + } + } + } + else { + if (xerr && + netconf_unknown_element_xml(xerr, "protocol", name, "Unrecognized hello element") < 0) + goto done; + clicon_err(OE_XML, EFAULT, "Unrecognized hello element: %s", name); + goto fail; + } + } goto ok; + } else if ((strcmp(opname, "notification")) == 0) goto ok; else if ((strcmp(opname, "rpc")) == 0) diff --git a/lib/src/clixon_xml_io.c b/lib/src/clixon_xml_io.c index 4eba888d..00062bd4 100644 --- a/lib/src/clixon_xml_io.c +++ b/lib/src/clixon_xml_io.c @@ -690,7 +690,7 @@ clixon_xml_parse_file(FILE *fp, * @param[in,out] xt Pointer to XML parse tree. If empty will be created. * @param[out] xerr Reason for failure (yang assignment not made) if retval = 0 * @retval 1 Parse OK and all yang assignment made - * @retval 0 Parse OK but yang assigment not made (or only partial) + * @retval 0 Parse OK but yang assigment not made (or only partial), xerr is set * @retval -1 Error with clicon_err called. Includes parse error * * @code diff --git a/lib/src/clixon_xml_nsctx.c b/lib/src/clixon_xml_nsctx.c index de69b948..e68201c2 100644 --- a/lib/src/clixon_xml_nsctx.c +++ b/lib/src/clixon_xml_nsctx.c @@ -68,6 +68,7 @@ #include "clixon_yang.h" #include "clixon_xml.h" #include "clixon_yang_module.h" +#include "clixon_netconf_lib.h" #include "clixon_xml_nsctx.h" /* Undefine if you want to ensure strict namespace assignment on all netconf diff --git a/lib/src/clixon_xml_parse.y b/lib/src/clixon_xml_parse.y index c4ab9638..9bfd6d00 100644 --- a/lib/src/clixon_xml_parse.y +++ b/lib/src/clixon_xml_parse.y @@ -170,7 +170,7 @@ xml_parse_version(clixon_xml_yacc *xy, char *ver) { if(strcmp(ver, "1.0")){ - clicon_err(OE_XML, XMLPARSE_ERRNO, "Wrong XML version %s expected 1.0", ver); + clicon_err(OE_XML, XMLPARSE_ERRNO, "Unsupported XML version: %s expected 1.0", ver); free(ver); return -1; } @@ -179,6 +179,31 @@ xml_parse_version(clixon_xml_yacc *xy, return 0; } +/*! Parse XML encoding + * From under Encoding Declaration: + * In an encoding declaration, the values UTF-8, UTF-16, ISO-10646-UCS-2, and ISO-10646-UCS-4 + * SHOULD be used for the various encodings and transformations of Unicode / ISO/IEC 10646, the + * values ISO-8859-1, ISO-8859-2, ... ISO-8859- n (where n is the part number) SHOULD be used for + * the parts of ISO 8859, and the values ISO-2022-JP, Shift_JIS, and EUC-JP " SHOULD be used for + * the various encoded forms of JIS X-0208-1997. + * [UTF-8 is default] + * Note that since ASCII is a subset of UTF-8, ordinary ASCII entities do not strictly need an + * encoding declaration. + * + * Clixon supports only UTF-8 (or no declaration) + */ +static int +xml_parse_encoding(clixon_xml_yacc *xy, + char *enc) +{ + if(strcmp(enc, "UTF-8")){ + clicon_err(OE_XML, XMLPARSE_ERRNO, "Unsupported XML encoding: %s expected UTF-8", enc); + free(enc); + return -1; + } + return 0; +} + /*! Parse Qualified name -> (Un)PrefixedName * * This is where all (parsed) xml elements are created @@ -358,6 +383,7 @@ misc : comment { _PARSE_DEBUG("misc->comment"); } | WHITESPACE { _PARSE_DEBUG("misc->white space"); } ; +/* [23] XMLDecl ::= ''*/ xmldcl : BXMLDCL verinfo encodingdecl sddecl EQMARK { _PARSE_DEBUG("xmldcl->verinfo encodingdecl? sddecl?"); } ; @@ -370,8 +396,12 @@ verinfo : VER '=' '\"' STRING '\"' _PARSE_DEBUG("verinfo->version='STRING'");} ; -encodingdecl : ENC '=' '\"' STRING '\"' {if ($4)free($4);} - | ENC '=' '\'' STRING '\'' {if ($4)free($4);} +encodingdecl : ENC '=' '\"' STRING '\"' + { if (xml_parse_encoding(_XY, $4) <0) YYABORT; if ($4)free($4); + _PARSE_DEBUG("encodingdecl-> encoding = \" STRING \"");} + | ENC '=' '\'' STRING '\'' + { if (xml_parse_encoding(_XY, $4) <0) YYABORT; if ($4)free($4); + _PARSE_DEBUG("encodingdecl-> encoding = ' STRING '");} | ; diff --git a/lib/src/clixon_xpath_eval.c b/lib/src/clixon_xpath_eval.c index 6bee001e..0aa7ac23 100644 --- a/lib/src/clixon_xpath_eval.c +++ b/lib/src/clixon_xpath_eval.c @@ -182,19 +182,22 @@ nodetest_eval_node_localonly(cxobj *x, xpath_tree *xs, cvec *nsc) { - int retval = -1; + int retval = -1; char *name1 = xml_name(x); char *name2 = NULL; /* Namespaces is s0, name is s1 */ - if (strcmp(xs->xs_s1, "*")==0) - return 1; - name2 = xs->xs_s1; - /* Before going into namespaces, check name equality and filter out noteq */ - if (strcmp(name1, name2) != 0){ - retval = 0; /* no match */ + if (strcmp(xs->xs_s1, "*")==0){ + retval = 1; goto done; } + name2 = xs->xs_s1; + /* Before going into namespaces, check name equality and filter out noteq */ + if (strcmp(name1, name2) == 0){ + retval = 1; + goto done; + } + retval = 0; /* no match */ done: /* retval set in preceding statement */ return retval; } diff --git a/test/lib.sh b/test/lib.sh index 1caeed48..6bc10e80 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -55,10 +55,6 @@ testname= # : ${valgrindtest=0} -# Valgrind log file. This should be removed automatically. Note that mktemp -# actually creates a file so do not call it by default -#: ${valgrindfile=$(mktemp)} - # If set to 0, override starting of clixon_backend in test (you bring your own) : ${BE:=1} @@ -78,9 +74,13 @@ testname= # Default netconf namespace statement, typically as placed on top-level urn:ietf:params:netconf:base:1.1]]>]]>" + # Options passed to curl calls # -s : silent # -S : show error @@ -455,18 +455,30 @@ function expectpart(){ # - expected command return value (0 if OK) XXX SHOULD SWITCH w next # - stdin input # - expected stdout outcome +# - expected stderr outcome (can be null) # Use this if you want regex eg ^foo$ function expecteof(){ cmd=$1 retval=$2 input=$3 expect=$4 + if [ $# -gt 4 ]; then + errfile=$(mktemp) + expecterr=$5 # Do while read stuff -ret=$($cmd< $errfile < +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO e1 mymod:some-new-iftype @@ -225,10 +225,10 @@ expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "netconf verify get with refined ports" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^e1mymod:some-new-iftypetrue808080" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^e1mymod:some-new-iftypetrue808080" new "netconf set identity defined in other" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO e2 mymod:some-new-iftype @@ -237,10 +237,10 @@ expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "netconf validate ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf set identity defined in main" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO e3 mymod:some-new-iftype @@ -249,7 +249,7 @@ expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "netconf commit ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # restconf and augment new "restconf get augment json" diff --git a/test/test_augment_state.sh b/test/test_augment_state.sh index 756e8cb7..2774cfe2 100755 --- a/test/test_augment_state.sh +++ b/test/test_augment_state.sh @@ -123,13 +123,13 @@ function testrun() new "get config" if [ -z "$config" ]; then - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" else - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$config]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$config]]>]]>$" fi new "get state" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$state]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$state]]>]]>$" } new "test params: -f $cfg" @@ -214,10 +214,10 @@ EOF ) new "Add config" -expecteof "$clixon_netconf -qf $cfg" 0 "$CONFIG]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$CONFIG]]>]]>" "^]]>]]>" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" testrun "$CONFIG" "$EXPSTATE" diff --git a/test/test_augment_trans.sh b/test/test_augment_trans.sh index 517af842..07327b5b 100755 --- a/test/test_augment_trans.sh +++ b/test/test_augment_trans.sh @@ -114,14 +114,14 @@ wait_backend new "get-config empty" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if false; then new "Add config" -expecteof "$clixon_netconf -qf $cfg" 0 "<>]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<>]]>]]>" "^]]>]]>" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" fi diff --git a/test/test_c++.sh b/test/test_c++.sh index 446aa411..497058e3 100755 --- a/test/test_c++.sh +++ b/test/test_c++.sh @@ -154,7 +154,7 @@ new "wait backend" wait_backend new "Netconf runtime test" -expecteof "$clixon_netconf -qf $cfg" 0 '0]]>]]>' '^042]]>]]>$' +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO0]]>]]>" '^042]]>]]>$' if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_choice.sh b/test/test_choice.sh index 81990a6d..f9f67427 100755 --- a/test/test_choice.sh +++ b/test/test_choice.sh @@ -135,40 +135,40 @@ fi # First vanilla (protocol) case new "netconf validate empty" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf set protocol both udp and tcp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf validate both udp and tcp fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementudperrorElement in choice statement already exists]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementudperrorElement in choice statement already exists]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf set empty protocol" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf validate protocol" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf set protocol tcp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get protocol tcp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^" new "netconf commit protocol tcp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf changing from TCP to UDP (RFC7950 7.9.6)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get protocol udp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^" new "netconf commit protocol udp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #-- restconf new "restconf DELETE whole datastore" @@ -206,81 +206,81 @@ expectpart "$($clixon_cli -1 -f $cfg -l o commit)" 0 "^$" # Second shorthand (no case) new "netconf set protocol both udp and tcp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf validate both udp and tcp fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementudperrorElement in choice statement already exists]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementudperrorElement in choice statement already exists]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf set shorthand tcp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf changing from TCP to UDP (RFC7950 7.9.6)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get shorthand udp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf validate shorthand" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Third check mandatory new "netconf set empty mandatory" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get mandatory empty" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf validate mandatory" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationdata-missingmissing-choicenameerror]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationdata-missingmissing-choicenameerror]]>]]>$" new "netconf set mandatory udp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get mandatory udp" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf validate mandatory" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Choice with multiple items new "netconf choice multiple items first" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO 0 1 2 ]]>]]>" "^]]>]]>$" new "netconf validate multiple ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf choice multiple items second" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO 0 1 ]]>]]>" "^]]>]]>$" new "netconf validate multiple ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf choice multiple items mix" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO 0 2 2 ]]>]]>" "^]]>]]>$" new "netconf validate multiple error" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementmcerrorElement in choice statement already exists]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementmcerrorElement in choice statement already exists]]>]]>$" if [ $RC -ne 0 ]; then new "Kill restconf daemon" diff --git a/test/test_cli_multikey.sh b/test/test_cli_multikey.sh index f8b2b3bd..9a592b8b 100755 --- a/test/test_cli_multikey.sh +++ b/test/test_cli_multikey.sh @@ -104,7 +104,7 @@ new "set 1 v2 again" expectpart "$($clixon_cli -1 -f $cfg set ex x a 1 b v2)" 0 "" new "show conf" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^1v11v21v32v12v22v3]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^1v11v21v32v12v22v3]]>]]>$" # ordered-by user new "set 1 v1" @@ -123,7 +123,7 @@ new "set 2 v2" expectpart "$($clixon_cli -1 -f $cfg set ex y a 2 b v2)" 0 "" new "show conf" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^1v11v21v32v12v22v31v12v11v21v32v2]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^1v11v21v32v12v22v31v12v11v21v32v2]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_client.sh b/test/test_client.sh index d2b30046..7afb1794 100755 --- a/test/test_client.sh +++ b/test/test_client.sh @@ -93,6 +93,7 @@ main(int argc, /* Make a conenction over netconf or ssh/netconf */ if ((ch = clixon_client_connect(h, CLIXON_CLIENT_NETCONF)) == NULL) return -1; + /* Here are read functions depending on an example YANG * (Need an example YANG and XML input to confd) */ diff --git a/test/test_copy_config.sh b/test/test_copy_config.sh index b9ae23ea..d40a52df 100755 --- a/test/test_copy_config.sh +++ b/test/test_copy_config.sh @@ -92,81 +92,81 @@ if [ $RC -ne 0 ]; then fi new "Add config to candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "eth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" new "netconf commit to running" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Delete candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "eth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" # Here startup and candidate are empty, only running has content # test running->startup and running->candidate new "Check candidate empty" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Check startup empty" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "copy running->startup" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "copy running->candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Here startup and candidate have content new "Check candidate content" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^eth/0/0ex:ethtrue]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^eth/0/0ex:ethtrue]]>]]>$" new "Check startup content" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^eth/0/0ex:ethtrue]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^eth/0/0ex:ethtrue]]>]]>$" new "Delete startup" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Here startup is empty and candidate has content # test candidate->startup new "Check startup empty" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "copy candidate->startup" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Check startup content" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^eth/0/0ex:ethtrue]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^eth/0/0ex:ethtrue]]>]]>$" new "Delete candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "eth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" # Here candidate is empty and startup has content # test startup->candidate new "Check candidate empty" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "copy startup->candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Check candidate content" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^eth/0/0ex:ethtrue]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^eth/0/0ex:ethtrue]]>]]>$" # Negative test: check copying to running is not allowed new "Delete candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "eth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" new "netconf commit to running" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Here running is empty new "Check running empty" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Add to candidate new "copy startup->candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if ! $YANG_UNKNOWN_ANYDATA ; then new "copy startup->running not allowed" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationunknown-elementrunningerrorFailed to find YANG spec of XML node: running with parent: target in namespace: urn:ietf:params:xml:ns:netconf:base:1.0]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationunknown-elementrunningerrorFailed to find YANG spec of XML node: running with parent: target in namespace: urn:ietf:params:xml:ns:netconf:base:1.0]]>]]>$" fi # restconf copy @@ -178,7 +178,7 @@ expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+xml # Here running is empty new "Check running empty" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if [ $RC -ne 0 ]; then new "Kill restconf daemon" diff --git a/test/test_datastore_repair.sh b/test/test_datastore_repair.sh index 01db5f4c..0ca1f1a9 100755 --- a/test/test_datastore_repair.sh +++ b/test/test_datastore_repair.sh @@ -98,7 +98,7 @@ function testrun(){ fi new "netconf get config" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$AFTER]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$AFTER]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_feature.sh b/test/test_feature.sh index f636a7c4..721adc2d 100755 --- a/test/test_feature.sh +++ b/test/test_feature.sh @@ -131,16 +131,16 @@ function testrun() if $enabled; then new "netconf set $node" - expecteof "$clixon_netconf -qf $cfg" 0 "<$node xmlns=\"urn:example:clixon\">foo]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<$node xmlns=\"urn:example:clixon\">foo]]>]]>" "^]]>]]>$" new "netconf validate $node" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" else new "netconf set $node, expect fail" - expecteof "$clixon_netconf -qf $cfg" 0 "<$node xmlns=\"urn:example:clixon\">foo]]>]]>" "^applicationunknown-element$nodeerrorFailed to find YANG spec of XML node: $node with parent: config in namespace: urn:example:clixon]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<$node xmlns=\"urn:example:clixon\">foo]]>]]>" "^applicationunknown-element$nodeerrorFailed to find YANG spec of XML node: $node with parent: config in namespace: urn:example:clixon]]>]]>$" fi new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" } new "test params: -f $cfg" @@ -171,7 +171,7 @@ new "cli disabled feature in other module" expectpart "$($clixon_cli -1f $cfg -l o set routing ribs rib default-rib false)" 255 "CLI syntax error: \"set routing ribs rib default-rib false\": Unknown command" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Single if-feature testrun x true @@ -192,7 +192,7 @@ testrun m8 false # reply since the modules change so often new "netconf schema resource, RFC 7895" ret=$($clixon_netconf -qf $cfg<]]>]]> +$DEFAULTHELLO]]>]]> EOF ) #echo $ret diff --git a/test/test_identity.sh b/test/test_identity.sh index 2d0ae5cf..989d596a 100755 --- a/test/test_identity.sh +++ b/test/test_identity.sh @@ -169,49 +169,49 @@ if [ $RC -ne 0 ]; then fi new "Set crypto to aes" -expecteof "$clixon_netconf -qf $cfg" 0 "aes]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOaes]]>]]>" "^]]>]]>$" new "netconf validate " -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Set crypto to mc:aes" -expecteof "$clixon_netconf -qf $cfg" 0 "mc:aes]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOmc:aes]]>]]>" "^]]>]]>$" new "netconf validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Set crypto to des:des3" -expecteof "$clixon_netconf -qf $cfg" 0 "des:des3]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOdes:des3]]>]]>" "^]]>]]>$" new "netconf validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Set crypto to mc:foo" -expecteof "$clixon_netconf -qf $cfg" 0 "mc:foo]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOmc:foo]]>]]>" "^]]>]]>$" new "netconf validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Set crypto to des:des3 using xmlns" -expecteof "$clixon_netconf -qf $cfg" 0 "des:des3]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOdes:des3]]>]]>" "^]]>]]>$" new "netconf validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if false; then # XXX this is not supported new "Set crypto to x:des3 using xmlns" -expecteof "$clixon_netconf -qf $cfg" 0 "x:des3]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOx:des3]]>]]>" "^]]>]]>$" new "netconf validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" fi # not supported new "Set crypto to foo:bar" -expecteof "$clixon_netconf -qf $cfg" 0 "foo:bar]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOfoo:bar]]>]]>" "^]]>]]>$" new "netconf validate (expect fail)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-failederrorIdentityref validation failed, foo:bar not derived from crypto-alg]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorIdentityref validation failed, foo:bar not derived from crypto-alg]]>]]>$" new "cli set crypto to mc:aes" expectpart "$($clixon_cli -1 -f $cfg -l o set crypto mc:aes)" 0 "^$" @@ -232,19 +232,19 @@ new "cli validate" expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 0 "^$" new "Netconf set acl-type" -expecteof "$clixon_netconf -qf $cfg" 0 "xmc:ipv4-acl-type]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOxmc:ipv4-acl-type]]>]]>" "^]]>]]>$" new "netconf validate " -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Netconf set undefined acl-type" -expecteof "$clixon_netconf -qf $cfg" 0 "xundefined]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOxundefined]]>]]>" "^]]>]]>$" new "netconf validate fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-failederrorIdentityref validation failed, undefined not derived from acl-base]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorIdentityref validation failed, undefined not derived from acl-base]]>]]>" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "CLI set acl-type" expectpart "$($clixon_cli -1 -f $cfg -l o set acls acl x type mc:ipv4-acl-type)" 0 "^$" @@ -266,7 +266,7 @@ new "cli validate empty" expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 255 "Validate failed. Edit and try again or discard changes: application operation-failed Identityref validation failed, undefined not derived from acl-base" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # restconf and identities: # 1. set identity in own module with restconf (PUT and POST), read it with restconf and netconf @@ -279,7 +279,7 @@ new "restconf get own identity" expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:crypto)" 0 'HTTP/1.1 200 OK' '{"example:crypto":"aes"}' new "netconf get own identity as set by restconf" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^aes" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^aes" new "restconf delete identity" expectpart "$(curl $CURLOPTS -X DELETE $RCPROTO://localhost/restconf/data/example:crypto)" 0 "HTTP/1.1 204 No Content" @@ -300,23 +300,23 @@ new "restconf get other identity" expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:crypto)" 0 'HTTP/1.1 200 OK' '{"example:crypto":"example-des:des3"}' new "netconf get other identity" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^des:des3" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^des:des3" new "restconf delete identity" expectpart "$(curl $CURLOPTS -X DELETE $RCPROTO://localhost/restconf/data/example:crypto)" 0 "HTTP/1.1 204 No Content" # 3. set identity in other module with netconf, read it with restconf and netconf new "netconf set other identity" -expecteof "$clixon_netconf -qf $cfg" 0 "des:des3]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOdes:des3]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "restconf get other identity (set by netconf)" expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:crypto)" 0 'HTTP/1.1 200 OK' '{"example:crypto":"example-des:des3"}' new "netconf get other identity" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^des:des3" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^des:des3" if [ $RC -ne 0 ]; then new "Kill restconf daemon" diff --git a/test/test_leaf_default.sh b/test/test_leaf_default.sh index 8fe1aabf..d28e0dc7 100755 --- a/test/test_leaf_default.sh +++ b/test/test_leaf_default.sh @@ -124,25 +124,25 @@ if [ $BE -ne 0 ]; then fi new "get config" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$XML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$XML]]>]]>$" new "Change default value r1" -expecteof "$clixon_netconf -qf $cfg" 0 "99]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO99]]>]]>" "^]]>]]>$" new "get config r1" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^99]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^99]]>]]>$" new "Remove r1" -expecteof "$clixon_netconf -qf $cfg" 0 "99]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO99]]>]]>" "^]]>]]>$" new "get config" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$XML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$XML]]>]]>$" new "Set x list element" -expecteof "$clixon_netconf -qf $cfg" 0 "a]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOa]]>]]>" "^]]>]]>$" new "get config (should contain y/inside+outside)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$XMLafalsefalse]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$XMLafalsefalse]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" @@ -179,7 +179,7 @@ fi new "get startup config" # Should have all defaults, except r1 that is set to 99 -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$XML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$XML]]>]]>$" # permission kludges sudo chmod 666 $dir/running_db @@ -194,10 +194,10 @@ if [ $? -ne 0 ]; then fi new "Change default value r2" -expecteof "$clixon_netconf -qf $cfg" 0 "88]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO88]]>]]>" "^]]>]]>$" new "commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Check running no defaults: r1 and r2" # Again, running should have only non-defaults, ie only r1 and r2 @@ -237,7 +237,7 @@ if [ $BE -ne 0 ]; then fi new "get startup config with presence" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$XML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$XML]]>]]>$" new "Kill backend" # Check if premature kill @@ -267,7 +267,7 @@ if [ $BE -ne 0 ]; then fi new "get startup config with list default" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$XMLafalsefalse]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$XMLafalsefalse]]>]]>$" new "Kill backend" # Check if premature kill diff --git a/test/test_leafref.sh b/test/test_leafref.sh index fed72778..9ac15394 100755 --- a/test/test_leafref.sh +++ b/test/test_leafref.sh @@ -128,52 +128,52 @@ if [ $BE -ne 0 ]; then fi new "leafref base config" -expecteof "$clixon_netconf -qf $cfg" 0 "$BASEXML]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$BASEXML]]>]]>" "^]]>]]>$" new "leafref get config" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$BASEXML]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$BASEXML]]>]]>" new "leafref base commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "leafref add non-existing ref" -expecteof "$clixon_netconf -qf $cfg" 0 "eth3
10.0.4.6
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth3
10.0.4.6
]]>]]>" "^]]>]]>$" new "leafref validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementeth3errorLeafref validation failed: No leaf eth3 matching path /if:interfaces/if:interface/if:name]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementeth3errorLeafref validation failed: No leaf eth3 matching path /if:interfaces/if:interface/if:name]]>]]>$" #new "leafref wrong ref" -#expecteof "$clixon_netconf -qf $cfg" 0 "eth3
10.0.4.6
]]>]]>" "^]]>]]>$" +#expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth3
10.0.4.6
]]>]]>" "^]]>]]>$" new "leafref discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "leafref add correct absref" -expecteof "$clixon_netconf -qf $cfg" 0 "eth0]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth0]]>]]>" "^]]>]]>$" new "leafref validate (ok)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^" new "leafref add correct relref" -expecteof "$clixon_netconf -qf $cfg" 0 "eth0]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth0]]>]]>" "^]]>]]>$" new "leafref validate (ok)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^" new "leafref add correct address" -expecteof "$clixon_netconf -qf $cfg" 0 "
192.0.2.1
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO
192.0.2.1
]]>]]>" "^]]>]]>$" new "leafref validate (ok)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^" new "leafref delete leaf" -expecteof "$clixon_netconf -qf $cfg" 0 "eth0]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth0]]>]]>" "^" new "leafref validate (should fail)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementeth0errorLeafref validation failed: No leaf eth0 matching path /if:interfaces/if:interface/if:name]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementeth0errorLeafref validation failed: No leaf eth0 matching path /if:interfaces/if:interface/if:name]]>]]>$" new "leafref discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "cli leafref lo" expectpart "$($clixon_cli -1f $cfg -l o set default-address absname lo)" 0 "^$" diff --git a/test/test_leafref_augment.sh b/test/test_leafref_augment.sh index c6df69e2..8e165db2 100755 --- a/test/test_leafref_augment.sh +++ b/test/test_leafref_augment.sh @@ -157,13 +157,13 @@ EOF ) new "leafref augment+leafref config top-level" -expecteof "$clixon_netconf -qf $cfg" 0 "$XML]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$XML]]>]]>" "^]]>]]>$" new "leafref augment+leafref validate top-level wrong prefix" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementxerrorLeafref validation failed: No leaf x matching path /ex:sender/ex:name]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementxerrorLeafref validation failed: No leaf x matching path /ex:sender/ex:name]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Test top-level, default prefix, correct leafref and typedef path XML=$(cat <$XML
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$XML]]>]]>" "^]]>]]>$" new "leafref augment+leafref validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Use augment, default prefixes, wrong leafref and typedef path XML=$(cat <$XML
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$XML]]>]]>" "^]]>]]>$" new "leafref augment+leafref validate wrong ref" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementxxxerrorLeafref validation failed: No leaf xxx matching path /ex:sender/ex:name]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementxxxerrorLeafref validation failed: No leaf xxx matching path /ex:sender/ex:name]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Use augment, default prefixes, correct leafref and in-data path XML=$(cat <$XML
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$XML]]>]]>" "^]]>]]>$" new "leafref augment+leafref validate in-data" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if [ $BE -ne 0 ]; then diff --git a/test/test_leafref_state.sh b/test/test_leafref_state.sh index 327c7292..301580cc 100755 --- a/test/test_leafref_state.sh +++ b/test/test_leafref_state.sh @@ -95,40 +95,40 @@ EOF ) new "leafref config sender x" -expecteof "$clixon_netconf -qf $cfg" 0 "$XML]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$XML]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Get path=/, state vs config new "netconf get / config+state" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^xx]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^xx]]>]]>$" new "netconf get / state-only" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^x]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^x]]>]]>$" new "netconf get / config-only" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^x]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^x]]>]]>$" # Get path=/sender-state, state vs config new "netconf get /sender-state config+state" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^x]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^x]]>]]>$" new "netconf get /sender-state state-only" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^x]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^x]]>]]>$" new "netconf get /sender-state config-only" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Get path=/sender-config, state vs config new "netconf get /sender-config config+state" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^x]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^x]]>]]>$" new "netconf get /sender-config state-only" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get /sender-config config-only" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^x]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^x]]>]]>$" # Negative tests, # Double xmlns attribute @@ -139,7 +139,7 @@ cat < $fstate EOF new "Merge same tree - check double xmlns attribute" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^x]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^x]]>]]>$" # Back to original cat < $fstate @@ -160,20 +160,20 @@ EOF ) # Negative tests, start with remove x and and add y instead new "leafref config delete sender x add y" -expecteof "$clixon_netconf -qf $cfg" 0 "$XML]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$XML]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Leafref wrong new "netconf get / config+state should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-failedxerrorLeafref validation failed: No leaf x matching path /ex:sender-config/ex:name. Internal error, state callback returned invalid XML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failedxerrorLeafref validation failed: No leaf x matching path /ex:sender-config/ex:name. Internal error, state callback returned invalid XML]]>]]>$" new "netconf get / state-only should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-failedxerrorLeafref validation failed: No leaf x matching path /ex:sender-config/ex:name. Internal error, state callback returned invalid XML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failedxerrorLeafref validation failed: No leaf x matching path /ex:sender-config/ex:name. Internal error, state callback returned invalid XML]]>]]>$" new "netconf get / config-only ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^y]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^y]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_minmax.sh b/test/test_minmax.sh index 2f162183..83e393bb 100755 --- a/test/test_minmax.sh +++ b/test/test_minmax.sh @@ -118,66 +118,66 @@ if [ $BE -ne 0 ]; then fi new "minmax: minimal: 1x a1,b1 (should be [1:2]" -expecteof "$clixon_netconf -qf $cfg" 0 "replace +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace 0 0 ]]>]]>" "^]]>]]>$" new "minmax: minimal validate ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "minmax: maximal: 2x a1,b1" -expecteof "$clixon_netconf -qf $cfg" 0 "replace01unbounded0101unbounded101]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace01unbounded0101unbounded101]]>]]>" "^]]>]]>$" new "minmax: validate ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "minmax: replace with 0x a1,b1" -expecteof "$clixon_netconf -qf $cfg" 0 "replace]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace]]>]]>" "^]]>]]>$" -#XXX echo "]]>]]>" |$clixon_netconf -qf $cfg +#XXX echo "$DEFAULTHELLO]]>]]>" |$clixon_netconf -qf $cfg new "minmax: validate should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocoloperation-failedtoo-few-elementserror/c/a1]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocoloperation-failedtoo-few-elementserror/c/a1]]>]]>$" new "minmax: no list" -expecteof "$clixon_netconf -qf $cfg" 0 "replace0]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace0]]>]]>" "^]]>]]>$" new "minmax: validate should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocoloperation-failedtoo-few-elementserror/c/a1]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocoloperation-failedtoo-few-elementserror/c/a1]]>]]>$" new "minmax: no leaf-list" -expecteof "$clixon_netconf -qf $cfg" 0 "replace0]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace0]]>]]>" "^]]>]]>$" new "minmax: validate should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocoloperation-failedtoo-few-elementserror/c/b1]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocoloperation-failedtoo-few-elementserror/c/b1]]>]]>$" new "minmax: Too large list" -expecteof "$clixon_netconf -qf $cfg" 0 "replace0120]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace0120]]>]]>" "^]]>]]>$" new "minmax: validate should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocoloperation-failedtoo-many-elementserror/c/a1]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocoloperation-failedtoo-many-elementserror/c/a1]]>]]>$" new "minmax: Too large leaf-list" -expecteof "$clixon_netconf -qf $cfg" 0 "replace0012]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace0012]]>]]>" "^]]>]]>$" new "minmax: validate should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocoloperation-failedtoo-many-elementserror/c/b1]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocoloperation-failedtoo-many-elementserror/c/b1]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # With choice c1 new "minmax choice: minimal" -expecteof "$clixon_netconf -qf $cfg" 0 "replace +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace 0 0 ]]>]]>" "^]]>]]>$" new "minmax choice: minimal validate ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "minmax choice: many a2" -expecteof "$clixon_netconf -qf $cfg" 0 "replace +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace 0 1 2 @@ -185,10 +185,10 @@ expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "minmax choice: many a2 validate ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "minmax choice: too many a1" -expecteof "$clixon_netconf -qf $cfg" 0 "replace +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace 0 1 2 @@ -196,54 +196,54 @@ expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "minmax choice: too many validate should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocoloperation-failedtoo-many-elementserror/c2/a1]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocoloperation-failedtoo-many-elementserror/c2/a1]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # top config level new "minmax top level" -expecteof "$clixon_netconf -qf $cfg" 0 "replace +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace 0 1 ]]>]]>" "^]]>]]>$" new "minmax top level ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "minmax top level too many" -expecteof "$clixon_netconf -qf $cfg" 0 "replace +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace 0 1 2 ]]>]]>" "^]]>]]>$" new "minmax top level too many should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocoloperation-failedtoo-many-elementserror/b3]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocoloperation-failedtoo-many-elementserror/b3]]>]]>" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Above only tests on candidate -> empty running # Also need to do commit tests when running has elements and candidate has fewer new "Set maximal: 2x a1,b1" -expecteof "$clixon_netconf -qf $cfg" 0 "replace0110]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace0110]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "minmax: delete to minimal: 1x a1,b1" -expecteof "$clixon_netconf -qf $cfg" 0 "none11]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnone11]]>]]>" "^]]>]]>$" new "minmax: commit minimal list" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "minmax: delete to no list" -expecteof "$clixon_netconf -qf $cfg" 0 "none00]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnone00]]>]]>" "^]]>]]>$" new "minmax: validate should fail empty list" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocoloperation-failedtoo-few-elementserror/c/a1]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocoloperation-failedtoo-few-elementserror/c/a1]]>]]>$" if [ $BE -ne 0]; then new "Kill backend" diff --git a/test/test_nacm.sh b/test/test_nacm.sh index e2c741ce..b2f81b39 100755 --- a/test/test_nacm.sh +++ b/test/test_nacm.sh @@ -149,10 +149,10 @@ new "disable nacm" expectpart "$(curl -u andy:bar $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" -d '{"ietf-netconf-acm:enable-nacm": false}' $RCPROTO://localhost/restconf/data/ietf-netconf-acm:nacm/enable-nacm)" 0 "HTTP/1.1 201 Created" new "auth set authentication config" -expecteof "$clixon_netconf -qf $cfg" 0 "$RULES]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$RULES]]>]]>" "^]]>]]>$" new "commit it" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "auth get (no user: access denied)" expectpart "$(curl $CURLOPTS -X GET -H \"Accept:\ application/yang-data+json\" $RCPROTO://localhost/restconf/data)" 0 "HTTP/1.1 401 Unauthorized" '{"ietf-restconf:errors":{"error":{"error-type":"protocol","error-tag":"access-denied","error-severity":"error","error-message":"The requested URL was unauthorized"}}} ' diff --git a/test/test_nacm_credentials.sh b/test/test_nacm_credentials.sh index 10d16aea..aaff9a18 100755 --- a/test/test_nacm_credentials.sh +++ b/test/test_nacm_credentials.sh @@ -144,13 +144,13 @@ EOF # First push in nacm rules via regular means new "auth set authentication config" - expecteof "$clixon_netconf -qf $cfg" 0 "$RULES]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$RULES]]>]]>" "^]]>]]>$" new "enable nacm" - expecteof "$clixon_netconf -qf $cfg" 0 "true]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOtrue]]>]]>" "^]]>]]>$" new "commit it" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # raw socket test if [ -n "$username" ]; then diff --git a/test/test_nacm_datanode.sh b/test/test_nacm_datanode.sh index b49a36fc..c45e502b 100755 --- a/test/test_nacm_datanode.sh +++ b/test/test_nacm_datanode.sh @@ -242,13 +242,13 @@ if [ $RC -ne 0 ]; then fi new "auth set authentication config" -expecteof "$clixon_netconf -qf $cfg" 0 "$RULES]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$RULES]]>]]>" "^]]>]]>$" new "set app config" -expecteof "$clixon_netconf -qf $cfg" 0 "$CONFIG]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$CONFIG]]>]]>" "^]]>]]>$" new "commit it" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "enable nacm" diff --git a/test/test_nacm_datanode_read.sh b/test/test_nacm_datanode_read.sh index 9440f03f..8b954aaa 100755 --- a/test/test_nacm_datanode_read.sh +++ b/test/test_nacm_datanode_read.sh @@ -247,13 +247,13 @@ if [ $RC -ne 0 ]; then fi new "auth set authentication config" -expecteof "$clixon_netconf -qf $cfg" 0 "$RULES]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$RULES]]>]]>" "^]]>]]>$" new "set app config" -expecteof "$clixon_netconf -qf $cfg" 0 "$CONFIG]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$CONFIG]]>]]>" "^]]>]]>$" new "commit it" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "enable nacm" diff --git a/test/test_nacm_datanode_write.sh b/test/test_nacm_datanode_write.sh index 1f9798ba..44123c08 100755 --- a/test/test_nacm_datanode_write.sh +++ b/test/test_nacm_datanode_write.sh @@ -243,13 +243,13 @@ if [ $RC -ne 0 ]; then fi new "auth set authentication config" -expecteof "$clixon_netconf -qf $cfg" 0 "$RULES]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$RULES]]>]]>" "^]]>]]>$" new "set app config" -expecteof "$clixon_netconf -qf $cfg" 0 "$CONFIG]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$CONFIG]]>]]>" "^]]>]]>$" new "commit it" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "enable nacm" diff --git a/test/test_nacm_module_read.sh b/test/test_nacm_module_read.sh index deb64c50..27583712 100755 --- a/test/test_nacm_module_read.sh +++ b/test/test_nacm_module_read.sh @@ -144,10 +144,10 @@ if [ $RC -ne 0 ]; then fi new "auth set authentication config" -expecteof "$clixon_netconf -qf $cfg" 0 "$RULES]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$RULES]]>]]>" "^]]>]]>$" new "commit it" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "enable nacm" @@ -161,7 +161,7 @@ new "admin read ok" expectpart "$(curl -u andy:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/clixon-example:table)" 0 'HTTP/1.1 200 OK' '{"clixon-example:table":{"parameter":\[{"name":"key42","value":"val42"},{"name":"key43","value":"val43"}\]}}' new "admin read netconf ok" -expecteof "$clixon_netconf -U andy -qf $cfg" 0 "]]>]]>" "^key42val42key43val43
]]>]]>$" +expecteof "$clixon_netconf -U andy -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^key42val42key43val43
]]>]]>$" new "admin read element ok" expectpart "$(curl -u andy:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/clixon-example:table/parameter=key42/value)" 0 'HTTP/1.1 200 OK' '{"clixon-example:value":"val42"}' @@ -186,7 +186,7 @@ new "limit read ok" expectpart "$(curl -u wilma:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/clixon-example:table)" 0 'HTTP/1.1 200 OK' '{"clixon-example:table":{"parameter":\[{"name":"key42","value":"val42"},{"name":"key43","value":"val43"}\]}}' new "limit read netconf ok" -expecteof "$clixon_netconf -U wilma -qf $cfg" 0 "]]>]]>" "^key42val42key43val43
]]>]]>$" +expecteof "$clixon_netconf -U wilma -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^key42val42key43val43
]]>]]>$" new "limit read element ok" expectpart "$(curl -u wilma:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/clixon-example:table/parameter=key42/value)" 0 'HTTP/1.1 200 OK' '{"clixon-example:value":"val42"}' @@ -206,7 +206,7 @@ new "guest read forbidden" expectpart "$(curl -u guest:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/clixon-example:table)" 0 'HTTP/1.1 403 Forbidden' '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"access-denied","error-severity":"error","error-message":"default deny"}}}' new "guest read netconf fail" -expecteof "$clixon_netconf -U guest -qf $cfg" 0 "]]>]]>" "^applicationaccess-deniederrordefault deny]]>]]>$" +expecteof "$clixon_netconf -U guest -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationaccess-deniederrordefault deny]]>]]>$" new "guest read element forbidden" expectpart "$(curl -u guest:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/clixon-example:table/parameter=key42/value)" 0 'HTTP/1.1 403 Forbidden' '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"access-denied","error-severity":"error","error-message":"default deny"}}}' @@ -226,19 +226,19 @@ new "admin rpc ok" expectpart "$(curl -u andy:bar $CURLOPTS -X POST -H "Content-Type: application/yang-data+json" -d '{"clixon-example:input":{"x":"78"}}' $RCPROTO://localhost/restconf/operations/clixon-example:example)" 0 'HTTP/1.1 200 OK' '{"clixon-example:output":{"x":"78","y":"42"}}' new "admin rpc netconf ok" -expecteof "$clixon_netconf -U andy -qf $cfg" 0 "0]]>]]>" 0 "^042]]>]]>$" +expecteof "$clixon_netconf -U andy -qf $cfg" 0 "$DEFAULTHELLO0]]>]]>" "^042]]>]]>$" new "limit rpc ok" expectpart "$(curl -u wilma:bar $CURLOPTS -X POST $RCPROTO://localhost/restconf/operations/clixon-example:example -H "Content-Type: application/yang-data+json" -d '{"clixon-example:input":{"x":42}}' )" 0 'HTTP/1.1 200 OK' '{"clixon-example:output":{"x":"42","y":"42"}}' new "limit rpc netconf ok" -expecteof "$clixon_netconf -U wilma -qf $cfg" 0 '0]]>]]>' 0 '^042]]>]]>$' +expecteof "$clixon_netconf -U wilma -qf $cfg" 0 "$DEFAULTHELLO0]]>]]>" '^042]]>]]>$' new "guest rpc fail" expectpart "$(curl -u guest:bar $CURLOPTS -X POST $RCPROTO://localhost/restconf/operations/clixon-example:example -H "Content-Type: application/yang-data+json" -d '{"clixon-example:input":{"x":42}}' )" 0 'HTTP/1.1 403 Forbidden' '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"access-denied","error-severity":"error","error-message":"access denied"}}}' new "guest rpc netconf fail" -expecteof "$clixon_netconf -U guest -qf $cfg" 0 '0]]>]]>' 0 '^applicationaccess-deniederroraccess denied]]>]]>$' +expecteof "$clixon_netconf -U guest -qf $cfg" 0 "$DEFAULTHELLO0]]>]]>" '^applicationaccess-deniederroraccess denied]]>]]>$' #------------------ Set read-default permit diff --git a/test/test_nacm_module_write.sh b/test/test_nacm_module_write.sh index e52fac9d..3409fb33 100755 --- a/test/test_nacm_module_write.sh +++ b/test/test_nacm_module_write.sh @@ -165,10 +165,10 @@ fi # Set nacm from scratch function nacm(){ new "auth set authentication config" - expecteof "$clixon_netconf -qf $cfg" 0 "$RULES]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$RULES]]>]]>" "^]]>]]>$" new "commit it" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "enable nacm" expectpart "$(curl -u andy:bar $CURLOPTS -X PUT -H 'Content-Type: application/yang-data+json' -d '{"ietf-netconf-acm:enable-nacm":true}' $RCPROTO://localhost/restconf/data/ietf-netconf-acm:nacm/enable-nacm)" 0 "HTTP/1.1 204 No Content" diff --git a/test/test_nacm_protocol.sh b/test/test_nacm_protocol.sh index 9bcdc98b..e5176c30 100755 --- a/test/test_nacm_protocol.sh +++ b/test/test_nacm_protocol.sh @@ -165,10 +165,10 @@ if [ $RC -ne 0 ]; then fi new "auth set authentication config" -expecteof "$clixon_netconf -qf $cfg" 0 "$RULES]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$RULES]]>]]>" "^]]>]]>$" new "commit it" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "enable nacm" expectpart "$(curl -u andy:bar $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" -d '{"ietf-netconf-acm:enable-nacm": true}' $RCPROTO://localhost/restconf/data/ietf-netconf-acm:nacm/enable-nacm)" 0 "HTTP/1.1 204 No Content" @@ -180,17 +180,17 @@ expectpart "$(curl -u andy:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/da # Rule 1: deny-kill-session new "deny-kill-session: limited fail (netconf)" -expecteof "$clixon_netconf -qf $cfg -U wilma" 0 "44]]>]]>" "^applicationaccess-deniederroraccess denied]]>]]>$" +expecteof "$clixon_netconf -qf $cfg -U wilma" 0 "$DEFAULTHELLO44]]>]]>" "^applicationaccess-deniederroraccess denied]]>]]>$" new "deny-kill-session: guest fail (netconf)" -expecteof "$clixon_netconf -qf $cfg -U guest" 0 "44]]>]]>" "^applicationaccess-deniederroraccess denied]]>]]>$" +expecteof "$clixon_netconf -qf $cfg -U guest" 0 "$DEFAULTHELLO44]]>]]>" "^applicationaccess-deniederroraccess denied]]>]]>$" new "deny-kill-session: admin ok (netconf)" -expecteof "$clixon_netconf -qf $cfg -U andy" 0 "44]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg -U andy" 0 "$DEFAULTHELLO44]]>]]>" "^]]>]]>$" # Rule 2: deny-delete-config new "deny-delete-config: limited fail (netconf)" -expecteof "$clixon_netconf -qf $cfg -U wilma" 0 "]]>]]>" "^applicationaccess-deniederroraccess denied]]>]]>$" +expecteof "$clixon_netconf -qf $cfg -U wilma" 0 "$DEFAULTHELLO]]>]]>" "^applicationaccess-deniederroraccess denied]]>]]>$" new "deny-delete-config: guest fail (restconf)" expectpart "$(curl -u guest:bar $CURLOPTS -X DELETE $RCPROTO://localhost/restconf/data)" 0 "HTTP/1.1 403 Forbidden" '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"access-denied","error-severity":"error","error-message":"default deny"}}}' @@ -207,10 +207,10 @@ expectpart "$(curl -u andy:bar $CURLOPTS -X DELETE $RCPROTO://localhost/restconf # Here the whole config is gone so we need to start again new "auth set authentication config (restart)" -expecteof "$clixon_netconf -qf $cfg" 0 "$RULES]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$RULES]]>]]>" "^]]>]]>$" new "commit it" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "enable nacm" expectpart "$(curl -u andy:bar $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" -d '{"ietf-netconf-acm:enable-nacm": true}' $RCPROTO://localhost/restconf/data/ietf-netconf-acm:nacm/enable-nacm)" 0 "HTTP/1.1 204 No Content" diff --git a/test/test_nacm_recovery.sh b/test/test_nacm_recovery.sh index 5783f2c6..1e1c3472 100755 --- a/test/test_nacm_recovery.sh +++ b/test/test_nacm_recovery.sh @@ -115,23 +115,23 @@ EOF if $getp; then # default is read allowed so this should always succeed. new "get startup default ok" - expecteof "$prefix$clixon_netconf -qf $cfg -U $pseudo" 0 "]]>]]>" "^$DEFAULT]]>]]>$" + expecteof "$prefix$clixon_netconf -qf $cfg -U $pseudo" 0 "$DEFAULTHELLO]]>]]>" "^$DEFAULT]]>]]>$" # This would normally not work except in recovery situations else new "get startup not ok" - expecteof "$prefix$clixon_netconf -qf $cfg -U $pseudo" 0 "]]>]]>" "^applicationaccess-deniederrorUser $realuser credential not matching NACM user $pseudo]]>]]>$" + expecteof "$prefix$clixon_netconf -qf $cfg -U $pseudo" 0 "$DEFAULTHELLO]]>]]>" "^applicationaccess-deniederrorUser $realuser credential not matching NACM user $pseudo]]>]]>$" return; fi if $putp; then new "put, expect ok" - expecteof "$prefix$clixon_netconf -qf $cfg -U $pseudo" 0 "$RULES]]>]]>" "]]>]]>" + expecteof "$prefix$clixon_netconf -qf $cfg -U $pseudo" 0 "$DEFAULTHELLO$RULES]]>]]>" "]]>]]>" new "get rules ok" - expecteof "$prefix$clixon_netconf -qf $cfg -U $pseudo" 0 "]]>]]>" "^$RULES]]>]]>$" + expecteof "$prefix$clixon_netconf -qf $cfg -U $pseudo" 0 "$DEFAULTHELLO]]>]]>" "^$RULES]]>]]>$" else new "put, expect fail" - expecteof "$prefix$clixon_netconf -qf $cfg -U $pseudo" 0 "$RULES]]>]]>" "^applicationaccess-deniederrordefault deny]]>]]>$" + expecteof "$prefix$clixon_netconf -qf $cfg -U $pseudo" 0 "$DEFAULTHELLO$RULES]]>]]>" "^applicationaccess-deniederrordefault deny]]>]]>$" fi if [ $RC -ne 0 ]; then new "Kill restconf daemon" diff --git a/test/test_netconf.sh b/test/test_netconf.sh index 9d6a97a9..99d6a712 100755 --- a/test/test_netconf.sh +++ b/test/test_netconf.sh @@ -62,90 +62,77 @@ expecteof "$clixon_netconf -qf $cfg" 0 "This is not XML]]>]]>" 'urn:ietf:params:netconf:base:1.0
]]>]]>" 'rpcmalformed-messageerrorMore than one message in netconf rpc frame]]>]]>' +expecteof "$clixon_netconf -qf $cfg" 0 "urn:ietf:params:netconf:base:1.1]]>]]>" 'rpcmalformed-messageerrorMore than one message in netconf rpc frame]]>]]>' new "Frame with unknown message" expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocolunknown-elementxxxerrorUnrecognized netconf operation]]>]]>$" -# Hello -new "Netconf snd hello with xmldecl" -expecteof "$clixon_netconf -qf $cfg" 0 "urn:ietf:params:netconf:base:1.0]]>]]>" '^$' - -new "Netconf snd hello with wrong prefix" -expecteof "$clixon_netconf -qf $cfg" 0 "urn:ietf:params:netconf:base:1.0]]>]]>" 'protocolunknown-namespacexxerrorNo appropriate namespace associated with prefix]]>]]>' - -new "Netconf snd hello with prefix" -expecteof "$clixon_netconf -qf $cfg" 0 "urn:ietf:params:netconf:base:1.0]]>]]>" '^$' - -new "netconf snd + rcv hello" -expecteof "$clixon_netconf -f $cfg" 0 "urn:ietf:params:netconf:base:1.0]]>]]>" "^urn:ietf:params:netconf:base:1.0urn:ietf:params:netconf:capability:yang-library:1.0?revision=2019-01-04&module-set-id=42urn:ietf:params:netconf:capability:candidate:1.0urn:ietf:params:netconf:capability:validate:1.1urn:ietf:params:netconf:capability:startup:1.0urn:ietf:params:netconf:capability:xpath:1.0urn:ietf:params:netconf:capability:notification:1.0[0-9]*]]>]]>$" - new "netconf rcv hello, disable RFC7895/ietf-yang-library" -expecteof "$clixon_netconf -f $cfg -o CLICON_MODULE_LIBRARY_RFC7895=0" 0 "]]>]]>" "^urn:ietf:params:netconf:base:1.0urn:ietf:params:netconf:capability:candidate:1.0urn:ietf:params:netconf:capability:validate:1.1urn:ietf:params:netconf:capability:startup:1.0urn:ietf:params:netconf:capability:xpath:1.0urn:ietf:params:netconf:capability:notification:1.0[0-9]*]]>]]>]]>]]>$" +expecteof "$clixon_netconf -f $cfg -o CLICON_MODULE_LIBRARY_RFC7895=0" 0 "$DEFAULTHELLO]]>]]>" "^urn:ietf:params:netconf:base:1.1urn:ietf:params:netconf:base:1.0urn:ietf:params:netconf:capability:candidate:1.0urn:ietf:params:netconf:capability:validate:1.1urn:ietf:params:netconf:capability:startup:1.0urn:ietf:params:netconf:capability:xpath:1.0urn:ietf:params:netconf:capability:notification:1.0[0-9]*]]>]]>]]>]]>$" new "netconf get-config nc prefix" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get-config xx prefix" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get-config double quotes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get-config single quotes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Add subtree eth/0/0 using none which should not change anything" -expecteof "$clixon_netconf -qf $cfg" 0 "noneeth/0/0]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnoneeth/0/0]]>]]>" "^]]>]]>$" # Trying prefixes new "Add subtree eth/0/0 using nc prefix" -expecteof "$clixon_netconf -qf $cfg" 0 "noneeth/0/0]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnoneeth/0/0]]>]]>" "^]]>]]>$" new "Add subtree eth/0/0 using xx prefix" -expecteof "$clixon_netconf -qf $cfg" 0 "noneeth/0/0]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnoneeth/0/0]]>]]>" "^]]>]]>$" new "Check nothing added" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Add subtree eth/0/0 using none and create which should add eth/0/0" -expecteof "$clixon_netconf -qf $cfg" 0 "eth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" # Too many quotes, (single inside double inside single) need to fool bash cat < $tmp # new -]]>]]> +$DEFAULTHELLO]]>]]> EOF new "Check eth/0/0 added using xpath" expecteof "$clixon_netconf -qf $cfg" 0 "$(cat $tmp)" "^eth/0/0ex:ethtrue]]>]]>$" new "Re-create same eth/0/0 which should generate error" -expecteof "$clixon_netconf -qf $cfg" 0 "eth/0/0ex:ethnone ]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth/0/0ex:ethnone ]]>]]>" "^" new "Delete eth/0/0 using none config" -expecteof "$clixon_netconf -qf $cfg" 0 "eth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth/0/0ex:ethnone ]]>]]>" "^]]>]]>$" new "Check deleted eth/0/0 (non-presence container)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Re-Delete eth/0/0 using none should generate error" -expecteof "$clixon_netconf -qf $cfg" 0 "eth/0/0ex:ethnone ]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth/0/0ex:ethnone ]]>]]>" "^" new "Add interface without key" -expecteof "$clixon_netconf -qf $cfg" 0 "ex:ethnone ]]>]]>" "^applicationmissing-elementnameerrorMandatory key]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOex:ethnone ]]>]]>" "^applicationmissing-elementnameerrorMandatory key]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes using xx prefix" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf edit config" -expecteof "$clixon_netconf -qf $cfg" 0 "eth/0/0eth1true9.2.3.424]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth/0/0eth1true9.2.3.424]]>]]>" "^]]>]]>$" # Too many quotes cat < $tmp # new -]]>]]> +$DEFAULTHELLO]]>]]> EOF new "netconf get config xpath" @@ -153,156 +140,156 @@ expecteof "$clixon_netconf -qf $cfg" 0 "$(cat $tmp)" "^ $tmp # new -]]>]]> +$DEFAULTHELLO]]>]]> EOF new "netconf get config xpath parent" expecteof "$clixon_netconf -qf $cfg" 0 "$(cat $tmp)" "^eth/0/0trueeth1truetruefalse9.2.3.424]]>]]>$" new "netconf validate missing type" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^" new "netconf validate using xx prefix" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get empty config2" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf edit extra xml" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf edit config eth1" -expecteof "$clixon_netconf -qf $cfg" 0 "eth1ex:eth]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth1ex:eth]]>]]>" "^]]>]]>$" new "netconf validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf commit using prefix xx" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf edit config merge eth2" -expecteof "$clixon_netconf -qf $cfg" 0 "eth2ex:ethmerge]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth2ex:ethmerge]]>]]>" "^]]>]]>$" # Note, the type here is non-existant identityref, fails on validation new "netconf edit ampersand encoding(<&): name:'eth&' type:'t<>'" -expecteof "$clixon_netconf -qf $cfg" 0 "eth&t<>]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth&t<>]]>]]>" "^]]>]]>$" new "netconf get replaced config" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^eth&t<>trueeth1ex:ethtrueeth2ex:ethtrue]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^eth&t<>trueeth1ex:ethtrueeth2ex:ethtrue]]>]]>$" new "cli show configuration eth& - encoding tests" expectpart "$($clixon_cli -1 -f $cfg show conf cli)" 0 "interfaces interface eth& type t<> interfaces interface eth& enabled true" new "netconf edit CDATA" -expecteof "$clixon_netconf -qf $cfg" 0 "eth/0/0ex:eth]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOeth/0/0ex:eth]]>]]>" "^]]>]]>$" #new "netconf get CDATA" -#expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "eth/0/0true]]>]]>" +#expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "eth/0/0true]]>]]>" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf edit state operation should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "e0up]]>]]>" "^applicationinvalid-valueerroroper-status in module ietf-interfaces: state data node unexpected]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOe0up]]>]]>" "^applicationinvalid-valueerroroper-status in module ietf-interfaces: state data node unexpected]]>]]>" new "netconf get state operation" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^eth1ex:ethtrueup42foo]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^eth1ex:ethtrueup42foo]]>]]>$" new "netconf get state operation use prefix xx" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^eth1ex:ethtrueup42foo]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^eth1ex:ethtrueup42foo]]>]]>$" new "netconf lock" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf unlock" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocollock-denied0errorUnlock failed, lock is not currently active]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocollock-denied0errorUnlock failed, lock is not currently active]]>]]>$" new "netconf lock using prefix xx" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf unlock using prefix xx" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocollock-denied0errorUnlock failed, lock is not currently active]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocollock-denied0errorUnlock failed, lock is not currently active]]>]]>$" new "netconf lock/unlock" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>]]>]]>" "^]]>]]>]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>]]>]]>" "^]]>]]>]]>]]>$" new "netconf lock/unlock/lock" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>]]>]]>]]>]]>" "^]]>]]>]]>]]>]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>]]>]]>]]>]]>" "^]]>]]>]]>]]>]]>]]>$" new "netconf lock/lock" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>]]>]]>" "^]]>]]>protocollock-denied" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>]]>]]>" "^]]>]]>protocollock-denied" new "netconf unlock/unlock" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>]]>]]>" "^protocollock-denied0errorUnlock failed, lock is not currently active]]>]]>protocollock-denied0errorUnlock failed, lock is not currently active]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>]]>]]>" "^protocollock-denied0errorUnlock failed, lock is not currently active]]>]]>protocollock-denied0errorUnlock failed, lock is not currently active]]>]]>$" new "close-session" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "close-session using prefix xx" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # XXX NOTE that this does not actually kill a running session - and may even kill some random process,... new "kill-session" -expecteof "$clixon_netconf -qf $cfg" 0 "44]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO44]]>]]>" "^]]>]]>$" new "kill-session using prefix xx" -expecteof "$clixon_netconf -qf $cfg" 0 "44]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO44]]>]]>" "^]]>]]>$" # modify candidate, then lock, should fail. new "netconf edit config" -expecteof "$clixon_netconf -qf $cfg" 0 "a
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOa
]]>]]>" "^]]>]]>$" new "netconf lock: should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocollock-denied0errorOperation failed, candidate has already been modified and the changes have not been committed or rolled back (RFC 6241 7.5)]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocollock-denied0errorOperation failed, candidate has already been modified and the changes have not been committed or rolled back (RFC 6241 7.5)]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf lock" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "copy startup to candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "copy startup to candidate using prefix xx" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get startup" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^eth1ex:ethtrue]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^eth1ex:ethtrue]]>]]>$" new "netconf delete startup" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf delete startup using prefix xx" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf check empty startup" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf example rpc" -expecteof "$clixon_netconf -qf $cfg" 0 "42]]>]]>" "^4242]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42]]>]]>" "^4242]]>]]>$" new "netconf example rpc using prefix xx" -expecteof "$clixon_netconf -qf $cfg" 0 "42]]>]]>" "^4242]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42]]>]]>" "^4242]]>]]>$" new "netconf empty rpc" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf client-side rpc" -expecteof "$clixon_netconf -qf $cfg" 0 "val42]]>]]>" "^val42]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOval42]]>]]>" "^val42]]>]]>$" new "netconf extra leaf in leaf should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "e0e1]]>]]>" "^applicationunknown-elementnameerrorFailed to find YANG spec of XML node: name with parent: name in namespace: urn:ietf:params:xml:ns:yang:ietf-interfaces]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOe0e1]]>]]>" "^applicationunknown-elementnameerrorFailed to find YANG spec of XML node: name with parent: name in namespace: urn:ietf:params:xml:ns:yang:ietf-interfaces]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_netconf_filter.sh b/test/test_netconf_filter.sh index 4243ed21..f20b2b07 100755 --- a/test/test_netconf_filter.sh +++ b/test/test_netconf_filter.sh @@ -60,25 +60,25 @@ new "waiting" wait_backend new "Add two entries" -expecteof "$clixon_netconf -qf $cfg" 0 "1122]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO1122]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "wrong filter type" -expecteof "$clixon_netconf -qf $cfg" 0 "1]]>]]>" "^operation-failedapplicatioerrorfilter type not supportedtype]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO1]]>]]>" "^operation-failedapplicatioerrorfilter type not supportedtype]]>]]>$" new "get-config subtree one" -expecteof "$clixon_netconf -qf $cfg" 0 "1]]>]]>" "^11]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO1]]>]]>" "^11]]>]]>$" new "get subtree one" -expecteof "$clixon_netconf -qf $cfg" 0 "1]]>]]>" "^11]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO1]]>]]>" "^11]]>]]>$" new "get-config xpath one" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^11]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^11]]>]]>$" new "get xpath one" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^11]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^11]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_netconf_notifications.sh b/test/test_netconf_notifications.sh index beceefc3..6ed34773 100755 --- a/test/test_netconf_notifications.sh +++ b/test/test_netconf_notifications.sh @@ -111,30 +111,30 @@ wait_backend new "1. Netconf RFC5277 stream testing" # 1.1 Stream discovery new "netconf event stream discovery RFC5277 Sec 3.2.5" -expecteof "$clixon_netconf -D $DBG -qf $cfg" 0 "]]>]]>" "EXAMPLEExample event streamtrue]]>]]>" +expecteof "$clixon_netconf -D $DBG -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "EXAMPLEExample event streamtrue]]>]]>" new "netconf EXAMPLE subscription" -expectwait "$clixon_netconf -D $DBG -qf $cfg" "EXAMPLE]]>]]>" "^]]>]]>20" $NCWAIT +expectwait "$clixon_netconf -D $DBG -qf $cfg" "$DEFAULTHELLOEXAMPLE]]>]]>" "^]]>]]>20" $NCWAIT new "netconf subscription with empty startTime" -expecteof "$clixon_netconf -D $DBG -qf $cfg" 0 "EXAMPLE]]>]]>" "^applicationbad-elementstartTimeerrorregexp match fail:" +expecteof "$clixon_netconf -D $DBG -qf $cfg" 0 "$DEFAULTHELLOEXAMPLE]]>]]>" "^applicationbad-elementstartTimeerrorregexp match fail:" new "netconf EXAMPLE subscription with simple filter" -expectwait "$clixon_netconf -D $DBG -qf $cfg" "EXAMPLE]]>]]>" "^]]>]]>20" $NCWAIT +expectwait "$clixon_netconf -D $DBG -qf $cfg" "$DEFAULTHELLOEXAMPLE]]>]]>" "^]]>]]>20" $NCWAIT new "netconf EXAMPLE subscription with filter classifier" -expectwait "$clixon_netconf -D $DBG -qf $cfg" "EXAMPLE]]>]]>" "^]]>]]>20" $NCWAIT +expectwait "$clixon_netconf -D $DBG -qf $cfg" "$DEFAULTHELLOEXAMPLE]]>]]>" "^]]>]]>20" $NCWAIT new "netconf NONEXIST subscription" -expectwait "$clixon_netconf -D $DBG -qf $cfg" "NONEXIST]]>]]>" "^applicationinvalid-valueerrorNo such stream]]>]]>$" $NCWAIT +expectwait "$clixon_netconf -D $DBG -qf $cfg" "$DEFAULTHELLONONEXIST]]>]]>" "^applicationinvalid-valueerrorNo such stream]]>]]>$" $NCWAIT new "netconf EXAMPLE subscription with wrong date" -expectwait "$clixon_netconf -D $DBG -qf $cfg" "EXAMPLEkallekaka]]>]]>" "^applicationbad-elementstartTimeerrorregexp match fail:" 0 +expectwait "$clixon_netconf -D $DBG -qf $cfg" "$DEFAULTHELLOEXAMPLEkallekaka]]>]]>" "^applicationbad-elementstartTimeerrorregexp match fail:" 0 #new "netconf EXAMPLE subscription with replay" #NOW=$(date +"%Y-%m-%dT%H:%M:%S") #sleep 10 -#expectwait "$clixon_netconf -D $DBG -qf $cfg" "EXAMPLE$NOW]]>]]>" "^]]>]]>20" 10 +#expectwait "$clixon_netconf -D $DBG -qf $cfg" "$DEFAULTHELLOEXAMPLE$NOW]]>]]>" "^]]>]]>20" 10 if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_netconf_ssh_callhome.sh b/test/test_netconf_ssh_callhome.sh index f7b4d471..dd227191 100755 --- a/test/test_netconf_ssh_callhome.sh +++ b/test/test_netconf_ssh_callhome.sh @@ -51,6 +51,7 @@ cat < $cfg EOF cat < $rpccmd +$DEFAULTHELLO @@ -131,7 +132,7 @@ EOF new "Start Listener client" echo "ssh -s -F $sshcfg -v -i $key -o ProxyUseFdpass=yes -o ProxyCommand=\"clixon_netconf_ssh_callhome_client -a 127.0.0.1\" . netconf" #-F $sshcfg -expectpart "$(ssh -s -F $sshcfg -v -i $key -o ProxyUseFdpass=yes -o ProxyCommand="${clixon_netconf_ssh_callhome_client} -a 127.0.0.1" . netconf < $rpccmd)" 0 "urn:ietf:params:netconf:base:1.0urn:ietf:params:netconf:capability:yang-library:1.0?revision=2019-01-04&module-set-id=42urn:ietf:params:netconf:capability:candidate:1.0urn:ietf:params:netconf:capability:validate:1.1urn:ietf:params:netconf:capability:startup:1.0urn:ietf:params:netconf:capability:xpath:1.0urn:ietf:params:netconf:capability:notification:1.02]]>]]>" "]]>]]>" +expectpart "$(ssh -s -F $sshcfg -v -i $key -o ProxyUseFdpass=yes -o ProxyCommand="${clixon_netconf_ssh_callhome_client} -a 127.0.0.1" . netconf < $rpccmd)" 0 "urn:ietf:params:netconf:base:1.1urn:ietf:params:netconf:base:1.0urn:ietf:params:netconf:capability:yang-library:1.0?revision=2019-01-04&module-set-id=42urn:ietf:params:netconf:capability:candidate:1.0urn:ietf:params:netconf:capability:validate:1.1urn:ietf:params:netconf:capability:startup:1.0urn:ietf:params:netconf:capability:xpath:1.0urn:ietf:params:netconf:capability:notification:1.02]]>]]>" "]]>]]>" # Wait wait diff --git a/test/test_netconf_whitespace.sh b/test/test_netconf_whitespace.sh index fd6483ff..0670f44b 100755 --- a/test/test_netconf_whitespace.sh +++ b/test/test_netconf_whitespace.sh @@ -77,66 +77,66 @@ new "waiting" wait_backend new "get startup" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^foo]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^foo]]>]]>$" new "remove" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "add insignificant 'dirty' whitespaces" -expecteof "$clixon_netconf -qf $cfg" 0 " \t \ foo\n ]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO \t \ foo\n ]]>]]>" "^]]>]]>$" new "get stripped whitespace" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^foo]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^foo]]>]]>$" new "validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "add insignificant 'dirty' whitespaces with prefixes" -expecteof "$clixon_netconf -qf $cfg" 0 " \t \ foo\n ]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO \t \ foo\n ]]>]]>" "^]]>]]>$" new "get stripped whitespace" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^foo]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^foo]]>]]>$" new "validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "add insignificant 'clean' whitespaces" -expecteof "$clixon_netconf -qf $cfg" 0 " \n \t ]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO \n \t ]]>]]>" "^]]>]]>$" new "add more insignificant 'clean' whitespaces" -expecteof "$clixon_netconf -qf $cfg" 0 "foo ]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOfoo ]]>]]>" "^]]>]]>$" new "get stripped whitespace" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^foo]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^foo]]>]]>" new "validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "add significant whitespaces" -expecteof "$clixon_netconf -qf $cfg" 0 " foo +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO foo bar ]]>]]>" "^]]>]]>$" new "get significant whitespace" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^ foo +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^ foo bar ]]>]]>" new "validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_order.sh b/test/test_order.sh index d48bfac4..44b90e18 100755 --- a/test/test_order.sh +++ b/test/test_order.sh @@ -171,77 +171,77 @@ fi # Eeh I changed that to sortered unless STATE_ORDERED_BY_SYSTEM new "state data (should be ordered: 41,42,43)" cat < $tmp -]]>]]> +$DEFAULTHELLO]]>]]> EOF expecteof "$clixon_netconf -qf $cfg" 0 "$(cat $tmp)" "414243]]>]]>" # Check as file new "verify running from start, should be: c,l,y0,y1,y2,y3; y1 and y3 sorted." -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^hejhoppdbcaabcddbarabarcbarbbarabarbbarcbardbar]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^hejhoppdbcaabcddbarabarcbarbbarabarbbarcbardbar]]>]]>$" new "get each ordered-by user leaf-list" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^abar]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^abar]]>]]>$" new "get each ordered-by user leaf-list" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^abar]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^abar]]>]]>$" new "get each ordered-by user leaf-list" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^bbar]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^bbar]]>]]>$" new "get each ordered-by user leaf-list" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^bbar]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^bbar]]>]]>$" new "delete candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "none]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnone]]>]]>" "^]]>]]>$" # LEAF_LISTS new "add two entries (c,b) to leaf-list user order" -expecteof "$clixon_netconf -qf $cfg" 0 "cb]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOcb]]>]]>" "^]]>]]>$" new "add one entry (a) to leaf-list user order" -expecteof "$clixon_netconf -qf $cfg" 0 "a]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOa]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "add one entry (0) to leaf-list user order after commit" -expecteof "$clixon_netconf -qf $cfg" 0 "0]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO0]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "verify leaf-list user order in running (as entered: c,b,a,0)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^cba0]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^cba0]]>]]>$" # LISTS new "add two entries to list user order" -expecteof "$clixon_netconf -qf $cfg" 0 "cbarbfoo]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOcbarbfoo]]>]]>" "^]]>]]>$" new "add one entry to list user order" -expecteof "$clixon_netconf -qf $cfg" 0 "afie]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOafie]]>]]>" "^]]>]]>$" new "verify list user order (as entered)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^cbarbfooafie]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^cbarbfooafie]]>]]>$" new "Overwrite existing ordered-by user y2->c" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO cnewc ]]>]]>" new "Overwrite existing ordered-by user y2->b" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO bnewb ]]>]]>" new "Overwrite existing ordered-by user y2->a" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO anewa ]]>]]>" new "Tests for no duplicates." -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^cnewcbnewbanewa]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^cnewcbnewbanewa]]>]]>$" #-- order by type rather than strings. # there are three leaf-lists:strings, ints, and decimal64, and two lists: @@ -250,146 +250,146 @@ expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO 1021 ]]>]]>" "^]]>]]>$" new "check string order (1,10,2)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^1102]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^1102]]>]]>$" new "put leaf-list int (10,2,1)" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO 1021 ]]>]]>" "^]]>]]>$" new "check leaf-list int order (1,2,10)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^1210]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^1210]]>]]>$" new "put list int (10,2,1)" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO 1021 ]]>]]>" "^]]>]]>$" new "check list int order (1,2,10)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^1210]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^1210]]>]]>$" new "put leaf-list decimal64 (10,2,1)" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO 10.02.01.0 ]]>]]>" "^]]>]]>$" new "check leaf-list decimal64 order (1,2,10)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^1.02.010.0]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^1.02.010.0]]>]]>$" new "put list decimal64 (10,2,1)" -expecteof "$clixon_netconf -qf $cfg" 0 " +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO 10.02.01.0 ]]>]]>" "^]]>]]>$" new "check list decimal64 order (1,2,10)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^1.02.010.0]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^1.02.010.0]]>]]>$" new "delete candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "none]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnone]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # leaf-list ordered-by-user, "insert" and "value" attributes # y0 is leaf-list ordered by user new "add one entry (c) to leaf-list" -expecteof "$clixon_netconf -qf $cfg" 0 "c]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOc]]>]]>" "^]]>]]>$" new "add one entry (a) to leaf-list first (with no yang namespace - error)" -expecteof "$clixon_netconf -qf $cfg" 0 "a]]>]]>" "^applicationbad-attributeinserterrorUnresolved attribute prefix (no namespace?)]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOa]]>]]>" "^applicationbad-attributeinserterrorUnresolved attribute prefix (no namespace?)]]>]]>$" new "add one entry (b) to leaf-list first" -expecteof "$clixon_netconf -qf $cfg" 0 "b]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOb]]>]]>" "^]]>]]>$" new "add one entry (d) to leaf-list last" -expecteof "$clixon_netconf -qf $cfg" 0 "d]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOd]]>]]>" "^]]>]]>$" new "add one entry (a) to leaf-list first" -expecteof "$clixon_netconf -qf $cfg" 0 "a]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOa]]>]]>" "^]]>]]>$" new "add one entry (e) to leaf-list last" -expecteof "$clixon_netconf -qf $cfg" 0 "e]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOe]]>]]>" "^]]>]]>$" new "check ordered-by-user: a,b,c,d,e" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^abcde]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^abcde]]>]]>$" new "move one entry (e) to leaf-list first" -expecteof "$clixon_netconf -qf $cfg" 0 "e]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOe]]>]]>" "^]]>]]>$" new "check ordered-by-user: e,a,b,c,d" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^eabcd]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^eabcd]]>]]>$" # before and after and value attribute new "add one leaf-list entry 71 before b" -XML="71]]>]]>" +XML="$DEFAULTHELLO71]]>]]>" expecteof "$clixon_netconf -qf $cfg" 0 "$XML" "^]]>]]>$" new "add one entry 42 after b" -XML="42]]>]]>" +XML="$DEFAULTHELLO42]]>]]>" expecteof "$clixon_netconf -qf $cfg" 0 "$XML" "^]]>]]>$" # XXX actually not right error message, should be as RFC7950 Sec 15.7 new "add one entry 99 after Q (not found, error)" -XML="99]]>]]>" +XML="$DEFAULTHELLO99]]>]]>" RES="^protocoloperation-failederrorbad-attribute: value, missing-instance: Q]]>]]>$" expecteof "$clixon_netconf -qf $cfg" 0 "$XML" "$RES" new "check ordered-by-user: e,a,71,b,42,c,d" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^ea71b42cd]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^ea71b42cd]]>]]>$" new "delete candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "none]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnone]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # list ordered-by-user, "insert" and "value" attributes # y2 is list ordered by user new "add one entry (key c) to list" -expecteof "$clixon_netconf -qf $cfg" 0 "cfoo]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOcfoo]]>]]>" "^]]>]]>$" new "add one entry (key a) to list first (with no yang namespace - error)" -expecteof "$clixon_netconf -qf $cfg" 0 "afoo]]>]]>" "^applicationbad-attributeinserterrorUnresolved attribute prefix (no namespace?)]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOafoo]]>]]>" "^applicationbad-attributeinserterrorUnresolved attribute prefix (no namespace?)]]>]]>$" new "add one entry (key b) to list first" -expecteof "$clixon_netconf -qf $cfg" 0 "bbar]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLObbar]]>]]>" "^]]>]]>$" new "add one entry (d) to list last" -expecteof "$clixon_netconf -qf $cfg" 0 "dfie]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOdfie]]>]]>" "^]]>]]>$" new "add one entry (a) to list first" -expecteof "$clixon_netconf -qf $cfg" 0 "afoo]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOafoo]]>]]>" "^]]>]]>$" new "add one entry (e) to list last" -expecteof "$clixon_netconf -qf $cfg" 0 "ebar]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOebar]]>]]>" "^]]>]]>$" new "check ordered-by-user: a,b,c,d,e" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^afoobbarcfoodfieebar]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^afoobbarcfoodfieebar]]>]]>$" new "move one entry (e) to list first" -expecteof "$clixon_netconf -qf $cfg" 0 "ebar]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOebar]]>]]>" "^]]>]]>$" new "check ordered-by-user: e,a,b,c,d" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^ebarafoobbarcfoodfie]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^ebarafoobbarcfoodfie]]>]]>$" # before and after and key attribute new "add one entry 71 before key b" -expecteof "$clixon_netconf -qf $cfg" 0 "71fie]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO71fie]]>]]>" "^]]>]]>$" new "add one entry 42 after key b" -expecteof "$clixon_netconf -qf $cfg" 0 "42fum]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42fum]]>]]>" "^]]>]]>$" # XXX actually not right error message, should be as RFC7950 Sec 15.7 new "add one entry key 99 after Q (not found, error)" -expecteof "$clixon_netconf -qf $cfg" 0 "99bar]]>]]>" "^protocoloperation-failederrorbad-attribute: key, missing-instance: Q]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO99bar]]>]]>" "^protocoloperation-failederrorbad-attribute: key, missing-instance: Q]]>]]>$" new "check ordered-by-user: e,a,71,b,42,c,d" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^ebarafoo71fiebbar42fumcfoodfie]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^ebarafoo71fiebbar42fumcfoodfie]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_pattern.sh b/test/test_pattern.sh index 6cd3f84d..d9aeb7d5 100755 --- a/test/test_pattern.sh +++ b/test/test_pattern.sh @@ -392,16 +392,16 @@ function testrun(){ trunc=$(echo "$str"|cut -c1-15) new "pattern edit $leaf string: $trunc" - expecteof "$clixon_netconf -qf $cfg" 0 "<$leaf>$str]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<$leaf>$str]]>]]>" "^]]>]]>$" if $mat; then new "netconf validate expected match" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" else new "netconf validate expected fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-element$leaferror" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-element$leaferror" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" fi } diff --git a/test/test_perf_netconf.sh b/test/test_perf_netconf.sh index fc3fe284..5c101d91 100755 --- a/test/test_perf_netconf.sh +++ b/test/test_perf_netconf.sh @@ -88,7 +88,7 @@ new "waiting" wait_backend new "generate config with $perfnr list entries" -echo -n "" > $fconfig +echo -n "$DEFAULTHELLO" > $fconfig for (( i=0; i<$perfnr; i++ )); do echo -n "$i$i" >> $fconfig done @@ -105,7 +105,7 @@ expecteof_file "time -p $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' # Now commit it again from candidate (validation takes time when # comparing to existing) @@ -119,13 +119,13 @@ expecteof "time -p $clixon_netconf -qf $cfg" 0 "] new "netconf get $perfreq small config 1 key index" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) - echo "]]>]]>" + echo "$DEFAULTHELLO]]>]]>" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' new "netconf get $perfreq small config 1 key index start/stop" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) - echo "]]>]]>" | $clixon_netconf -qf $cfg > /dev/null; + echo "$DEFAULTHELLO]]>]]>" | $clixon_netconf -qf $cfg > /dev/null; done } 2>&1 | awk '/real/ {print $2}' @@ -133,38 +133,38 @@ done new "netconf get $perfreq small config 1 key + 1 non-key index" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) - echo "]]>]]>" + echo "$DEFAULTHELLO]]>]]>" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' # NETCONF add new "netconf add $perfreq small config" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) - echo "$rnd$rnd]]>]]>" + echo "$DEFAULTHELLO$rnd$rnd]]>]]>" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' # Instead of many small entries, get one large in netconf and restconf # cli? new "netconf get large config" -expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^00112233" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^00112233" 2>&1 | awk '/real/ {print $2}' # Delete entries (last since entries are removed from db) new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf delete $perfreq small config" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) - echo "$rnd]]>]]>" + echo "$DEFAULTHELLO$rnd]]>]]>" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' #new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Now do leaf-lists istead of leafs #new "generate leaf-list config" -echo -n "replace" > $fconfig2 +echo -n "$DEFAULTHELLOreplace" > $fconfig2 for (( i=0; i<$perfnr; i++ )); do echo -n "$i" >> $fconfig2 done @@ -174,22 +174,22 @@ new "netconf replace large list-leaf config" expecteof_file "time -p $clixon_netconf -qf $cfg" 0 "$fconfig2" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf commit large leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf add $perfreq small leaf-list config" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) - echo "$rnd]]>]]>" + echo "$DEFAULTHELLO$rnd]]>]]>" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' new "netconf add small leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg" 0 "x]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOx]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf commit small leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf get large leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^01" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^01" 2>&1 | awk '/real/ {print $2}' if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_perf_restconf.sh b/test/test_perf_restconf.sh index 427f2098..7a33325d 100755 --- a/test/test_perf_restconf.sh +++ b/test/test_perf_restconf.sh @@ -75,6 +75,7 @@ cat < $cfg EOF + new "test params: -f $cfg" if [ $BE -ne 0 ]; then new "kill old backend" @@ -119,7 +120,7 @@ expecteof_file "time -p $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' # RESTCONF get new "restconf get $perfreq small config 1 key index" @@ -151,7 +152,7 @@ new "cli delete $perfreq small config" done } 2>&1 | awk '/real/ {print $2}' #new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # XXX This takes time # 18.69 without startup feature @@ -165,7 +166,7 @@ done > /dev/null; } 2>&1 | awk '/real/ {print $2}' # Now do leaf-lists istead of leafs #new "generate leaf-list config" -echo -n "replace" > $fconfig2 +echo -n "$DEFAULTHELLOreplace" > $fconfig2 for (( i=0; i<$perfnr; i++ )); do echo -n "$i" >> $fconfig2 done @@ -175,28 +176,27 @@ new "netconf replace large list-leaf config" expecteof_file "time -p $clixon_netconf -qf $cfg" 0 "$fconfig2" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf commit large leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf add $perfreq small leaf-list config" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) - echo "$rnd]]>]]>" + echo "$DEFAULTHELLO$rnd]]>]]>" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' new "netconf add small leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg" 0 "x]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOx]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf commit small leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' new "netconf get large leaf-list config" -expecteof "time -p $clixon_netconf -qf $cfg" 0 "]]>]]>" "^01" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^01" 2>&1 | awk '/real/ {print $2}' if [ $RC -ne 0 ]; then new "Kill restconf daemon" stop_restconf fi - if [ $BE -ne 0 ]; then new "Kill backend" # Check if premature kill @@ -207,7 +207,6 @@ if [ $BE -ne 0 ]; then # kill backend stop_backend -f $cfg fi - rm -rf $dir # Set by restconf_config diff --git a/test/test_perf_state.sh b/test/test_perf_state.sh index ff7a0f06..306fd467 100755 --- a/test/test_perf_state.sh +++ b/test/test_perf_state.sh @@ -123,7 +123,7 @@ if [ $RC -ne 0 ]; then fi new "generate 'large' config with $perfnr list entries" -echo -n "foo" > $fconfig +echo -n "$DEFAULTHELLOfoo" > $fconfig for (( i=0; i<$perfnr; i++ )); do echo -n "e$iex:eth" >> $fconfig done @@ -135,21 +135,21 @@ expecteof_file "time -p $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' +expecteof "time -p $clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" 2>&1 | awk '/real/ {print $2}' # START actual tests # Having a large db, get single entries many times # NETCONF get new "netconf get test single req" sel="/ex:interfaces/ex:a[ex:name='foo']/ex:b/ex:interface[ex:name='e1']" -msg="]]>]]>" +msg="$DEFAULTHELLO]]>]]>" expecteof "$clixon_netconf -qf $cfg" 0 "$msg" "^fooe1ex:ethtrueup]]>]]>$" new "netconf get $perfreq single reqs" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) sel="/ex:interfaces/ex:a[ex:name='foo']/ex:b/ex:interface[ex:name='e$rnd']" - echo "]]>]]>" + echo "$DEFAULTHELLO]]>]]>" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' # RESTCONF get @@ -180,7 +180,7 @@ done } 2>&1 | awk '/real/ {print $2}' # Get config in one large get new "netconf get large config" -{ time -p echo " ]]>]]>" | $clixon_netconf -qf $cfg > /tmp/netconf; } 2>&1 | awk '/real/ {print $2}' +{ time -p echo "$DEFAULTHELLO ]]>]]>" | $clixon_netconf -qf $cfg > /tmp/netconf; } 2>&1 | awk '/real/ {print $2}' new "restconf get large config" $TIMEFN curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:interfaces/a=foo/b 2>&1 | awk '/real/ {print $2}' diff --git a/test/test_perf_state_only.sh b/test/test_perf_state_only.sh index 57042089..8f038583 100755 --- a/test/test_perf_state_only.sh +++ b/test/test_perf_state_only.sh @@ -133,14 +133,14 @@ $TIMEFN $clixon_cli -1f $cfg show xpath /interfaces urn:example:clixon 2>&1 > /d # NETCONF get new "netconf get test single req" sel="/ex:interfaces/ex:a[ex:name='foo']/ex:b/ex:interface[ex:name='e1']" -msg="]]>]]>" +msg="$DEFAULTHELLO]]>]]>" time -p expecteof "$clixon_netconf -qf $cfg" 0 "$msg" "^fooe1ex:ethup]]>]]>$" new "netconf get $perfreq single reqs" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) sel="/ex:interfaces/ex:a[ex:name='foo']/ex:b/ex:interface[ex:name='e$rnd']" - echo "]]>]]>" + echo "$DEFAULTHELLO]]>]]>" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' # RESTCONF get @@ -174,7 +174,7 @@ fi # Get config in one large get new "netconf get large config" -{ time -p echo " ]]>]]>" | $clixon_netconf -qf $cfg > /tmp/netconf; } 2>&1 | awk '/real/ {print $2}' +{ time -p echo "$DEFAULTHELLO ]]>]]>" | $clixon_netconf -qf $cfg > /tmp/netconf; } 2>&1 | awk '/real/ {print $2}' new "restconf get large config" $TIMEFN curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:interfaces/a=foo/b 2>&1 | awk '/real/ {print $2}' diff --git a/test/test_restconf.sh b/test/test_restconf.sh index 97b5a1b5..99382cdd 100755 --- a/test/test_restconf.sh +++ b/test/test_restconf.sh @@ -139,10 +139,10 @@ function testrun() wait_backend new "netconf edit config" - expecteof "$clixon_netconf -qf $cfg" 0 "$RESTCONFIG1]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$RESTCONFIG1]]>]]>" "^]]>]]>$" new "netconf commit" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if [ $RC -ne 0 ]; then new "kill old restconf daemon" diff --git a/test/test_restconf_netns.sh b/test/test_restconf_netns.sh index 8d8e58dd..04712b52 100755 --- a/test/test_restconf_netns.sh +++ b/test/test_restconf_netns.sh @@ -157,10 +157,10 @@ if [ $RC -ne 0 ]; then fi new "add sample config w netconf" -expecteof "$clixon_netconf -qf $cfg" 0 "a42
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOa42
]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "restconf http get config on default netns" expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/yang-data+xml' http://127.0.0.1/restconf/data/clixon-example:table)" 0 "HTTP/1.1 200 OK" 'a42
' diff --git a/test/test_restconf_rpc.sh b/test/test_restconf_rpc.sh index 2b0ca368..eaf0d1d0 100755 --- a/test/test_restconf_rpc.sh +++ b/test/test_restconf_rpc.sh @@ -64,6 +64,7 @@ function testrpc() new "send rpc $operation" ret=$($clixon_netconf -qf $cfg< restconf @@ -321,10 +322,10 @@ pid=$(testrpc status 0) if [ $? -ne 0 ]; then echo "$pid";exit -1; fi new "Enable restconf" -expecteof "$clixon_netconf -qf $cfg" 0 "mergetrue]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOmergetrue]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "13. check status RPC on" pid=$(testrpc status 1) @@ -355,10 +356,10 @@ if [ $pid1 -ne $pid2 ]; then fi new "Disable restconf" -expecteof "$clixon_netconf -qf $cfg" 0 "mergefalse]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOmergefalse]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "14. check status RPC off" pid=$(testrpc status 0) @@ -367,10 +368,10 @@ if [ $? -ne 0 ]; then echo "$pid";exit -1; fi # Negative validation checks of clixon-restconf / socket new "netconf edit config invalid ssl" -expecteof "$clixon_netconf -qf $cfg" 0 "truedefault
0.0.0.0
80true
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOtruedefault
0.0.0.0
80true
]]>]]>" "^]]>]]>$" new "netconf validate should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-failederrorSSL enabled but server-cert-path not set]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorSSL enabled but server-cert-path not set]]>]]>$" # stop backend if [ $BE -ne 0 ]; then diff --git a/test/test_rpc.sh b/test/test_rpc.sh index 7cfa7927..456f77b2 100755 --- a/test/test_rpc.sh +++ b/test/test_rpc.sh @@ -72,7 +72,7 @@ if [ -z "$match" ]; then fi new "netconf empty rpc" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "restconf example rpc json/json default - no http media headers" expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+json" -d '{"clixon-example:input":{"x":0}}' $RCPROTO://localhost/restconf/operations/clixon-example:example)" 0 'HTTP/1.1 200 OK' 'Content-Type: application/yang-data+json' '{"clixon-example:output":{"x":"0","y":"42"}}' @@ -100,7 +100,7 @@ new "restconf example rpc json in xml encoding (expect fail)" expectpart "$(curl $CURLOPTS -X POST -H 'Content-Type: application/yang-data+xml' -H 'Accept: application/yang-data+xml' -d '{"clixon-example:input":{"x":"0"}}' $RCPROTO://localhost/restconf/operations/clixon-example:example)" 0 'HTTP/1.1 400 Bad Reques' 'rpcmalformed-messageerrorxml_parse: line 0: syntax error: at or before: "' new "netconf example rpc" -expecteof "$clixon_netconf -qf $cfg" 0 "0]]>]]>" "^042]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO0]]>]]>" "^042]]>]]>$" # 2. Then error cases # @@ -139,24 +139,24 @@ new "restconf example missing input" expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+json" -d '{"clixon-example:input":null}' $RCPROTO://localhost/restconf/operations/ietf-netconf:edit-config)" 0 'HTTP/1.1 400 Bad Request' '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"missing-element","error-info":{"bad-element":"target"},"error-severity":"error","error-message":"Mandatory variable of edit-config in module ietf-netconf"}}} ' new "netconf kill-session missing session-id mandatory" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationmissing-elementsession-iderrorMandatory variable of kill-session in module ietf-netconf]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationmissing-elementsession-iderrorMandatory variable of kill-session in module ietf-netconf]]>]]>$" new "netconf edit-config ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if ! $YANG_UNKNOWN_ANYDATA ; then new "netconf edit-config extra arg: should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationunknown-elementextraerrorFailed to find YANG spec of XML node: extra with parent: edit-config in namespace: urn:ietf:params:xml:ns:netconf:base:1.0]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationunknown-elementextraerrorFailed to find YANG spec of XML node: extra with parent: edit-config in namespace: urn:ietf:params:xml:ns:netconf:base:1.0]]>]]>$" fi new "netconf edit-config empty target: should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationdata-missingmissing-choiceconfig-targeterror]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationdata-missingmissing-choiceconfig-targeterror]]>]]>$" new "netconf edit-config missing target: should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationmissing-elementtargeterrorMandatory variable of edit-config in module ietf-netconf]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationmissing-elementtargeterrorMandatory variable of edit-config in module ietf-netconf]]>]]>$" new "netconf edit-config missing config: should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationdata-missingmissing-choiceedit-contenterror]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationdata-missingmissing-choiceedit-contenterror]]>]]>$" # Negative errors (namespace/module missing) new "netconf wrong rpc namespace: should fail" @@ -167,21 +167,38 @@ expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+jso # test rpc lists with / without keys LIST='foobarbar' + # On docker /fcgi the return is bar,foo,bar new "netconf example rpc input list without key with non-unique entries" -expecteof "$clixon_netconf -qf $cfg" 0 "mandatory$LIST]]>]]>" "^mandatory42" '' 'foobar' "]]>]]>$" +ret=$($clixon_netconf -qf $cfg <mandatory$LIST
]]>]]> +EOF + ) +r=$? +if [ $r -ne 0 ]; then + err "0" "$r" +fi + +for expect in "^mandatory42" '' 'foobar' "]]>]]>$"; do + new "expect:$expect" + match=`echo $ret | grep --null -Eo "$expect"` + if [ -z "$match" ]; then + err "$expect" "$ret" + fi +done LIST='bar1foo2' new "netconf example rpc input list with key" -expecteof "$clixon_netconf -qf $cfg" 0 "mandatory$LIST]]>]]>" "^mandatory42$LIST]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOmandatory$LIST]]>]]>" "^mandatory42$LIST]]>]]>$" LIST='bar12' new "netconf example rpc input key list without key (should fail)" -expecteof "$clixon_netconf -qf $cfg" 0 "mandatory$LIST]]>]]>" "^applicationmissing-elementukerrorMandatory key]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOmandatory$LIST]]>]]>" "^applicationmissing-elementukerrorMandatory key]]>]]>$" LIST='bar1bar2' new "netconf example rpc input list with non-unique keys (should fail)" -expecteof "$clixon_netconf -qf $cfg" 0 "mandatory$LIST]]>]]>" "^applicationoperation-faileddata-not-uniqueerrorbar]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOmandatory$LIST]]>]]>" "^applicationoperation-faileddata-not-uniqueerrorbar]]>]]>$" if [ $RC -ne 0 ]; then new "Kill restconf daemon" diff --git a/test/test_startup.sh b/test/test_startup.sh index 5a59f979..607f21fa 100755 --- a/test/test_startup.sh +++ b/test/test_startup.sh @@ -90,13 +90,13 @@ function testrun(){ sleep $BETIMEOUT fi new "Startup test for $mode mode, check running" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$exprun]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$exprun]]>]]>$" new "Startup test for $mode mode, check candidate" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$exprun]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$exprun]]>]]>$" new "Startup test for $mode mode, check startup is untouched" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$sdb]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$sdb]]>]]>$" new "Kill backend" # Check if premature kill diff --git a/test/test_submodule.sh b/test/test_submodule.sh index b046ed8a..8b9878cb 100755 --- a/test/test_submodule.sh +++ b/test/test_submodule.sh @@ -194,7 +194,7 @@ if [ $RC -ne 0 ]; then fi new "netconfig edit main module" -expecteof "$clixon_netconf -qf $cfg" 0 "
foofoo
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO
foofoo
]]>]]>" "^]]>]]>$" new "cli edit main" expectpart "$($clixon_cli -1f $cfg set main x bar)" 0 "" @@ -203,7 +203,7 @@ new "cli edit main ext" expectpart "$($clixon_cli -1f $cfg set main ext bar)" 0 "" new "netconfig edit sub1" -expecteof "$clixon_netconf -qf $cfg" 0 "foofoo]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOfoofoo]]>]]>" "^]]>]]>$" new "cli edit sub1" expectpart "$($clixon_cli -1f $cfg set sub1 x bar)" 0 "" @@ -212,7 +212,7 @@ new "cli edit sub1 ext" expectpart "$($clixon_cli -1f $cfg set sub1 ext1 bar)" 0 "" new "netconfig edit sub2 module" -expecteof "$clixon_netconf -qf $cfg" 0 "foofoo]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOfoofoo]]>]]>" "^]]>]]>$" new "cli edit sub2" expectpart "$($clixon_cli -1f $cfg set sub2 x fum)" 0 "" @@ -221,10 +221,10 @@ new "cli edit sub2 ext" expectpart "$($clixon_cli -1f $cfg set sub2 ext2 fum)" 0 "" new "netconf submodule validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Now same with restconf new "restconf edit main" diff --git a/test/test_transaction.sh b/test/test_transaction.sh index 6abf085a..9e920a2a 100755 --- a/test/test_transaction.sh +++ b/test/test_transaction.sh @@ -127,10 +127,10 @@ fi let nr=0 new "Basic transaction to add top-level x" -expecteof "$clixon_netconf -qf $cfg" 0 "$nr]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$nr]]>]]>" "^]]>]]>$" new "Commit base" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" let line=14 # Skipping basic transaction @@ -138,10 +138,10 @@ let line=14 # Skipping basic transaction let nr++ let line new "1. Validate-only transaction" -expecteof "$clixon_netconf -qf $cfg" 0 "$nr]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$nr]]>]]>" "^]]>]]>$" new "Validate-only validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" xml="$nr" for op in begin validate complete end; do @@ -152,15 +152,15 @@ for op in begin validate complete end; do done new "Validate-only discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # 2. Commit transaction let nr++ new "2. Commit transaction config" -expecteof "$clixon_netconf -qf $cfg" 0 "$nr]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$nr]]>]]>" "^]]>]]>$" new "Commit transaction: commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" xml="$nr" for op in begin validate complete commit commit_done end; do @@ -173,13 +173,13 @@ done # 3. Validate only system-error (invalid type detected by system) let nr++ new "3. Validate system-error config (9999 not in range)" -expecteof "$clixon_netconf -qf $cfg" 0 "$nr9999]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$nr9999]]>]]>" "^]]>]]>$" new "Validate system-error validate (should fail)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementberrorNumber 9999 out of range: 0 - 100]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementberrorNumber 9999 out of range: 0 - 100]]>]]>$" new "Validate system-error discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" for op in begin abort; do checklog "$nr main_$op add: $nr9999" $line @@ -191,13 +191,13 @@ done # 4. Validate only user-error (invalidation by user callback) let nr++ new "4. Validate user-error config ($errnr is invalid)" -expecteof "$clixon_netconf -qf $cfg" 0 "$errnr]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$errnr]]>]]>" "^]]>]]>$" new "Validate user-error validate (should fail)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-failederrorUser error]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorUser error]]>]]>$" new "Validate user-error discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" for op in begin validate; do checklog "$nr main_$op add: $errnr" $line @@ -218,13 +218,13 @@ done # in nacm/transaction example test module let nr++ new "5. Commit user-error ($errnr is invalid)" -expecteof "$clixon_netconf -qf $cfg" 0 "$errnr]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$errnr]]>]]>" "^]]>]]>$" new "Commit user-error commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-failederrorUser error]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorUser error]]>]]>$" new "Commit user-error discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" for op in begin validate complete commit ; do checklog "$nr main_$op add: $errnr" $line @@ -247,19 +247,19 @@ done let nr++ let base=nr new "Add base $base entry" -expecteof "$clixon_netconf -qf $cfg" 0 "$base00
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$base00]]>]]>" "^]]>]]>$" new "netconf commit base" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #Ignore let line+=12 let nr++ new "6. netconf mixed change: change b, del c, add d" -expecteof "$clixon_netconf -qf $cfg" 0 "$base420]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$base420]]>]]>" "^]]>]]>$" new "netconf commit change" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Check complete transaction $nr: for op in begin validate complete commit commit_done; do @@ -283,19 +283,19 @@ let line+=3 # skip nacm let nr++ let base=nr new "Add base $base entry" -expecteof "$clixon_netconf -qf $cfg" 0 "$base1
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$base1]]>]]>" "^]]>]]>$" new "netconf commit base" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" let line+=12 # Variant check that only b,c let nr++ new "7. netconf insert b,c between end-points" -expecteof "$clixon_netconf -qf $cfg" 0 "$base11]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$base11]]>]]>" "^]]>]]>$" new "netconf commit base" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # check complete for op in begin validate complete commit commit_done end; do diff --git a/test/test_transaction_restart.sh b/test/test_transaction_restart.sh index b12eef03..60157a46 100755 --- a/test/test_transaction_restart.sh +++ b/test/test_transaction_restart.sh @@ -105,17 +105,17 @@ fi let nr=0 new "Basic transaction to add top-level x" -expecteof "$clixon_netconf -qf $cfg" 0 "$nr
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$nr
]]>]]>" "^]]>]]>$" new "Commit base" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" let line=13 # Skipping basic transaction. Sanity check, find one last transaction xml="0
" checklog "$nr nacm_end add: $xml" $line new "Send restart nacm plugin" -expecteof "$clixon_netconf -qf $cfg" 0 "example_backend_nacm]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOexample_backend_nacm]]>]]>" "^]]>]]>" # Now analyze log: # all transactions come from nacm plugin only. @@ -129,7 +129,7 @@ done # Negative test: restart a plugin that does not exist new "Send restart to nonexistatn plugin expect fail" -expecteof "$clixon_netconf -qf $cfg" 0 "xxx]]>]]>" "^applicationbad-elementpluginerrorNo such plugin]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOxxx]]>]]>" "^applicationbad-elementpluginerrorNo such plugin]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_type.sh b/test/test_type.sh index 257f14b9..e64b240b 100755 --- a/test/test_type.sh +++ b/test/test_type.sh @@ -252,16 +252,16 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o set c talle 9xx)" 255 '^CLI syntax error: "set c talle 9xx": "9xx" is invalid input for cli command: talle$' new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf set transitive string error" - expecteof "$clixon_netconf -qf $cfg" 0 "9xx]]>]]>" "^]]>]]>" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO9xx]]>]]>" "^]]>]]>" new "netconf validate should fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "applicationbad-elementtalleerrorregexp match fail:" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "applicationbad-elementtalleerrorregexp match fail:" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "cli set transitive union int (ulle should accept 4.44|bounded|unbounded)" expectpart "$($clixon_cli -1f $cfg -l o set c ulle 33)" 0 '^$' @@ -282,13 +282,13 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o set c ulle 55)" 255 '^CLI syntax error: "set c ulle 55": Number 55 out of range: 4 - 44$' new "netconf set transitive union error int" - expecteof "$clixon_netconf -qf $cfg" 0 "55]]>]]>" "^]]>]]>" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO55]]>]]>" "^]]>]]>" new "netconf validate should fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementulleerror'55' does not match enumeration]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementulleerror'55' does not match enumeration]]>]]>$" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #----------- @@ -314,19 +314,19 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o -l o commit)" 0 '^$' new "netconf validate ok" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf set ab wrong" - expecteof "$clixon_netconf -qf $cfg" 0 "a.b& c.d]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOa.b& c.d]]>]]>" "^]]>]]>$" new "netconf validate" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf commit" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "cli enum value" expectpart "$($clixon_cli -1f $cfg -l o set status down)" 0 '^$' @@ -339,7 +339,7 @@ EOF #expectpart "$($clixon_cli -1f $cfg -l o set mbits \)"create read\"" 0 '^$' new "netconf bits two values" - expecteof "$clixon_netconf -qf $cfg" 0 "create read]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOcreate read]]>]]>" "^]]>]]>$" new "cli bits validate" expectpart "$($clixon_cli -1f $cfg -l o validate)" 0 '^$' @@ -347,13 +347,13 @@ EOF #-------- num0 empty value new "netconf num0 no value" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf validate no value wrong" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "applicationbad-elementnum0errorInvalid NULL value]]>]]>" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "applicationbad-elementnum0errorInvalid NULL value]]>]]>" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #-------- num1 single range (1) @@ -367,13 +367,13 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o set num1 2)" 255 '^CLI syntax error: "set num1 2": Number 2 out of range: 1 - 1$' new "netconf range set num1 -1" - expecteof "$clixon_netconf -qf $cfg" 0 "-1]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO-1]]>]]>" "^]]>]]>$" new "netconf validate num1 -1 wrong" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementnum1errorNumber -1 out of range: 1 - 1]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementnum1errorNumber -1 out of range: 1 - 1]]>]]>$" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #-------- num2 range and blanks @@ -387,25 +387,25 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o set num2 5000)" 255 '^CLI syntax error: "set num2 5000": Number 5000 out of range: 4 - 4000$' new "netconf range set num2 3 fail" - expecteof "$clixon_netconf -qf $cfg" 0 "3]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO3]]>]]>" "^]]>]]>$" new "netconf validate num2 3 fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementnum2errorNumber 3 out of range: 4 - 4000]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementnum2errorNumber 3 out of range: 4 - 4000]]>]]>$" new "netconf range set num2 1000 ok" - expecteof "$clixon_netconf -qf $cfg" 0 "1000]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO1000]]>]]>" "^]]>]]>$" new "netconf validate num2 1000 ok" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf range set num2 5000 fail" - expecteof "$clixon_netconf -qf $cfg" 0 "5000]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO5000]]>]]>" "^]]>]]>$" new "netconf validate num2 5000 fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementnum2errorNumber 5000 out of range: 4 - 4000]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementnum2errorNumber 5000 out of range: 4 - 4000]]>]]>$" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #-------- num3 min max range @@ -419,13 +419,13 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o set num3 -1)" 255 "CLI syntax error:" new "netconf range set num3 260 fail" - expecteof "$clixon_netconf -qf $cfg" 0 "260]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO260]]>]]>" "^]]>]]>$" new "netconf validate num3 260 fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementnum3errorNumber 260 out of range: 0 - 255]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementnum3errorNumber 260 out of range: 0 - 255]]>]]>$" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #-------- num4 multiple ranges 1..2 | 42..50 @@ -445,25 +445,25 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o set num4 99)" 255 '^CLI syntax error: "set num4 99": Number 99 out of range: 1 - 2, 42 - 50$' new "netconf range set num4 multiple 2" - expecteof "$clixon_netconf -qf $cfg" 0 "42]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42]]>]]>" "^]]>]]>$" new "netconf validate num4 OK" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf range set num4 multiple 20" - expecteof "$clixon_netconf -qf $cfg" 0 "42]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42]]>]]>" "^]]>]]>$" new "netconf validate num4 fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf range set num4 multiple 42" - expecteof "$clixon_netconf -qf $cfg" 0 "42]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42]]>]]>" "^]]>]]>$" new "netconf validate num4 fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #-------- dec64 multiple ranges -3.5..-2.5 | 0.0 | 10.0..20.0 # XXX how to enter negative numbers in bash string and cli -1? @@ -480,44 +480,44 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o set dec 30.0)" 255 '^CLI syntax error: "set dec 30.0": Number 30.000 out of range: -3.500 - -2.500, 0.000 - 0.000, 10.000 - 20.000$' new "dec64 discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Same with netconf new "netconf range dec64 -3.59" - expecteof "$clixon_netconf -qf $cfg" 0 "-3.59]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO-3.59]]>]]>" "^]]>]]>$" new "netconf range dec64 -3.59 validate fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementdecerrorNumber -3.590 out of range" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementdecerrorNumber -3.590 out of range" new "netconf range dec64 -3.5" - expecteof "$clixon_netconf -qf $cfg" 0 "-3.500]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO-3.500]]>]]>" "^]]>]]>$" new "netconf range dec64 -3.5 validate ok" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf range dec64 -2" - expecteof "$clixon_netconf -qf $cfg" 0 "-2]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO-2]]>]]>" "^]]>]]>$" new "netconf range dec64 -2 validate fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementdecerrorNumber -2.000 out of range" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementdecerrorNumber -2.000 out of range" new "netconf range dec64 -0.001" - expecteof "$clixon_netconf -qf $cfg" 0 "-0.001]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO-0.001]]>]]>" "^]]>]]>$" new "netconf range dec64 -0.001 validate fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementdecerrorNumber -0.001 out of range" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementdecerrorNumber -0.001 out of range" new "netconf range dec64 0.0" - expecteof "$clixon_netconf -qf $cfg" 0 "0.0]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO0.0]]>]]>" "^]]>]]>$" new "netconf range dec64 0.0 validate ok" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf range dec64 +0.001" - expecteof "$clixon_netconf -qf $cfg" 0 "+0.001]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO+0.001]]>]]>" "^]]>]]>$" new "netconf range dec64 +0.001 validate fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementdecerrorNumber 0.001 out of range" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementdecerrorNumber 0.001 out of range" #----------------string ranges--------------------- #-------- len1 single range (2) @@ -531,13 +531,13 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o set len1 hej)" 255 '^CLI syntax error: "set len1 hej": String length 3 out of range: 2 - 2$' new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf length set len1 1" - expecteof "$clixon_netconf -qf $cfg" 0 "x]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOx]]>]]>" "^]]>]]>$" new "netconf validate len1 1 wrong" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementlen1errorString length 1 out of range: 2 - 2]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementlen1errorString length 1 out of range: 2 - 2]]>]]>$" #-------- len2 range and blanks @@ -548,7 +548,7 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o set len2 hejhophdsakjhkjsadhkjsahdkjsad)" 0 '^$' new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #-------- len3 min max range @@ -585,53 +585,53 @@ EOF expectpart "$($clixon_cli -1f $cfg -l o set word4 ab%3)" 255 '^CLI syntax error: "set word4 ab%3": "ab%3" is invalid input for cli command: word4$' new "netconf pattern \w" - expecteof "$clixon_netconf -qf $cfg" 0 "aXG9]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOaXG9]]>]]>" "^]]>]]>$" new "netconf pattern \w valid" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf pattern \w error" - expecteof "$clixon_netconf -qf $cfg" 0 "ab%d3]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOab%d3]]>]]>" "^]]>]]>$" new "netconf pattern \w invalid" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementword4errorregexp match fail:" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementword4errorregexp match fail:" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #------ Mandatory new "netconf set container w/o mandatory leaf" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>" new "netconf validate should fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "applicationmissing-elementmanerrorMandatory variable of manc in module example]]>]]>" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "applicationmissing-elementmanerrorMandatory variable of manc in module example]]>]]>" new "netconf set container with mandatory leaf" - expecteof "$clixon_netconf -qf $cfg" 0 "foo]]>]]>" "^]]>]]>" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOfoo]]>]]>" "^]]>]]>" new "netconf commit" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf delete mandatory variable" - expecteof "$clixon_netconf -qf $cfg" 0 "foonone]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOfoonone]]>]]>" "^]]>]]>$" new "get mandatory" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf validate should fail" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^protocolmissing-elementmanerrorMandatory variable of manc in module example]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^protocolmissing-elementmanerrorMandatory variable of manc in module example]]>]]>$" new "netconf discard-changes" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #------ minus new "type with minus" - expecteof "$clixon_netconf -qf $cfg" 0 "my-name]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOmy-name]]>]]>" "^]]>]]>$" new "validate minus" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #new "cli type with minus" #expectpart "$($clixon_cli -1f $cfg -l o set name my-name)" 0 "^$" diff --git a/test/test_type_range.sh b/test/test_type_range.sh index a74111f2..f06944e2 100755 --- a/test/test_type_range.sh +++ b/test/test_type_range.sh @@ -202,15 +202,13 @@ function testbuiltin(){ errmsg="Number $val$post out of range: $rmin$post - $rmax$post" new "Netconf set invalid $t leaf" - echo "$clixon_netconf -qf $cfg" - echo "$val]]>]]>" - expecteof "$clixon_netconf -qf $cfg" 0 "$val]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$val]]>]]>" "^]]>]]>$" new "netconf validate invalid range" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementr$terror$errmsg]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementr$terror$errmsg]]>]]>$" new "discard" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" } # Type explicit typed range tests. @@ -255,19 +253,19 @@ function testrange(){ expectpart "$($clixon_cli -1f $cfg -l o set l$t $eval)" 255 "$errmsg" new "discard" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Netconf set invalid $t leaf" - expecteof "$clixon_netconf -qf $cfg" 0 "$eval]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$eval]]>]]>" "^]]>]]>$" new "netconf get config" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$eval]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$eval]]>]]>$" new "netconf validate invalid range" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationbad-elementl$terror$errmsg]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationbad-elementl$terror$errmsg]]>]]>$" new "discard" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" } if [ $BE -ne 0 ]; then diff --git a/test/test_unique.sh b/test/test_unique.sh index 9d664edd..af4a99e4 100755 --- a/test/test_unique.sh +++ b/test/test_unique.sh @@ -96,7 +96,7 @@ fi # RFC test two-field caes new "Add not valid example" -expecteof "$clixon_netconf -qf $cfg" 0 "replace +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace smtp 192.0.2.1 25 @@ -109,13 +109,13 @@ expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "netconf validate (should fail)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-faileddata-not-uniqueerror192.0.2.125]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-faileddata-not-uniqueerror192.0.2.125]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Add valid example" -expecteof "$clixon_netconf -qf $cfg" 0 "replace +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace smtp 192.0.2.1 25 @@ -131,28 +131,28 @@ expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "netconf validate ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "make it invalid by adding port to ftp entry" -expecteof "$clixon_netconf -qf $cfg" 0 "noneftp25 +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnoneftp25 ]]>]]>" "^]]>]]>$" new "netconf validate (should fail)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-faileddata-not-uniqueerror192.0.2.125]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-faileddata-not-uniqueerror192.0.2.125]]>]]>$" new "make it valid by deleting port from smtp entry" -expecteof "$clixon_netconf -qf $cfg" 0 "nonesmtp25 +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnonesmtp25 ]]>]]>" "^]]>]]>$" new "netconf validate ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Then test single-field case new "Add not valid example" -expecteof "$clixon_netconf -qf $cfg" 0 "replace +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace smtp 192.0.2.1 @@ -163,23 +163,23 @@ expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "netconf validate (should fail)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-faileddata-not-uniqueerror192.0.2.1]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-faileddata-not-uniqueerror192.0.2.1]]>]]>$" new "make valid by replacing IP of http entry" -expecteof "$clixon_netconf -qf $cfg" 0 "nonehttp178.23.34.1 +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnonehttp178.23.34.1 ]]>]]>" "^]]>]]>$" new "netconf validate ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # Then test composite case (detect duplicates among other elements) # and also unordered new "Add not valid example" -expecteof "$clixon_netconf -qf $cfg" 0 "replace +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOreplace other smtp @@ -204,10 +204,10 @@ expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "netconf validate (should fail)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-faileddata-not-uniqueerror192.0.2.125]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-faileddata-not-uniqueerror192.0.2.125]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_upgrade_auto.sh b/test/test_upgrade_auto.sh index efdcc317..cef59fb9 100755 --- a/test/test_upgrade_auto.sh +++ b/test/test_upgrade_auto.sh @@ -259,7 +259,7 @@ new "waiting" wait_backend new "Check running db content" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$XML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$XML]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_upgrade_failsafe.sh b/test/test_upgrade_failsafe.sh index 0f58631d..86498657 100755 --- a/test/test_upgrade_failsafe.sh +++ b/test/test_upgrade_failsafe.sh @@ -274,12 +274,12 @@ runtest(){ fi new "Check running db content" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$exprun]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$exprun]]>]]>$" # If given check startup db XML if [ -n "$expstart" ]; then new "Check startup db content" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$expstart]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$expstart]]>]]>$" fi if [ $BE -ne 0 ]; then diff --git a/test/test_upgrade_interfaces.sh b/test/test_upgrade_interfaces.sh index 49022ee4..cb12aae9 100755 --- a/test/test_upgrade_interfaces.sh +++ b/test/test_upgrade_interfaces.sh @@ -271,7 +271,7 @@ function testrun(){ wait_backend new "Check running db content" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$runxml]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$runxml]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_upgrade_repair.sh b/test/test_upgrade_repair.sh index 2a509b4d..7d8ab875 100755 --- a/test/test_upgrade_repair.sh +++ b/test/test_upgrade_repair.sh @@ -117,26 +117,26 @@ new "waiting" wait_backend new "Check running db content is failsafe" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$SAMEXML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$SAMEXML]]>]]>$" new "copy startup->candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Check candidate db content is startup" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$OLDXML$SAMEXML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$OLDXML$SAMEXML]]>]]>$" # Note you cannot edit invalid XML since a0 lacks namespace new "Put new version into candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "$NEWXML$SAMEXML]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$NEWXML$SAMEXML]]>]]>" "^]]>]]>$" new "Check candidate db content is updated" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$SAMEXML$NEWXML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$SAMEXML$NEWXML]]>]]>$" new "commit to running" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Check running db content is updated" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$SAMEXML$NEWXML]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$SAMEXML$NEWXML]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_upgrade_simple.sh b/test/test_upgrade_simple.sh index d3f9feee..3b549933 100755 --- a/test/test_upgrade_simple.sh +++ b/test/test_upgrade_simple.sh @@ -64,10 +64,10 @@ if [ $BE -ne 0 ]; then fi new "add hello world (with modstate)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # race condition where backend is killed before flushed to disk sleep $DEMSLEEP @@ -115,7 +115,7 @@ if [ $BE -ne 0 ]; then fi new "netconf get config" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Kill backend" # Check if premature kill diff --git a/test/test_when_must.sh b/test/test_when_must.sh index 3b512ae5..75a6a7e0 100755 --- a/test/test_when_must.sh +++ b/test/test_when_must.sh @@ -105,40 +105,40 @@ if [ $BE -ne 0 ]; then fi new "when: add static route" -expecteof "$clixon_netconf -qf $cfg" 0 "staticr1]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstaticr1]]>]]>" "^]]>]]>$" new "when: validate ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "when: add direct route" -expecteof "$clixon_netconf -qf $cfg" 0 "directr2]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOdirectr2]]>]]>" "^]]>]]>$" new "when get config" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^directr2staticr1]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^directr2staticr1]]>]]>$" new "when: validate fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-failederrorFailed WHEN condition of static-routes in module example]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorFailed WHEN condition of static-routes in module example]]>]]>$" new "when: discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "must: add interface" -expecteof "$clixon_netconf -qf $cfg" 0 "ethernet1500]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOethernet1500]]>]]>" "^]]>]]>$" new "must: validate ok" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "must: add atm interface" -expecteof "$clixon_netconf -qf $cfg" 0 "atm32]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOatm32]]>]]>" "^]]>]]>$" new "must: atm validate fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-failederrorAn ATM MTU must be 64 .. 17966]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorAn ATM MTU must be 64 .. 17966]]>]]>$" new "must: add eth interface" -expecteof "$clixon_netconf -qf $cfg" 0 "ethernet989]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOethernet989]]>]]>" "^]]>]]>$" new "must: eth validate fail" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^applicationoperation-failederrorAn Ethernet MTU must be 1500]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorAn Ethernet MTU must be 1500]]>]]>" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_with_default.sh b/test/test_with_default.sh index 3f900dc8..5c76d98a 100755 --- a/test/test_with_default.sh +++ b/test/test_with_default.sh @@ -96,10 +96,10 @@ TRIM='defaultnotset$XML]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO$XML]]>]]>" "^]]>]]>$" new "Check config (Clixon supports explicit)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$EXPLICIT]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$EXPLICIT]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_xml.sh b/test/test_xml.sh index 60dcff48..2d6f57d6 100755 --- a/test/test_xml.sh +++ b/test/test_xml.sh @@ -116,19 +116,22 @@ new "XMLdecl version, single quotes" expecteof "$clixon_util_xml -o" 0 "" '' new "XMLdecl version no element" -expecteof "$clixon_util_xml -o" 255 '' '' +expecteof "$clixon_util_xml -o" 255 '' '' 2> /dev/null new "XMLdecl no version" -expecteof "$clixon_util_xml -o" 255 '' '' +expecteof "$clixon_util_xml -o" 255 '' '' 2> /dev/null new "XMLdecl misspelled version" -expecteof "$clixon_util_xml -ol o" 255 '' '' +expecteof "$clixon_util_xml -ol o" 255 '' '' 2> /dev/null new "XMLdecl version + encoding" -expecteof "$clixon_util_xml -o" 0 '' '' +expecteof "$clixon_util_xml -o" 0 '' '' + +new "XMLdecl version + wrong encoding" +expecteof "$clixon_util_xml -o" 255 '' '' 2> /dev/null new "XMLdecl version + misspelled encoding" -expecteof "$clixon_util_xml -ol o" 255 '' 'syntax error: at or before: e' +expecteof "$clixon_util_xml -ol o" 255 '' 'syntax error: at or before: e' 2> /dev/null new "XMLdecl version + standalone" expecteof "$clixon_util_xml -o" 0 '' '' diff --git a/test/test_xpath_functions.sh b/test/test_xpath_functions.sh index a12085e2..49116d6b 100755 --- a/test/test_xpath_functions.sh +++ b/test/test_xpath_functions.sh @@ -115,63 +115,63 @@ fi # contains new "contains: Set site to foo that validates site OK" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "foo1242]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLOfoo1242]]>]]>" "^]]>]]>" new "netconf validate OK" -expecteof "$clixon_netconf -qf $cfg" 0 "^]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Set site to fie which invalidates the when contains" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "fie]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLOfie]]>]]>" "^]]>]]>" new "netconf validate not OK" -expecteof "$clixon_netconf -qf $cfg" 0 "^]]>]]>" "^applicationoperation-failederrorFailed WHEN condition of site in module example]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorFailed WHEN condition of site in module example]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # derived-from new "derived-from: Set mtu to interface OK on GE" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "e0fast-ethernet1500]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLOe0fast-ethernet1500]]>]]>" "^]]>]]>" new "netconf validate OK" -expecteof "$clixon_netconf -qf $cfg" 0 "^]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Change type to atm" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "e0atm]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLOe0atm]]>]]>" "^]]>]]>" new "netconf validate not OK (mtu not allowed)" -expecteof "$clixon_netconf -qf $cfg" 0 "^]]>]]>" "^applicationoperation-failederrorFailed augmented WHEN condition derived-from(type, \"ex:ethernet\") of node mtu in module example]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorFailed augmented WHEN condition derived-from(type, \"ex:ethernet\") of node mtu in module example]]>]]>$" new "Change type to ethernet (self)" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "e0ethernet]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLOe0ethernet]]>]]>" "^]]>]]>" new "netconf validate not OK (mtu not allowed on self)" -expecteof "$clixon_netconf -qf $cfg" 0 "^]]>]]>" "^applicationoperation-failederrorFailed augmented WHEN condition derived-from(type, \"ex:ethernet\") of node mtu in module example]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorFailed augmented WHEN condition derived-from(type, \"ex:ethernet\") of node mtu in module example]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # derived-from-or-self new "derived-from-or-self: Set crc to interface OK on GE" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "e0fast-ethernet42]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLOe0fast-ethernet42]]>]]>" "^]]>]]>" new "netconf validate OK" -expecteof "$clixon_netconf -qf $cfg" 0 "^]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "Change type to atm" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "e0atm]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLOe0atm]]>]]>" "^]]>]]>" new "netconf validate not OK (crc not allowed)" -expecteof "$clixon_netconf -qf $cfg" 0 "^]]>]]>" "^applicationoperation-failederrorFailed augmented WHEN condition derived-from-or-self(type, \"ex:ethernet\") of node crc in module example]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^applicationoperation-failederrorFailed augmented WHEN condition derived-from-or-self(type, \"ex:ethernet\") of node crc in module example]]>]]>$" new "Change type to ethernet (self)" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "e0ethernet]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLOe0ethernet]]>]]>" "^]]>]]>" new "netconf validate OK (self)" -expecteof "$clixon_netconf -qf $cfg" 0 "^]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_yang.sh b/test/test_yang.sh index bad5bef2..8964ca82 100755 --- a/test/test_yang.sh +++ b/test/test_yang.sh @@ -160,16 +160,16 @@ new "cli defined extension" expectpart "$($clixon_cli -1f $cfg show version)" 0 "${CLIXON_VERSION}" new "empty values in leaf-list" -expecteof "$clixon_netconf -qf $cfg" 0 "a]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOa]]>]]>" "^]]>]]>$" new "empty values in leaf-list2" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get config" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^a]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^a]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" #new "cli not defined extension" #new "netconf not defined extension" @@ -178,32 +178,32 @@ expecteof "$clixon_netconf -qf $cfg" 0 " #expectpart "$($clixon_cli -1f $cfg -y $fyangerr show version)" 0 "Yang error: Extension ex:not-defined not found" new "netconf schema resource, RFC 7895" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "ietf-yang-types2013-07-15urn:ietf:params:xml:ns:yang:ietf-yang-typesimplement" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "ietf-yang-types2013-07-15urn:ietf:params:xml:ns:yang:ietf-yang-typesimplement" new "netconf edit config" -expecteof "$clixon_netconf -qf $cfg" 0 "125one
]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO125one]]>]]>" "^]]>]]>$" new "netconf commit" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" # text empty type in running new "netconf commit 2nd" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get config xpath" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^125one]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^125one]]>]]>$" new "netconf edit leaf-list" -expecteof "$clixon_netconf -qf $cfg" 0 "hejhopp]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOhejhopp]]>]]>" "^]]>]]>$" new "netconf get leaf-list" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^hejhopp]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^hejhopp]]>]]>$" new "netconf get leaf-list path" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^hejhopp]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^hejhopp]]>]]>$" new "netconf get (should be some)" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^125one" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^125one" new "cli set leaf-list" expectpart "$($clixon_cli -1f $cfg set x f e foo)" 0 "" @@ -212,72 +212,72 @@ new "cli show leaf-list" expectpart "$($clixon_cli -1f $cfg show xpath /x/f/e urn:example:clixon)" 0 "foo" new "netconf set state data (not allowed)" -expecteof "$clixon_netconf -qf $cfg" 0 "42]]>]]>" "^applicationinvalid-valueerrorstate in module example: state data node unexpected]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42]]>]]>" "^applicationinvalid-valueerrorstate in module example: state data node unexpected]]>]]>$" new "netconf set presence and not present" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get presence only" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf get presence only" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf anyxml" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf validate anyxml" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf delete candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "none]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnone]]>]]>" "^]]>]]>$" # Check 3-keys new "netconf add one 3-key entry" -expecteof "$clixon_netconf -qf $cfg" 0 "111one]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO111one]]>]]>" "^]]>]]>$" new "netconf check add one 3-key" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "111one]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "111one]]>]]>" new "netconf add another (with same 1st key)" -expecteof "$clixon_netconf -qf $cfg" 0 "121two]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO121two]]>]]>" "^]]>]]>$" new "netconf check add another" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "111one121two]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "111one121two]]>]]>" new "netconf replace first" -expecteof "$clixon_netconf -qf $cfg" 0 "111replace]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO111replace]]>]]>" "^]]>]]>$" new "netconf check replace" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "111replace121two]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "111replace121two]]>]]>" new "netconf delete first" -expecteof "$clixon_netconf -qf $cfg" 0 "111]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO111]]>]]>" "^]]>]]>$" new "netconf check delete" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "121two]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "121two]]>]]>" # clear db for next test new "netconf delete candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "none]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOnone]]>]]>" "^]]>]]>$" new "netconf commit empty candidate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconfig config submodule" -expecteof "$clixon_netconf -qf $cfg" 0 "afoo]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOafoo]]>]]>" "^]]>]]>$" new "netconf submodule get config" -expecteof "$clixon_netconf -qf $cfg -D 1 -l s" 0 "]]>]]>" "^afoo]]>]]>$" +expecteof "$clixon_netconf -qf $cfg -D 1 -l s" 0 "$DEFAULTHELLO]]>]]>" "^afoo]]>]]>$" new "netconf submodule validate" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "netconf submodule discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" if [ "$BE" -eq 0 ]; then exit # BE diff --git a/test/test_yang_anydata.sh b/test/test_yang_anydata.sh index b7d34b2d..245e21c9 100755 --- a/test/test_yang_anydata.sh +++ b/test/test_yang_anydata.sh @@ -192,20 +192,20 @@ EOF if ! $startup; then # If not startup, add xml using netconf new "Put anydata" - expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$XMLA]]>]]>" "]]>]]>" + expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLO$XMLA]]>]]>" "]]>]]>" new "Put unknown" - expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$XMLU]]>]]>" "$unknownreply" + expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLO$XMLU]]>]]>" "$unknownreply" new "commit" - expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "]]>]]>" "]]>]]>" + expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLO]]>]]>" "]]>]]>" fi new "Get candidate" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$XML]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$XML]]>]]>$" new "Get running" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$XML]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$XML]]>]]>$" # Add other functions, (based on previous errors), eg cli show config, cli commit. new "cli show configuration" @@ -221,7 +221,7 @@ EOF echo "$STATE1" > $fstate new "Get state (positive test)" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^$STATE1]]>]]>" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^$STATE1]]>]]>" new "restconf get state(positive)" expectpart "$(curl $CURLOPTS -X GET -H "Accept: application/yang-data+xml" $RCPROTO://localhost/restconf/data?content=nonconfig)" 0 "HTTP/1.1 200 OK" "$STATE1" @@ -230,7 +230,7 @@ EOF echo "$STATE0" > $fstate new "Get state (negative test)" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "error-message>Failed to find YANG spec of XML node: u5 with parent: sb in namespace: urn:example:unknown. Internal error, state callback returned invalid XML from plugin: example_backend
" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "error-message>Failed to find YANG spec of XML node: u5 with parent: sb in namespace: urn:example:unknown. Internal error, state callback returned invalid XML from plugin: example_backend
" new "restconf get state(negative)" expectpart "$(curl $CURLOPTS -X GET -H "Accept: application/yang-data+xml" $RCPROTO://localhost/restconf/data?content=nonconfig)" 0 "HTTP/1.1 412 Precondition Failed" "operation-failedu5" @@ -239,13 +239,13 @@ EOF # server. But "unknown-element" as truly unknwon. # (Would need to add a handler to get a proper OK) new "Not supported RPC" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "operation-not-supported" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "operation-not-supported" new "anydata RPC" - expecteof "$clixon_netconf -qf $cfg" 0 "88]]>]]>" "operation-not-supported" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO88]]>]]>" "operation-not-supported" new "unknown RPC" - expecteof "$clixon_netconf -qf $cfg" 0 "88]]>]]>" "unknown-element" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO88]]>]]>" "unknown-element" if [ $RC -ne 0 ]; then new "Kill restconf daemon" diff --git a/test/test_yang_default.sh b/test/test_yang_default.sh index c4fea254..f9aa7643 100755 --- a/test/test_yang_default.sh +++ b/test/test_yang_default.sh @@ -108,7 +108,7 @@ function testrun(){ fi new "check running defaults" - expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^0foo42]]>]]>$" + expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^0foo42]]>]]>$" if [ $BE -ne 0 ]; then # Bring your own backend new "Kill backend" diff --git a/test/test_yang_extension.sh b/test/test_yang_extension.sh index 88f475aa..d396cd73 100755 --- a/test/test_yang_extension.sh +++ b/test/test_yang_extension.sh @@ -119,13 +119,13 @@ fi # The main example implements ex:e4 new "Add extension foo (not implemented)" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "a string]]>]]>" "^applicationunknown-elementfooerror" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLOa string]]>]]>" "^applicationunknown-elementfooerror" new "Add extension bar (is implemented)" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "a string]]>]]>" "^]]>]]>" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLOa string]]>]]>" "^]]>]]>" new "netconf get config" -expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "]]>]]>" "^a string]]>]]>" +expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLO]]>]]>" "^a string]]>]]>" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_yang_load.sh b/test/test_yang_load.sh index da0c2c29..a39cf7be 100755 --- a/test/test_yang_load.sh +++ b/test/test_yang_load.sh @@ -88,13 +88,13 @@ if [ $BE -ne 0 ]; then fi new "1. Set newex" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" new "Set oldex should fail (since oldex is in old revision and only the new is loaded)" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementoldexerrorFailed to find YANG spec of XML node: oldex with parent: config in namespace: urn:example:clixon]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementoldexerrorFailed to find YANG spec of XML node: oldex with parent: config in namespace: urn:example:clixon]]>]]>$" new "Set other should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementothererrorFailed to find YANG spec of XML node: other with parent: config in namespace: urn:example:clixon2]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementothererrorFailed to find YANG spec of XML node: other with parent: config in namespace: urn:example:clixon2]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" @@ -136,13 +136,13 @@ if [ $BE -ne 0 ]; then fi new "Set oldex" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" new "Set newex should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementnewexerrorFailed to find YANG spec of XML node: newex with parent: config in namespace: urn:example:clixon]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementnewexerrorFailed to find YANG spec of XML node: newex with parent: config in namespace: urn:example:clixon]]>]]>$" new "Set other should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementothererrorFailed to find YANG spec of XML node: other with parent: config in namespace: urn:example:clixon2]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementothererrorFailed to find YANG spec of XML node: other with parent: config in namespace: urn:example:clixon2]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" @@ -180,13 +180,13 @@ if [ $BE -ne 0 ]; then fi new "Set newex" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" new "Set oldex should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementoldexerrorFailed to find YANG spec of XML node: oldex with parent: config in namespace: urn:example:clixon]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementoldexerrorFailed to find YANG spec of XML node: oldex with parent: config in namespace: urn:example:clixon]]>]]>$" new "Set other should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementothererrorFailed to find YANG spec of XML node: other with parent: config in namespace: urn:example:clixon2]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementothererrorFailed to find YANG spec of XML node: other with parent: config in namespace: urn:example:clixon2]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" @@ -224,13 +224,13 @@ if [ $BE -ne 0 ]; then fi new "Set oldex" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" new "Set newex should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementnewexerrorFailed to find YANG spec of XML node: newex with parent: config in namespace: urn:example:clixon]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementnewexerrorFailed to find YANG spec of XML node: newex with parent: config in namespace: urn:example:clixon]]>]]>$" new "Set other should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementothererrorFailed to find YANG spec of XML node: other with parent: config in namespace: urn:example:clixon2]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementothererrorFailed to find YANG spec of XML node: other with parent: config in namespace: urn:example:clixon2]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" @@ -268,13 +268,13 @@ if [ $BE -ne 0 ]; then fi new "Set newex" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" new "Set oldex should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementoldexerrorFailed to find YANG spec of XML node: oldex with parent: config in namespace: urn:example:clixon]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementoldexerrorFailed to find YANG spec of XML node: oldex with parent: config in namespace: urn:example:clixon]]>]]>$" new "Set other" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" @@ -313,13 +313,13 @@ if [ $BE -ne 0 ]; then wait_backend fi new "Set oldex" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" new "Set newex should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementnewexerrorFailed to find YANG spec of XML node: newex with parent: config in namespace: urn:example:clixon]]>]]>" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementnewexerrorFailed to find YANG spec of XML node: newex with parent: config in namespace: urn:example:clixon]]>]]>" new "Set other" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" @@ -359,13 +359,13 @@ if [ $BE -ne 0 ]; then fi new "Set oldex" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" new "Set newex should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementnewexerrorFailed to find YANG spec of XML node: newex with parent: config in namespace: urn:example:clixon]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementnewexerrorFailed to find YANG spec of XML node: newex with parent: config in namespace: urn:example:clixon]]>]]>$" new "Set other" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" @@ -405,13 +405,13 @@ if [ $BE -ne 0 ]; then fi new "Set oldex" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^]]>]]>$" new "Set newex should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementnewexerrorFailed to find YANG spec of XML node: newex with parent: config in namespace: urn:example:clixon]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementnewexerrorFailed to find YANG spec of XML node: newex with parent: config in namespace: urn:example:clixon]]>]]>$" new "Set other should fail" -expecteof "$clixon_netconf -qf $cfg" 0 "str]]>]]>" "^applicationunknown-elementothererrorFailed to find YANG spec of XML node: other with parent: config in namespace: urn:example:clixon2]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLOstr]]>]]>" "^applicationunknown-elementothererrorFailed to find YANG spec of XML node: other with parent: config in namespace: urn:example:clixon2]]>]]>$" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/test_yang_namespace.sh b/test/test_yang_namespace.sh index fbf01a07..910c6c2a 100755 --- a/test/test_yang_namespace.sh +++ b/test/test_yang_namespace.sh @@ -88,19 +88,19 @@ if [ $RC -ne 0 ]; then fi new "netconf set x in example1" -expecteof "$clixon_netconf -qf $cfg" 0 "42]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42]]>]]>" "^]]>]]>$" new "netconf get config example1" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^42]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^42]]>]]>$" new "netconf set x in example2" -expecteof "$clixon_netconf -qf $cfg" 0 "99]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO99]]>]]>" "^]]>]]>$" new "netconf get config example1 and example2" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^4299]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^4299]]>]]>$" new "netconf discard-changes" -expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO]]>]]>" "^]]>]]>$" new "restconf set x in example1" expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+json" -d '{"example1:x":42}' $RCPROTO://localhost/restconf/data)" 0 "HTTP/1.1 201 Created" diff --git a/yang/clixon/Makefile.in b/yang/clixon/Makefile.in index 8de273a9..448ddecb 100644 --- a/yang/clixon/Makefile.in +++ b/yang/clixon/Makefile.in @@ -41,7 +41,7 @@ datarootdir = @datarootdir@ # See also OPT_YANG_INSTALLDIR for the standard yang files YANG_INSTALLDIR = @YANG_INSTALLDIR@ -YANGSPECS = clixon-config@2020-12-30.yang +YANGSPECS = clixon-config@2021-03-08.yang YANGSPECS += clixon-lib@2020-12-30.yang YANGSPECS += clixon-rfc5277@2008-07-01.yang YANGSPECS += clixon-xml-changelog@2019-03-21.yang diff --git a/yang/clixon/clixon-config.yang b/yang/clixon/clixon-config.yang index a76a1706..91d563e9 120000 --- a/yang/clixon/clixon-config.yang +++ b/yang/clixon/clixon-config.yang @@ -1 +1 @@ -clixon-config@2020-12-30.yang \ No newline at end of file +clixon-config@2021-03-08.yang \ No newline at end of file diff --git a/yang/clixon/clixon-config@2020-11-03.yang b/yang/clixon/clixon-config@2021-03-08.yang similarity index 91% rename from yang/clixon/clixon-config@2020-11-03.yang rename to yang/clixon/clixon-config@2021-03-08.yang index a90d2c4c..c42d1708 100644 --- a/yang/clixon/clixon-config@2020-11-03.yang +++ b/yang/clixon/clixon-config@2021-03-08.yang @@ -16,7 +16,7 @@ module clixon-config { "Clixon configuration file ***** BEGIN LICENSE BLOCK ***** Copyright (C) 2009-2019 Olof Hagsand - Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate) + Copyright (C) 2020-2021 Olof Hagsand and Rubicon Communications, LLC(Netgate) This file is part of CLIXON @@ -43,6 +43,28 @@ module clixon-config { ***** END LICENSE BLOCK *****"; + revision 2021-03-08 { + description + "Added option: + CLICON_NETCONF_HELLO_OPTIONAL"; + } + revision 2020-12-30 { + description + "Added option: + CLICON_ANONYMOUS_USER + Removed obsolete options: + CLICON_RESTCONF_IPV4_ADDR + CLICON_RESTCONF_IPV6_ADDR + CLICON_RESTCONF_HTTP_PORT + CLICON_RESTCONF_HTTPS_PORT + CLICON_SSL_SERVER_CERT + CLICON_SSL_SERVER_KEY + CLICON_SSL_CA_CERT + CLICON_TRANSACTION_MOD + Marked as obsolete and moved to clixon-restconf.yang: + CLICON_RESTCONF_PATH + CLICON_RESTCONF_PRETTY"; + } revision 2020-11-03 { description "Added CLICON_BACKEND_RESTCONF_PROCESS @@ -289,9 +311,11 @@ module clixon-config { enum IPv4 { description "IPv4"; } + enum IPv6 { + description "IPv6"; + } } } - container clixon-config { container restconf { uses clrc:clixon-restconf; @@ -411,11 +435,28 @@ module clixon-config { type string; description "Location of netconf (frontend) .so plugins"; } + leaf CLICON_NETCONF_HELLO_OPTIONAL { + type boolean; + default false; + description + "This option relates to RFC 6241 Sec 8.1 Capabilies Exchange where it says: + When the NETCONF session is opened, each peer (both client and server) MUST + send a element... + If true, an RPC can be processed directly with no preceeding hello message. + This is legacy clixon but invalid according to the RFC. + If false, NETCONF hello messages are mandatory before any RPC can be processed. + That is, if clixon receives an rpc with no previous hello message, an error + is returned, which conforms to the RFC. + Note this applies only to external NETCONF, not the internal (IPC) netconf"; + } leaf CLICON_RESTCONF_DIR { type string; description "Location of restconf (frontend) .so plugins. Load all .so - plugins in this dir as restconf code plugins"; + plugins in this dir as restconf code plugins + Note: This cannot be moved to clixon-restconf.yang because it is needed + early in the bootstrapping phase, before clixon-restconf.yang config may + be loaded."; } leaf CLICON_RESTCONF_PATH { type string; @@ -423,8 +464,11 @@ module clixon-config { description "FastCGI unix socket. Should be specified in webserver Eg in nginx: fastcgi_pass unix:/www-data/clicon_restconf.sock - Only if with-restconf=fcgi, NOT evhtp"; + Only if with-restconf=fcgi, NOT evhtp + Note: Obsolete, use fcgi-socket in clixon-restconf.yang instead"; + status obsolete; } + leaf CLICON_RESTCONF_PRETTY { type boolean; default true; @@ -436,71 +480,9 @@ module clixon-config { to get return value in XML or JSON. RFC 8040 examples print XML and JSON in pretty-printed form. Setting this value to false makes restconf return not pretty-printed - which may be desirable for performance or tests"; - } - leaf CLICON_RESTCONF_IPV4_ADDR { - type string; - default "0.0.0.0"; + which may be desirable for performance or tests + Note: Obsolete, use pretty in clixon-restconf.yang instead"; status obsolete; - description - "RESTCONF IPv4 socket binding address. - Applies to native http by config option --with-restconf=evhtp. - This config is moved to clixon-restconf.yang."; - } - leaf CLICON_RESTCONF_IPV6_ADDR { - type string; - status obsolete; - description - "RESTCONF IPv6 socket binding address. - Applies to native http by config option --with-restconf=evhtp. - This config is moved to clixon-restconf.yang."; - } - leaf CLICON_RESTCONF_HTTP_PORT { - type uint16; - default 80; - status obsolete; - description - "RESTCONF socket binding port, non-ssl - In the restconf daemon, it can be overriden by -P - Applies to native http only by config option --with-restconf=evhtp. - This config is moved to clixon-restconf.yang."; - } - leaf CLICON_RESTCONF_HTTPS_PORT { - type uint16; - default 443; - status obsolete; - description - "RESTCONF socket binding port, ssl - In the restconf daemon, this is the port chosen if -s is given. - Note it can be overriden by -P - Applies to native http by config option --with-restconf=evhtp. - This config is moved to clixon-restconf.yang."; - } - leaf CLICON_SSL_SERVER_CERT { - type string; - default "/etc/ssl/certs/clixon-server-crt.pem"; - status obsolete; - description - "SSL server cert for restconf https. - Applies to native http only by config option --with-restconf=evhtp. - This config is moved to clixon-restconf.yang."; - } - leaf CLICON_SSL_SERVER_KEY { - type string; - default "/etc/ssl/private/clixon-server-key.pem"; - status obsolete; - description - "SSL server private key for restconf https. - Applies to native http only by config option --with-restconf=evhtp. - This config is moved to clixon-restconf.yang."; - } - leaf CLICON_SSL_CA_CERT { - type string; - default "/etc/ssl/certs/clixon-ca_crt.pem"; - status obsolete; - description - "SSL CA cert for client authentication. - This config is moved to clixon-restconf.yang."; } leaf CLICON_CLI_DIR { type string; @@ -682,8 +664,12 @@ module clixon-config { type string; mandatory true; description - "If family above is AF_UNIX: Unix socket for communicating - with clixon_backend. If family is AF_INET: IPv4 address"; + "String description of Clixon Internal (IPC) socket that connects a clixon + client to the clixon backend. This string is dependent on family. + If CLICON_SOCK_FAMILY is: + - UNIX: The value is a Unix socket path + - IPv4: IPv4 address string + - IPv6: IPv6 address string (NYI)"; } leaf CLICON_SOCK_PORT { type int32; @@ -728,7 +714,14 @@ module clixon-config { type boolean; default false; description - "If set, enable process-control of restconf daemon, ie start/stop restconf daemon internally using fork/exec. + "If set, enable process-control of restconf daemon, ie start/stop restconf + daemon internally from backend daemon. + It uses clixon-restconf.yang for config and clixon-lib.yang for RPC + Process control of restconf daemon is as follows: + - on RPC start, if enable is true, start the service, if false, error or ignore it + - on RPC stop, stop the service + - on backend start make the state as configured + - on enable change, make the state as configured Disable if you start the restconf daemon by other means."; } leaf CLICON_AUTOCOMMIT { @@ -815,13 +808,13 @@ module clixon-config { type startup_mode; description "Which method to boot/start clicon backend"; } - leaf CLICON_TRANSACTION_MOD { - type boolean; - default false; - description "If set, modifications in validation and commit - callbacks are written back into the datastore. - This is a bad idea and therefore obsoleted."; - status obsolete; + leaf CLICON_ANONYMOUS_USER { + type string; + default "anonymous"; + description + "Name of anonymous user. + The current only case where such a user is used is in RESTCONF authentication when + auth-type=none and no known user is known."; } leaf CLICON_NACM_MODE { type nacm_mode; diff --git a/yang/clixon/clixon-lib@2020-04-23.yang b/yang/clixon/clixon-lib@2020-04-23.yang deleted file mode 100644 index f54d4854..00000000 --- a/yang/clixon/clixon-lib@2020-04-23.yang +++ /dev/null @@ -1,112 +0,0 @@ -module clixon-lib { - yang-version 1.1; - namespace "http://clicon.org/lib"; - prefix cl; - - organization - "Clicon / Clixon"; - - contact - "Olof Hagsand "; - - description - "Clixon Netconf extensions for communication between clients and backend. - - ***** BEGIN LICENSE BLOCK ***** - Copyright (C) 2009-2019 Olof Hagsand - Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate) - - This file is part of CLIXON - - Licensed under the Apache License, Version 2.0 (the \"License\"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an \"AS IS\" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Alternatively, the contents of this file may be used under the terms of - the GNU General Public License Version 3 or later (the \"GPL\"), - in which case the provisions of the GPL are applicable instead - of those above. If you wish to allow use of your version of this file only - under the terms of the GPL, and not to allow others to - use your version of this file under the terms of Apache License version 2, - indicate your decision by deleting the provisions above and replace them with - the notice and other provisions required by the GPL. If you do not delete - the provisions above, a recipient may use your version of this file under - the terms of any one of the Apache License version 2 or the GPL. - - ***** END LICENSE BLOCK *****"; - - revision 2020-04-23 { - description - "Added: stats RPC for clixon XML and memory statistics. - Added: restart-plugin RPC for restarting individual plugins without restarting backend."; - } - revision 2019-08-13 { - description - "No changes (reverted change)"; - } - revision 2019-06-05 { - description - "ping rpc added for liveness"; - } - revision 2019-01-02 { - description - "Released in Clixon 3.9"; - } - rpc debug { - description "Set debug level of backend."; - input { - leaf level { - type uint32; - } - } - } - rpc ping { - description "Check aliveness of backend daemon."; - } - rpc stats { - description "Clixon XML statistics."; - output { - container global{ - description "Clixon global statistics"; - leaf xmlnr{ - description "Number of XML objects: number of residing xml/json objects - in the internal 'cxobj' representation."; - type uint64; - } - } - list datastore{ - description "Datastore statistics"; - key "name"; - leaf name{ - description "name of datastore (eg running)."; - type string; - } - leaf nr{ - description "Number of XML objects. That is number of residing xml/json objects - in the internal 'cxobj' representation."; - type uint64; - } - leaf size{ - description "Size in bytes of internal datastore cache of datastore tree."; - type uint64; - } - } - - } - } - rpc restart-plugin { - description "Restart specific backend plugins."; - input { - leaf-list plugin { - description "Name of plugin to restart"; - type string; - } - } - } -} diff --git a/yang/clixon/clixon-lib@2020-12-08.yang b/yang/clixon/clixon-lib@2020-12-08.yang deleted file mode 100644 index 43a6d90a..00000000 --- a/yang/clixon/clixon-lib@2020-12-08.yang +++ /dev/null @@ -1,175 +0,0 @@ -module clixon-lib { - yang-version 1.1; - namespace "http://clicon.org/lib"; - prefix cl; - - organization - "Clicon / Clixon"; - - contact - "Olof Hagsand "; - - description - "Clixon Netconf extensions for communication between clients and backend. - - ***** BEGIN LICENSE BLOCK ***** - Copyright (C) 2009-2019 Olof Hagsand - Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate) - - This file is part of CLIXON - - Licensed under the Apache License, Version 2.0 (the \"License\"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an \"AS IS\" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Alternatively, the contents of this file may be used under the terms of - the GNU General Public License Version 3 or later (the \"GPL\"), - in which case the provisions of the GPL are applicable instead - of those above. If you wish to allow use of your version of this file only - under the terms of the GPL, and not to allow others to - use your version of this file under the terms of Apache License version 2, - indicate your decision by deleting the provisions above and replace them with - the notice and other provisions required by the GPL. If you do not delete - the provisions above, a recipient may use your version of this file under - the terms of any one of the Apache License version 2 or the GPL. - - ***** END LICENSE BLOCK *****"; - - revision 2020-12-08 { - description - "Added: autocli-op extension. - rpc process-control for process/daemon management - Released in clixon 4.9"; - } - revision 2020-04-23 { - description - "Added: stats RPC for clixon XML and memory statistics. - Added: restart-plugin RPC for restarting individual plugins without restarting backend."; - } - revision 2019-08-13 { - description - "No changes (reverted change)"; - } - revision 2019-06-05 { - description - "ping rpc added for liveness"; - } - revision 2019-01-02 { - description - "Released in Clixon 3.9"; - } - typedef service-operation { - type enumeration { - enum start { - description - "Start if not already running"; - } - enum stop { - description - "Stop if running"; - } - enum restart { - description - "Stop if running, then start"; - } - enum status { - description - "Check status"; - } - } - description - "Common operations that can be performed on a service"; - } - extension autocli-op { - description - "Takes an argument an operation defing how to modify the clispec at - this point in the YANG tree for the automated generated CLI. - Note that this extension is only used in clixon_cli. - Operations is expected to be extended, but the following operations are defined: - - hide This command is active but not shown by ? or TAB"; - argument cliop; - } - rpc debug { - description "Set debug level of backend."; - input { - leaf level { - type uint32; - } - } - } - rpc ping { - description "Check aliveness of backend daemon."; - } - rpc stats { - description "Clixon XML statistics."; - output { - container global{ - description "Clixon global statistics"; - leaf xmlnr{ - description "Number of XML objects: number of residing xml/json objects - in the internal 'cxobj' representation."; - type uint64; - } - } - list datastore{ - description "Datastore statistics"; - key "name"; - leaf name{ - description "name of datastore (eg running)."; - type string; - } - leaf nr{ - description "Number of XML objects. That is number of residing xml/json objects - in the internal 'cxobj' representation."; - type uint64; - } - leaf size{ - description "Size in bytes of internal datastore cache of datastore tree."; - type uint64; - } - } - - } - } - rpc restart-plugin { - description "Restart specific backend plugins."; - input { - leaf-list plugin { - description "Name of plugin to restart"; - type string; - } - } - } - - rpc process-control { - description - "Control a specific process or daemon: start/stop, etc. - This is for direct managing of a porcess by the backend. - Alternatively one can manage a daemon via systemd, containerd, kubernetes, etc."; - input { - leaf name { - description "Name of process"; - type string; - mandatory true; - } - leaf operation { - type service-operation; - mandatory true; - description - "One of the strings 'start', 'stop', 'restart', or 'status'."; - } - } - output { - leaf status { - description "For status: is the process running?"; - type boolean; - } - } - } -} diff --git a/yang/clixon/clixon-restconf@2020-10-30.yang b/yang/clixon/clixon-restconf@2020-10-30.yang deleted file mode 100644 index ed6cb9df..00000000 --- a/yang/clixon/clixon-restconf@2020-10-30.yang +++ /dev/null @@ -1,137 +0,0 @@ -module clixon-restconf { - yang-version 1.1; - namespace "http://clicon.org/restconf"; - prefix "clrc"; - - import ietf-inet-types { - prefix inet; - } - - organization - "Clixon"; - - contact - "Olof Hagsand "; - - description - "This YANG module provides a data-model for the Clixon RESTCONF daemon. - ***** BEGIN LICENSE BLOCK ***** - Copyright (C) 2020 Olof Hagsand and Rubicon Communications, LLC(Netgate) - - This file is part of CLIXON - - Licensed under the Apache License, Version 2.0 (the \"License\"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an \"AS IS\" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Alternatively, the contents of this file may be used under the terms of - the GNU General Public License Version 3 or later (the \"GPL\"), - in which case the provisions of the GPL are applicable instead - of those above. If you wish to allow use of your version of this file only - under the terms of the GPL, and not to allow others to - use your version of this file under the terms of Apache License version 2, - indicate your decision by deleting the provisions above and replace them with - the notice and other provisions required by the GPL. If you do not delete - the provisions above, a recipient may use your version of this file under - the terms of any one of the Apache License version 2 or the GPL. - - ***** END LICENSE BLOCK *****"; - - revision 2020-10-30 { - description - "Initial release"; - } - typedef http-auth-type { - type enumeration { - enum client-certificate { - description - "TLS client certificate"; - } - enum password { - description - "PAM password auth"; - } - enum none { - description - "No authentication, no security."; - } - } - description - "Enumeration of HTTP authorization types."; - } - grouping clixon-restconf{ - description - "HTTP RESTCONF configuration."; - leaf enable { - type boolean; - default "false"; - description - "Enables RESTCONF functionality. - Note that starting/stopping of a restconf daemon is different from it being - enabled or not. - For example, if the restconf daemon is under systemd management, the restconf - daemon will only start if enable=true."; - } - leaf auth-type { - type http-auth-type; - description - "The authentication type. - Note client-certificate applies only if ssl-enable is true and socket has ssl"; - } - leaf server-cert-path { - type string; - description - "Path to server certificate file. - Note only applies if socket has ssl enabled"; - } - leaf server-key-path { - type string; - description - "Path to server key file - Note only applies if socket has ssl enabled"; - } - leaf server-ca-cert-path { - type string; - description - "Path to server CA cert file - Note only applies if socket has ssl enabled"; - } - list socket { - key "namespace address port"; - leaf namespace { - type string; - description "indicates a namespace for instance. On platforms where namespaces are not suppported, always 'default'"; - } - leaf address { - type inet:ip-address; - description "IP address to bind to"; - } - leaf port { - type inet:port-number; - description "IP port to bind to"; - } - leaf ssl { - type boolean; - default true; - description "Enable for HTTPS otherwise HTTP protocol"; - } - } - } - container restconf { - description - "This presence is strictly not necessary since the enable flag - in clixon-restconf is the flag bearing the actual semantics. - However, removing the presence leads to default config in all - clixon installations, even those which do not use backend-started restconf. - One could see this as mostly cosmetically annoying. - Alternative would be to make the inclusion of this yang conditional."; - presence "Enables RESTCONF"; - uses clixon-restconf; - } -}