From c97346921b3876771623a7f53195a8d874862b6b Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Wed, 31 Jul 2019 16:45:48 +0200 Subject: [PATCH] Netconf operation attribute namespace check is enforced --- apps/backend/backend_client.c | 26 ++++++++++---------- apps/cli/cli_common.c | 15 +++++------- apps/netconf/netconf_hello.c | 2 +- apps/restconf/restconf_lib.c | 2 +- apps/restconf/restconf_methods.c | 16 +++++++++--- apps/restconf/restconf_methods_post.c | 6 ++++- example/main/example_backend.c | 2 +- example/main/example_cli.c | 3 ++- lib/clixon/clixon_xml.h | 6 +++++ lib/src/clixon_datastore_write.c | 35 ++++++++++++--------------- lib/src/clixon_proto_client.c | 1 + test/test_copy_config.sh | 21 ++++++++-------- test/test_leafref.sh | 2 +- test/test_netconf.sh | 10 ++++---- test/test_order.sh | 2 +- test/test_perf.sh | 2 +- test/test_transaction.sh | 2 +- test/test_unique.sh | 4 +-- test/test_yang.sh | 2 +- 19 files changed, 86 insertions(+), 73 deletions(-) diff --git a/apps/backend/backend_client.c b/apps/backend/backend_client.c index e8437a88..07329adc 100644 --- a/apps/backend/backend_client.c +++ b/apps/backend/backend_client.c @@ -1377,46 +1377,46 @@ backend_rpc_init(clicon_handle h) /* In backend_client.? RFC 6241 */ if (rpc_callback_register(h, from_client_get_config, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "get-config") < 0) + NETCONF_BASE_NAMESPACE, "get-config") < 0) goto done; if (rpc_callback_register(h, from_client_edit_config, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "edit-config") < 0) + NETCONF_BASE_NAMESPACE, "edit-config") < 0) goto done; if (rpc_callback_register(h, from_client_copy_config, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "copy-config") < 0) + NETCONF_BASE_NAMESPACE, "copy-config") < 0) goto done; if (rpc_callback_register(h, from_client_delete_config, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "delete-config") < 0) + NETCONF_BASE_NAMESPACE, "delete-config") < 0) goto done; if (rpc_callback_register(h, from_client_lock, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "lock") < 0) + NETCONF_BASE_NAMESPACE, "lock") < 0) goto done; if (rpc_callback_register(h, from_client_unlock, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "unlock") < 0) + NETCONF_BASE_NAMESPACE, "unlock") < 0) goto done; if (rpc_callback_register(h, from_client_get, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "get") < 0) + NETCONF_BASE_NAMESPACE, "get") < 0) goto done; if (rpc_callback_register(h, from_client_close_session, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "close-session") < 0) + NETCONF_BASE_NAMESPACE, "close-session") < 0) goto done; if (rpc_callback_register(h, from_client_kill_session, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "kill-session") < 0) + NETCONF_BASE_NAMESPACE, "kill-session") < 0) goto done; /* In backend_commit.? */ if (rpc_callback_register(h, from_client_commit, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "commit") < 0) + NETCONF_BASE_NAMESPACE, "commit") < 0) goto done; if (rpc_callback_register(h, from_client_discard_changes, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "discard-changes") < 0) + NETCONF_BASE_NAMESPACE, "discard-changes") < 0) goto done; /* if-feature confirmed-commit */ if (rpc_callback_register(h, from_client_cancel_commit, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "cancel-commit") < 0) + NETCONF_BASE_NAMESPACE, "cancel-commit") < 0) goto done; /* if-feature validate */ if (rpc_callback_register(h, from_client_validate, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", "validate") < 0) + NETCONF_BASE_NAMESPACE, "validate") < 0) goto done; /* In backend_client.? RPC from RFC 5277 */ diff --git a/apps/cli/cli_common.c b/apps/cli/cli_common.c index 81ceb677..f0840491 100644 --- a/apps/cli/cli_common.c +++ b/apps/cli/cli_common.c @@ -236,19 +236,15 @@ cli_dbxml(clicon_handle h, enum operation_type op) { int retval = -1; - // char *str = NULL; - char *api_path_fmt; /* xml key format */ + char *api_path_fmt; /* xml key format */ char *api_path = NULL; /* xml key */ - // cg_var *cval; - // int len; cg_var *arg; cbuf *cb = NULL; yang_stmt *yspec; - cxobj *xbot = NULL; /* xpath, NULL if datastore */ - yang_stmt *y = NULL; /* yang spec of xpath */ - cxobj *xtop = NULL; /* xpath root */ - cxobj *xa; /* attribute */ - // cxobj *xb; /* body */ + cxobj *xbot = NULL; /* xpath, NULL if datastore */ + yang_stmt *y = NULL; /* yang spec of xpath */ + cxobj *xtop = NULL; /* xpath root */ + cxobj *xa; /* attribute */ if (cvec_len(argv) != 1){ clicon_err(OE_PLUGIN, 0, "Requires one element to be xml key format string"); @@ -271,6 +267,7 @@ cli_dbxml(clicon_handle h, if ((xa = xml_new("operation", xbot, NULL)) == NULL) goto done; xml_type_set(xa, CX_ATTR); + xml_prefix_set(xa, NETCONF_BASE_PREFIX); if (xml_value_set(xa, xml_operation2str(op)) < 0) goto done; if (yang_keyword_get(y) != Y_LIST && yang_keyword_get(y) != Y_LEAF_LIST){ diff --git a/apps/netconf/netconf_hello.c b/apps/netconf/netconf_hello.c index 9c4b07ba..c7ab25ac 100644 --- a/apps/netconf/netconf_hello.c +++ b/apps/netconf/netconf_hello.c @@ -161,7 +161,7 @@ netconf_create_hello(clicon_handle h, if ((ietf_yang_library_revision = yang_modules_revision(h)) == NULL) goto done; add_preamble(cb); - cprintf(cb, ""); + cprintf(cb, "", NETCONF_BASE_NAMESPACE); cprintf(cb, ""); cprintf(cb, "urn:ietf:params:netconf:base:1.0"); if (xml_chardata_encode(&encstr, "urn:ietf:params:netconf:capability:yang-library:1.0?revision=%s&module-set-id=%s", diff --git a/apps/restconf/restconf_lib.c b/apps/restconf/restconf_lib.c index 7f28986d..f29f1b25 100644 --- a/apps/restconf/restconf_lib.c +++ b/apps/restconf/restconf_lib.c @@ -579,7 +579,7 @@ restconf_insert_attributes(cxobj *xdata, if (xml_prefix_set(xa, "xmlns") < 0) goto done; xml_type_set(xa, CX_ATTR); - if (xml_value_set(xa, "urn:ietf:params:xml:ns:yang:1") < 0) + if (xml_value_set(xa, YANG_XML_NAMESPACE) < 0) goto done; /* Then add insert attribute */ if ((xa = xml_new("insert", xdata, NULL)) == NULL) diff --git a/apps/restconf/restconf_methods.c b/apps/restconf/restconf_methods.c index 0657920b..e795d58a 100644 --- a/apps/restconf/restconf_methods.c +++ b/apps/restconf/restconf_methods.c @@ -290,8 +290,8 @@ api_data_put(clicon_handle h, char *dname; int nullspec = 0; - clicon_debug(1, "%s api_path:\"%s\" data:\"%s\"", - __FUNCTION__, api_path0, data); + clicon_debug(1, "%s api_path:\"%s\"", __FUNCTION__, api_path0); + clicon_debug(1, "%s data:\"%s\"", __FUNCTION__, data); if ((yspec = clicon_dbspec_yang(h)) == NULL){ clicon_err(OE_FATAL, 0, "No DB_SPEC"); goto done; @@ -415,6 +415,7 @@ api_data_put(clicon_handle h, if ((xa = xml_new("operation", xdata, NULL)) == NULL) goto done; xml_type_set(xa, CX_ATTR); + xml_prefix_set(xa, NETCONF_BASE_PREFIX); op = OP_CREATE; if (xml_value_set(xa, xml_operation2str(op)) < 0) goto done; @@ -542,7 +543,10 @@ api_data_put(clicon_handle h, */ username = clicon_username_get(h); again: - cprintf(cbx, "", username?username:""); + cprintf(cbx, "", + username?username:"", + NETCONF_BASE_PREFIX, + NETCONF_BASE_NAMESPACE); /* bind nc to netconf namespace */ cprintf(cbx, ""); cprintf(cbx, "none"); if (clicon_xml2cbuf(cbx, xtop, 0, 0) < 0) @@ -720,6 +724,7 @@ api_data_delete(clicon_handle h, if ((xa = xml_new("operation", xbot, NULL)) == NULL) goto done; xml_type_set(xa, CX_ATTR); + xml_prefix_set(xa, NETCONF_BASE_PREFIX); if (xml_value_set(xa, xml_operation2str(op)) < 0) goto done; if ((cbx = cbuf_new()) == NULL) @@ -727,7 +732,10 @@ api_data_delete(clicon_handle h, /* For internal XML protocol: add username attribute for access control */ username = clicon_username_get(h); - cprintf(cbx, "", username?username:""); + cprintf(cbx, "", + username?username:"", + NETCONF_BASE_PREFIX, + NETCONF_BASE_NAMESPACE); /* bind nc to netconf namespace */ cprintf(cbx, ""); cprintf(cbx, "none"); if (clicon_xml2cbuf(cbx, xtop, 0, 0) < 0) diff --git a/apps/restconf/restconf_methods_post.c b/apps/restconf/restconf_methods_post.c index 265441b5..0dfb77b6 100644 --- a/apps/restconf/restconf_methods_post.c +++ b/apps/restconf/restconf_methods_post.c @@ -259,6 +259,7 @@ api_data_post(clicon_handle h, if ((xa = xml_new("operation", xdata, NULL)) == NULL) goto done; xml_type_set(xa, CX_ATTR); + xml_prefix_set(xa, NETCONF_BASE_PREFIX); if (xml_value_set(xa, xml_operation2str(op)) < 0) goto done; /* Replace xbot with x, ie bottom of api-path with data */ @@ -304,7 +305,10 @@ api_data_post(clicon_handle h, /* For internal XML protocol: add username attribute for access control */ username = clicon_username_get(h); - cprintf(cbx, "", username?username:""); + cprintf(cbx, "", + username?username:"", + NETCONF_BASE_PREFIX, + NETCONF_BASE_NAMESPACE); /* bind nc to netconf namespace */ cprintf(cbx, ""); cprintf(cbx, "none"); if (clicon_xml2cbuf(cbx, xtop, 0, 0) < 0) diff --git a/example/main/example_backend.c b/example/main/example_backend.c index eac3e9da..647e892b 100644 --- a/example/main/example_backend.c +++ b/example/main/example_backend.c @@ -749,7 +749,7 @@ clixon_plugin_init(clicon_handle h) /* Called after the regular system copy_config callback */ if (rpc_callback_register(h, example_copy_extra, NULL, - "urn:ietf:params:xml:ns:netconf:base:1.0", + NETCONF_BASE_NAMESPACE, "copy-config" ) < 0) goto done; diff --git a/example/main/example_cli.c b/example/main/example_cli.c index adbdefba..7e1ec757 100644 --- a/example/main/example_cli.c +++ b/example/main/example_cli.c @@ -95,7 +95,8 @@ example_client_rpc(clicon_handle h, /* User supplied variable in CLI command */ cva = cvec_find(cvv, "a"); /* get a cligen variable from vector */ /* Create XML for example netconf RPC */ - if (xml_parse_va(&xtop, NULL, "%s", + if (xml_parse_va(&xtop, NULL, "%s", + NETCONF_BASE_NAMESPACE, clicon_username_get(h), cv_string_get(cva)) < 0) goto done; diff --git a/lib/clixon/clixon_xml.h b/lib/clixon/clixon_xml.h index caf6e424..b9ef6d08 100644 --- a/lib/clixon/clixon_xml.h +++ b/lib/clixon/clixon_xml.h @@ -44,9 +44,15 @@ /* 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" /* * Types */ diff --git a/lib/src/clixon_datastore_write.c b/lib/src/clixon_datastore_write.c index 9adeff20..b2e07595 100644 --- a/lib/src/clixon_datastore_write.c +++ b/lib/src/clixon_datastore_write.c @@ -227,9 +227,8 @@ text_modify(clicon_handle h, int changed = 0; /* Only if x0p's children have changed-> sort is necessary */ /* Check for operations embedded in tree according to netconf */ -#ifdef notyet /* XXX breaks in test_cohoice.sh */ if ((ret = attr_ns_value(x1, - "operation", "urn:ietf:params:xml:ns:netconf:base:1.0", + "operation", NETCONF_BASE_NAMESPACE, cbret, &opstr)) < 0) goto done; if (ret == 0) @@ -237,12 +236,6 @@ text_modify(clicon_handle h, if (opstr != NULL) if (xml_operation(opstr, &op) < 0) goto done; -#else - if ((opstr = xml_find_value(x1, "operation")) != NULL) - if (xml_operation(opstr, &op) < 0) - goto done; -#endif - x1name = xml_name(x1); if (yang_keyword_get(y0) == Y_LEAF_LIST || yang_keyword_get(y0) == Y_LEAF){ @@ -260,7 +253,7 @@ text_modify(clicon_handle h, if (yang_keyword_get(y0) == Y_LEAF_LIST && yang_find(y0, Y_ORDERED_BY, "user") != NULL){ if ((ret = attr_ns_value(x1, - "insert", "urn:ietf:params:xml:ns:yang:1", + "insert", YANG_XML_NAMESPACE, cbret, &instr)) < 0) goto done; if (ret == 0) @@ -269,7 +262,7 @@ text_modify(clicon_handle h, xml_attr_insert2val(instr, &insert) < 0) goto done; if ((ret = attr_ns_value(x1, - "value", "urn:ietf:params:xml:ns:yang:1", + "value", YANG_XML_NAMESPACE, cbret, &valstr)) < 0) goto done; /* if insert/before, value attribute must be there */ @@ -331,7 +324,8 @@ text_modify(clicon_handle h, if (strcmp(xml_name(x1a),"xmlns")==0 || ((xns = xml_prefix(x1a)) && strcmp(xns, "xmlns")==0)){ #if 1 /* XXX Kludge to NOT copy RFC7950 xmlns:yang insert/key/value namespaces */ - if (strcmp(xml_value(x1a),"urn:ietf:params:xml:ns:yang:1")==0) + if (strcmp(xml_value(x1a), YANG_XML_NAMESPACE)==0 || + strcmp(xml_value(x1a), NETCONF_BASE_NAMESPACE)==0) continue; #endif if ((x0a = xml_dup(x1a)) == NULL) @@ -420,7 +414,7 @@ text_modify(clicon_handle h, if (yang_keyword_get(y0) == Y_LIST && yang_find(y0, Y_ORDERED_BY, "user") != NULL){ if ((ret = attr_ns_value(x1, - "insert", "urn:ietf:params:xml:ns:yang:1", + "insert", YANG_XML_NAMESPACE, cbret, &instr)) < 0) goto done; if (ret == 0) @@ -429,7 +423,7 @@ text_modify(clicon_handle h, xml_attr_insert2val(instr, &insert) < 0) goto done; if ((ret = attr_ns_value(x1, - "key", "urn:ietf:params:xml:ns:yang:1", + "key", YANG_XML_NAMESPACE, cbret, &keystr)) < 0) goto done; /* if insert/before, key attribute must be there */ @@ -517,7 +511,8 @@ text_modify(clicon_handle h, if (strcmp(xml_name(x1a),"xmlns")==0 || ((xns = xml_prefix(x1a)) && strcmp(xns, "xmlns")==0)){ #if 1 /* XXX Kludge to NOT copy RFC7950 xmlns:yang insert/key/value namespaces */ - if (strcmp(xml_value(x1a),"urn:ietf:params:xml:ns:yang:1")==0) + if (strcmp(xml_value(x1a), YANG_XML_NAMESPACE)==0 || + strcmp(xml_value(x1a), NETCONF_BASE_NAMESPACE)==0) continue; #endif if ((x0a = xml_dup(x1a)) == NULL) @@ -650,12 +645,14 @@ text_modify_top(clicon_handle h, char *opstr; int ret; - /* Assure top-levels are 'config' */ - // assert(x0 && strcmp(xml_name(x0),"config")==0); - // assert(x1 && strcmp(xml_name(x1),"config")==0); - /* Check for operations embedded in tree according to netconf */ - if ((opstr = xml_find_value(x1, "operation")) != NULL) + if ((ret = attr_ns_value(x1, + "operation", NETCONF_BASE_NAMESPACE, + cbret, &opstr)) < 0) + goto done; + if (ret == 0) + goto fail; + if (opstr != NULL) if (xml_operation(opstr, &op) < 0) goto done; /* Special case if x1 is empty, top-level only */ diff --git a/lib/src/clixon_proto_client.c b/lib/src/clixon_proto_client.c index 30671817..98ed0fdd 100644 --- a/lib/src/clixon_proto_client.c +++ b/lib/src/clixon_proto_client.c @@ -357,6 +357,7 @@ clicon_rpc_edit_config(clicon_handle h, if ((cb = cbuf_new()) == NULL) goto done; cprintf(cb, "<%s/>", db); diff --git a/test/test_copy_config.sh b/test/test_copy_config.sh index 75e3eea9..f29f083f 100755 --- a/test/test_copy_config.sh +++ b/test/test_copy_config.sh @@ -69,23 +69,22 @@ if [ $BE -ne 0 ]; then if [ $? -ne 0 ]; then err fi - new "start backend -s init -f $cfg" - # start new backend - echo "sudo $clixon_backend -s init -f $cfg -D $DBG" - sudo $clixon_backend -s init -f $cfg -D $DBG - if [ $? -ne 0 ]; then - err - fi + + new "start backend -s init -f $cfg" + start_backend -s init -f $cfg + + new "waiting" + wait_backend fi new "Add config to candidate" -expecteof "$clixon_netconf -qf $cfg" 0 'eth/0/0ex:ethnone ]]>]]>' "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 'eth/0/0ex:ethnone ]]>]]>' "^]]>]]>$" new "netconf commit to running" expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "Delete candidate" -expecteof "$clixon_netconf -qf $cfg" 0 'eth/0/0ex:ethnone ]]>]]>' '^]]>]]>$' +expecteof "$clixon_netconf -qf $cfg" 0 'eth/0/0ex:ethnone ]]>]]>' '^]]>]]>$' # Here startup and candidate are empty, only running has content # test running->startup and running->candidate @@ -123,7 +122,7 @@ new "Check startup content" expecteof "$clixon_netconf -qf $cfg" 0 ']]>]]>' '^eth/0/0ex:ethtrue]]>]]>$' new "Delete candidate" -expecteof "$clixon_netconf -qf $cfg" 0 'eth/0/0ex:ethnone ]]>]]>' '^]]>]]>$' +expecteof "$clixon_netconf -qf $cfg" 0 'eth/0/0ex:ethnone ]]>]]>' '^]]>]]>$' # Here candidate is empty and startup has content # test startup->candidate @@ -138,7 +137,7 @@ expecteof "$clixon_netconf -qf $cfg" 0 'eth/0/0ex:ethnone ]]>]]>' '^]]>]]>$' +expecteof "$clixon_netconf -qf $cfg" 0 'eth/0/0ex:ethnone ]]>]]>' '^]]>]]>$' new "netconf commit to running" expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" diff --git a/test/test_leafref.sh b/test/test_leafref.sh index ef8c62b5..36bfebf7 100755 --- a/test/test_leafref.sh +++ b/test/test_leafref.sh @@ -168,7 +168,7 @@ new "leafref validate (ok)" expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^" new "leafref delete leaf" -expecteof "$clixon_netconf -qf $cfg" 0 'eth0]]>]]>' '^' +expecteof "$clixon_netconf -qf $cfg" 0 'eth0]]>]]>' '^' new "leafref validate (should fail)" expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" '^applicationbad-elementeth0errorLeafref validation failed: No such leaf]]>]]>$' diff --git a/test/test_netconf.sh b/test/test_netconf.sh index 1ece0926..b7b77f0a 100755 --- a/test/test_netconf.sh +++ b/test/test_netconf.sh @@ -65,7 +65,7 @@ new "Check nothing added" expecteof "$clixon_netconf -qf $cfg" 0 ']]>]]>' '^]]>]]>$' 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 'eth/0/0ex:ethnone ]]>]]>' "^]]>]]>$" # Too many quotes, (single inside double inside single) need to fool bash cat < $tmp # new @@ -76,19 +76,19 @@ 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 'eth/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 'eth/0/0ex:ethnone ]]>]]>' '^]]>]]>$' new "Check deleted eth/0/0 (non-presence container)" expecteof "$clixon_netconf -qf $cfg" 0 ']]>]]>' '^]]>]]>$' 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 'eth/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 'ex:ethnone ]]>]]>' '^applicationmissing-elementnameerrorMandatory key]]>]]>$' new "netconf discard-changes" expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" diff --git a/test/test_order.sh b/test/test_order.sh index 4f0a57f3..7dcf82a0 100755 --- a/test/test_order.sh +++ b/test/test_order.sh @@ -317,7 +317,7 @@ new "check ordered-by-user: a,b,c,d,e" expecteof "$clixon_netconf -qf $cfg" 0 ']]>]]>' '^abcde]]>]]>$' new "move one entry (e) to leaf-list first" -expecteof "$clixon_netconf -qf $cfg" 0 'e]]>]]>' "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 'e]]>]]>' "^]]>]]>$" new "check ordered-by-user: e,a,b,c,d" expecteof "$clixon_netconf -qf $cfg" 0 ']]>]]>' '^eabcd]]>]]>$' diff --git a/test/test_perf.sh b/test/test_perf.sh index 65c20531..23e71c7c 100755 --- a/test/test_perf.sh +++ b/test/test_perf.sh @@ -186,7 +186,7 @@ expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^< new "netconf delete $perfreq small config" { time -p for (( i=0; i<$perfreq; i++ )); do rnd=$(( ( RANDOM % $perfnr ) )) - echo "$rnd]]>]]>" + echo "$rnd]]>]]>" done | $clixon_netconf -qf $cfg > /dev/null; } 2>&1 | awk '/real/ {print $2}' new "netconf discard-changes" diff --git a/test/test_transaction.sh b/test/test_transaction.sh index fefe6122..279dd1e4 100755 --- a/test/test_transaction.sh +++ b/test/test_transaction.sh @@ -318,4 +318,4 @@ fi # kill backend stop_backend -f $cfg -#rm -rf $dir +rm -rf $dir diff --git a/test/test_unique.sh b/test/test_unique.sh index a921ff53..eb6cca5e 100755 --- a/test/test_unique.sh +++ b/test/test_unique.sh @@ -135,14 +135,14 @@ new "netconf validate ok" expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" new "make it invalid by adding port to ftp entry" -expecteof "$clixon_netconf -qf $cfg" 0 'noneftp25 +expecteof "$clixon_netconf -qf $cfg" 0 'noneftp25 ]]>]]>' "^]]>]]>$" new "netconf validate (should fail)" expecteof "$clixon_netconf -qf $cfg" 0 "]]>]]>" '^protocoloperation-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 'nonesmtp25 ]]>]]>' '^]]>]]>$' new "netconf validate ok" diff --git a/test/test_yang.sh b/test/test_yang.sh index d535a0b8..a448db71 100755 --- a/test/test_yang.sh +++ b/test/test_yang.sh @@ -257,7 +257,7 @@ new "netconf check replace" expecteof "$clixon_netconf -qf $cfg" 0 ']]>]]>' '111replace121two]]>]]>' new "netconf delete first" -expecteof "$clixon_netconf -qf $cfg" 0 '111]]>]]>' "^]]>]]>$" +expecteof "$clixon_netconf -qf $cfg" 0 '111]]>]]>' "^]]>]]>$" new "netconf check delete" expecteof "$clixon_netconf -qf $cfg" 0 ']]>]]>' '121two]]>]]>'