diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bd7ee48..51fb753e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ Expected: September 2022 ### Corrected Bugs +* Fixed: [Missing/no namespace error in YANG augments with default values](https://github.com/clicon/clixon/issues/354) * Fixed: [Validation of mandatory in choice/case does not work in some cases](https://github.com/clicon/clixon/issues/349) ## 5.8.0 diff --git a/lib/src/clixon_datastore_write.c b/lib/src/clixon_datastore_write.c index c1d4df18..ac07dd8c 100644 --- a/lib/src/clixon_datastore_write.c +++ b/lib/src/clixon_datastore_write.c @@ -133,16 +133,27 @@ attr_ns_value(cxobj *x, } /*! When new body is added, some needs type lookup is made and namespace checked + * * This includes identityrefs, paths * This code identifies x0 as an identityref, looks at the _body_ string and ensures the right * namespace is inserted in x1. + * @param[in] x1 Base xml tree (can be NULL in add scenarios) + * @param[in] x0 XML tree which modifies base + * @param[in] x0p Parent of x0 + * @param[in] x1bstr Body string of x1 + * @param[in] y Yang of x0 (and x1) + * @param[out] cbret Initialized cligen buffer. Contains return XML if retval is 0. + * @retval -1 Error + * @retval 0 Failed (cbret set) + * @retval 1 OK */ static int check_body_namespace(cxobj *x0, + cxobj *x0p, cxobj *x1, - cxobj *x1p, char *x1bstr, - yang_stmt *y) + yang_stmt *y, + cbuf *cbret) { int retval = -1; char *prefix = NULL; @@ -151,56 +162,102 @@ check_body_namespace(cxobj *x0, cxobj *xa; cxobj *x; int isroot; + cbuf *cberr = NULL; + int ret; /* XXX: need to identify root better than hiereustics and strcmp,... */ - isroot = xml_parent(x1p)==NULL && - strcmp(xml_name(x1p), DATASTORE_TOP_SYMBOL) == 0 && - xml_prefix(x1p)==NULL; + isroot = xml_parent(x0p)==NULL && + strcmp(xml_name(x0p), DATASTORE_TOP_SYMBOL) == 0 && + xml_prefix(x0p)==NULL; if (nodeid_split(x1bstr, &prefix, NULL) < 0) goto done; if (prefix == NULL) goto ok; /* skip */ - if (xml2ns(x0, prefix, &ns0) < 0) + if (xml2ns(x1, prefix, &ns0) < 0) goto done; - if (xml2ns(x1, prefix, &ns1) < 0) + if (xml2ns(x0, prefix, &ns1) < 0) goto done; - if (ns0 != NULL){ - if (ns1){ - if (strcmp(ns0, ns1)){ - clicon_err(OE_YANG, EFAULT, "identity namespace collision: %s: %s vs %s", x1bstr, ns0, ns1); + if (ns0 != NULL && ns1 != NULL){ /* namespace exists in both x1 and x0 */ + if (strcmp(ns0, ns1)){ + /* prefixes in x1 and x0 refers to different namespaces + * XXX return netconf error instead +bad-attribue? + */ + if ((cberr = cbuf_new()) == NULL){ + clicon_err(OE_UNIX, errno, "cbuf_new"); goto done; } + cprintf(cberr, "identityref: \"%s\": namespace collision %s vs %s", x1bstr, ns0, ns1); + if (netconf_invalid_value(cbret, "application", cbuf_get(cberr)) < 0) + goto done; + goto fail; + } + } + else if (ns0 != NULL && ns1 == NULL){ /* namespace exists in x0 but not in x1: add it to x1*/ + if (isroot) + x = x0; + else + x = x0p; + if (nscache_set(x, prefix, ns0) < 0) + goto done; + /* Create xmlns attribute to x0 XXX same code ^*/ + if (prefix){ + if ((xa = xml_new(prefix, x, CX_ATTR)) == NULL) + goto done; + if (xml_prefix_set(xa, "xmlns") < 0) + goto done; } else{ - if (isroot) - x = x1; - else - x = x1p; - if (nscache_set(x, prefix, ns0) < 0) + if ((xa = xml_new("xmlns", x, CX_ATTR)) == NULL) goto done; - /* Create xmlns attribute to x1 XXX same code ^*/ - if (prefix){ - if ((xa = xml_new(prefix, x, CX_ATTR)) == NULL) + } + if (xml_value_set(xa, ns0) < 0) + goto done; + xml_sort(x); /* Ensure attr is first / XXX xml_insert? */ + } +#if 0 + else if (ns0 == NULL && ns1 != NULL){ /* namespace exists in x1 but not in x0: OK (but request is realy invalid */ + } +#endif + else{ /* Namespace does not exist in x0: error */ +#ifdef IDENTITYREF_KLUDGE + if (ns1 == NULL){ + if ((ret = yang_find_namespace_by_prefix(y, prefix, &ns0)) < 0) + goto done; + if (ret == 0){ /* no such namespace in yang */ + ; + } + else{ /* Add it according to the kludge,... */ + if ((xa = xml_new(prefix, x0, CX_ATTR)) == NULL) goto done; if (xml_prefix_set(xa, "xmlns") < 0) goto done; - - } - else{ - if ((xa = xml_new("xmlns", x, CX_ATTR)) == NULL) + if (xml_value_set(xa, ns0) < 0) goto done; } - if (xml_value_set(xa, ns0) < 0) - goto done; - xml_sort(x); /* Ensure attr is first / XXX xml_insert? */ } +#else + if ((cberr = cbuf_new()) == NULL){ + clicon_err(OE_UNIX, errno, "cbuf_new"); + goto done; + } + cprintf(cberr, "identityref: \"%s\": prefix \"%s\" has no associated namespace", x1bstr, prefix); + if (netconf_invalid_value(cbret, "application", cbuf_get(cberr)) < 0) + goto done; + goto fail; +#endif } ok: - retval = 0; + retval = 1; done: + if (cberr) + cbuf_free(cberr); if (prefix) free(prefix); return retval; + fail: + retval = 0; + goto done; } /*! Check yang when condition between a new xml x1 and old x0 @@ -602,13 +659,15 @@ text_modify(clicon_handle h, } restype = yang_argument_get(yrestype); /* Differentiate between an empty type (NULL) and an empty string "" */ - if (x1bstr==NULL && strcmp(restype,"string")==0) + if (x1bstr==NULL && strcmp(restype, "string")==0) x1bstr=""; if (x1bstr){ if (strcmp(restype, "identityref") == 0){ x1bstr = clixon_trim2(x1bstr, " \t\n"); - if (check_body_namespace(x1, x0, x0p, x1bstr, y0) < 0) + if ((ret = check_body_namespace(x0, x0p, x1, x1bstr, y0, cbret)) < 0) goto done; + if (ret == 0) + goto fail; } else{ /* Some bodies strip pretty-printed here, unsure where to do this,.. */ diff --git a/lib/src/clixon_xml_map.c b/lib/src/clixon_xml_map.c index 160f01e3..9a33f129 100644 --- a/lib/src/clixon_xml_map.c +++ b/lib/src/clixon_xml_map.c @@ -651,10 +651,11 @@ xml_namespace_change(cxobj *x, return retval; } -int +/*! + */ +static int xml_default_create1(yang_stmt *y, cxobj *xt, - int top, cxobj **xcp) { int retval = -1; @@ -678,12 +679,6 @@ xml_default_create1(yang_stmt *y, } else{ /* Namespace does not exist in target, must add it w xmlns attr. use source prefix */ - if (!top){ - if ((prefix = yang_find_myprefix(y)) == NULL){ - clicon_err(OE_UNIX, errno, "strdup"); - goto done; - } - } if (add_namespace(xc, xc, prefix, namespace) < 0) goto done; /* Add prefix to x, if any */ @@ -718,7 +713,7 @@ xml_default_create(yang_stmt *y, char *str; cg_var *cv; - if (xml_default_create1(y, xt, top, &xc) < 0) + if (xml_default_create1(y, xt, &xc) < 0) goto done; xml_flag_set(xc, XML_FLAG_DEFAULT); if ((xb = xml_new("body", xc, CX_BODY)) == NULL) @@ -869,7 +864,7 @@ xml_default1(yang_stmt *yt, if (create){ /* Retval shows there is a default value need to create the * container */ - if (xml_default_create1(yc, xt, top, &xc) < 0) + if (xml_default_create1(yc, xt, &xc) < 0) goto done; xml_sort(xt); /* Then call it recursively */ @@ -923,6 +918,7 @@ xml_default(cxobj *xt, * @param[in] state If set expand defaults also for state data, otherwise only config * @retval 0 OK * @retval -1 Error + * @see xml_global_defaults */ int xml_default_recurse(cxobj *xn, @@ -989,6 +985,7 @@ xml_global_defaults_create(cxobj *xt, * @retval 0 OK * @retval -1 Error * Uses cache? + * @see xml_default_recurse */ int xml_global_defaults(clicon_handle h, @@ -1567,28 +1564,31 @@ xml_merge1(cxobj *x0, /* the target */ cxobj *x1, /* the source */ char **reason) { - int retval = -1; - char *x1cname; /* child name */ - cxobj *x0c; /* base child */ - cxobj *x0b; /* base body */ - cxobj *x1c; /* mod child */ - char *x1bstr; /* mod body string */ - yang_stmt *yc; /* yang child */ - cbuf *cbr = NULL; /* Reason buffer */ - int ret; - int i; + int retval = -1; + char *x1cname; /* child name */ + cxobj *x0c; /* base child */ + cxobj *x0b; /* base body */ + cxobj *x1c; /* mod child */ + char *x1bstr; /* mod body string */ + yang_stmt *yc; /* yang child */ + cbuf *cbr = NULL; /* Reason buffer */ + int ret; + int i; merge_twophase *twophase = NULL; - int twophase_len; + int twophase_len; + cvec *nsc = NULL; + cg_var *cv; + char *ns; + char *px; + char *pxe; - assert(x1 && xml_type(x1) == CX_ELMNT); - assert(y0); - + if (x1 == NULL || xml_type(x1) != CX_ELMNT || y0 == NULL){ + clicon_err(OE_XML, EINVAL, "x1 is NULL or not XML element, or lacks yang spec"); + goto done; + } if (x0 == NULL){ - cvec *nsc = NULL; - cg_var *cv; - char *ns; - char *px; - nsc = cvec_dup(nscache_get_all(x1)); + if (xml_nsctx_node(x1, &nsc) < 0) + goto done; if (xml_rm(x1) < 0) goto done; /* This is to make the anydata case a little more robust, more could be done */ @@ -1603,13 +1603,16 @@ xml_merge1(cxobj *x0, /* the target */ while ((cv = cvec_each(nsc, cv)) != NULL){ px = cv_name_get(cv); ns = cv_string_get(cv); - /* Check if it exists */ - if (xml2prefix(x1, ns, NULL) == 0) + /* Check if namespace exists */ + if ((ret = xml2prefix(x1, ns, &pxe)) < 0) + goto done; + if (ret == 0 || /* Not exist */ + clicon_strcmp(px, pxe) != 0){ /* Exists and not equal (can be NULL) */ if (xmlns_set(x1, px, ns) < 0) goto done; + xml_sort(x1); + } } - if (nsc) - cvec_free(nsc); goto ok; } if (yang_keyword_get(y0) == Y_LEAF_LIST || yang_keyword_get(y0) == Y_LEAF){ @@ -1692,6 +1695,8 @@ xml_merge1(cxobj *x0, /* the target */ ok: retval = 1; done: + if (nsc) + cvec_free(nsc); if (twophase) free(twophase); if (cbr) diff --git a/test/test_augment.sh b/test/test_augment.sh index a96b28d9..93b4cd01 100755 --- a/test/test_augment.sh +++ b/test/test_augment.sh @@ -245,7 +245,7 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" " e2 mymod:some-new-iftype true - if:fddi + if:fddi " "" "" new "netconf validate ok" diff --git a/test/test_augment_state.sh b/test/test_augment_state.sh index fa8c4fd5..0692cb5a 100755 --- a/test/test_augment_state.sh +++ b/test/test_augment_state.sh @@ -155,7 +155,7 @@ cat < $fstate EOF EXPSTATE=$(cat <gbdsgads +gbdsgads EOF ) @@ -184,13 +184,13 @@ new "4. Empty config + optional state, expect global default + optional state" cat < $fstate gbos - gaos + gaos EOF # Note Expect gbds(default) + gbos(optional), the latter given by file above EXPSTATE=$(cat <gbdsgbosgadsgaos +gbdsgbosgadsgaos EOF ) @@ -209,7 +209,7 @@ cat < $fstate EOF EXPSTATE=$(cat <gbdsgadsalbdslads +gbdsgadsalbdslads EOF ) @@ -238,7 +238,7 @@ cat < $fstate EOF EXPSTATE=$(cat <gbdsgadsalbdslbosladslaos +gbdsgadsalbdslbosladslaos EOF ) diff --git a/test/test_copy_config.sh b/test/test_copy_config.sh index 12d7b749..87640215 100755 --- a/test/test_copy_config.sh +++ b/test/test_copy_config.sh @@ -129,7 +129,7 @@ new "wait restconf" wait_restconf new "Add config to candidate" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth/0/0if:fddinone " "" "" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth/0/0if:fddinone " "" "" new "netconf commit to running" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" @@ -153,10 +153,10 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" " # Here startup and candidate have content new "Check candidate content" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth/0/0if:fdditrue" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth/0/0if:fdditrue" new "Check startup content" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth/0/0if:fdditrue" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth/0/0if:fdditrue" new "Delete startup" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" @@ -169,8 +169,8 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" " new "copy candidate->startup" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" -new "Check startup content" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth/0/0if:fdditrue" +new "Check startup content xxx" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth/0/0if:fdditrue" new "Delete candidate" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth/0/0if:fddinone " "" "" @@ -184,7 +184,7 @@ new "copy startup->candidate" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" new "Check candidate content" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth/0/0if:fdditrue" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth/0/0if:fdditrue" # Negative test: check copying to running is not allowed new "Delete candidate" diff --git a/test/test_identity.sh b/test/test_identity.sh index 1bbdd540..7e07e2ab 100755 --- a/test/test_identity.sh +++ b/test/test_identity.sh @@ -89,6 +89,9 @@ module example-my-crypto { namespace "urn:example:my-crypto"; prefix mc; include "example-sub"; + import example-extra { + prefix ee; + } import "example-crypto-base" { prefix "crypto"; } @@ -215,19 +218,19 @@ new "netconf validate " expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" new "Set crypto to mc:aes" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "mc:aes" "" "" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "mc:aes" "" "" new "netconf validate" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" new "Set crypto to des:des3" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "des:des3" "" "" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "des:des3" "" "" new "netconf validate" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" new "Set crypto to mc:foo" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "mc:foo" "" "" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "mc:foo" "" "" new "netconf validate" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" @@ -247,11 +250,16 @@ new "netconf validate" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" fi # not supported -new "Set crypto to foo:bar" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "foo:bar" "" "" +if false; then + # This should run if remove IDENTITYREF_KLUDGE + new "Set crypto to foo:bar" + expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "foo:bar" "" "applicationinvalid-valueerroridentityref: \"foo:bar\": prefix \"foo\" has no associated namespace" -new "netconf validate (expect fail)" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "applicationoperation-failederrorIdentityref validation failed, foo:bar not derived from crypto-alg in example-crypto-base.yang:[0-9]*" "" + # Before foo:bar was accewpted but invalid here. Now it is catched in edit-config + new "netconf validate (expect fail)" + expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "applicationoperation-failederrorIdentityref validation failed, foo:bar not derived from crypto-alg in example-crypto-base.yang:[0-9]*" "" + +fi new "cli set crypto to mc:aes" expectpart "$($clixon_cli -1 -f $cfg -l o set crypto mc:aes)" 0 "^$" diff --git a/test/test_leafref.sh b/test/test_leafref.sh index 0d80d5cf..7e1070e5 100755 --- a/test/test_leafref.sh +++ b/test/test_leafref.sh @@ -88,7 +88,7 @@ module example{ EOF BASEXML=$(cat < + eth0 ex:eth diff --git a/test/test_netconf.sh b/test/test_netconf.sh index 96239b5f..b95aa69a 100755 --- a/test/test_netconf.sh +++ b/test/test_netconf.sh @@ -100,7 +100,7 @@ new "Check nothing added" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" new "Add subtree eth/0/0 using none and create which should add eth/0/0" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth/0/0ex:ethnone " "" "" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth/0/0ex:ethnone " "" "" # Too many quotes, (single inside double inside single) need to fool bash rpc=$(chunked_framing "") @@ -109,7 +109,7 @@ $DEFAULTHELLO$rpc EOF new "Check eth/0/0 added using xpath" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "$rpc" "" "eth/0/0ex:ethtrue" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "$rpc" "" "eth/0/0ex:ethtrue" new "Re-create same eth/0/0 which should generate error" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth/0/0ex:ethnone " "" "" @@ -164,7 +164,7 @@ new "netconf discard-changes" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" new "netconf edit config eth1" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth1ex:eth" "" "" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth1ex:eth" "" "" new "netconf validate" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" @@ -176,21 +176,21 @@ new "netconf commit using prefix xx" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" new "netconf edit config merge eth2" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth2ex:ethmerge" "" "" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth2ex:ethmerge" "" "" # Note, the type here is non-existant identityref, fails on validation new "netconf edit ampersand encoding(<&): name:'eth&' type:'t<>'" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth&t<>" "" "" new "netconf get replaced config" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth&t<>trueeth1ex:ethtrueeth2ex:ethtrue" +expecteof_netconf "$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_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth/0/0ex:eth" "" "" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "eth/0/0ex:eth" "" "" #new "netconf get CDATA" #expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth/0/0true" @@ -202,10 +202,10 @@ new "netconf edit state operation should fail" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "e0up" "" "applicationbad-elementoper-statuserrormodule ietf-interfaces: state data node unexpected" new "netconf get state operation" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth1ex:ethtrueup42foo" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth1ex:ethtrueup42foo" new "netconf get state operation use prefix xx" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth1ex:ethtrueup42foo" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth1ex:ethtrueup42foo" new "netconf lock" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" @@ -279,7 +279,7 @@ new "copy startup to candidate using prefix xx" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" new "netconf get startup" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth1ex:ethtrue" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eth1ex:ethtrue" new "netconf delete startup" expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "" diff --git a/test/test_openconfig_interfaces.sh b/test/test_openconfig_interfaces.sh index 00cbde53..98714da5 100755 --- a/test/test_openconfig_interfaces.sh +++ b/test/test_openconfig_interfaces.sh @@ -69,7 +69,7 @@ cat < $dir/startup_db e e - ex:eth + ex:eth false true @@ -103,7 +103,7 @@ new "$clixon_cli -D $DBG -1f $cfg show version" expectpart "$($clixon_cli -D $DBG -1f $cfg show version)" 0 "${CLIXON_VERSION}" new "$clixon_netconf -qf $cfg" -expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eeex:ethfalsetrue00" +expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" "" "" "eeex:ethfalsetrue00" new "cli show configuration" expectpart "$($clixon_cli -1 -f $cfg show conf xml)" 0 "^" --not-- "" @@ -153,10 +153,10 @@ cat < $dir/startup_db eth1 eth1 - ianaift:ethernetCsmacd + ianaift:ethernetCsmacd 9206 true - oc-vlan-types:TPID_0X8100 + oc-vlan-types:TPID_0X8100 diff --git a/test/test_openconfig_network_instance.sh b/test/test_openconfig_network_instance.sh index d9095729..3a543b51 100755 --- a/test/test_openconfig_network_instance.sh +++ b/test/test_openconfig_network_instance.sh @@ -79,7 +79,7 @@ cat < $dir/startup_db default - oc-ni-types:DEFAULT_INSTANCE + oc-ni-types:DEFAULT_INSTANCE true 1.2.3.4 diff --git a/test/test_startup.sh b/test/test_startup.sh index 1eb8918f..a90e5198 100755 --- a/test/test_startup.sh +++ b/test/test_startup.sh @@ -81,22 +81,22 @@ module ietf-interfaces { EOF # Create running-db containin the interface "run" OK -runvar='runif:fdditrue' +runvar='runif:fdditrue' # Create startup-db containing the interface "startup" OK -startvar='startupif:fdditrue' +startvar='startupif:fdditrue' # extra OK -extravar='extraif:fdditrue' +extravar='extraif:fdditrue' # invalid (contains ), but OK XML syntax -invalidvar='invalidif:fdditrue' +invalidvar='invalidif:fdditrue' # Broken XML (contains ) -brokenvar='brokenif:fdditrue' +brokenvar='brokenif:fdditrue' # Startup XML with state -statevar='startupupif:fdditrue' +statevar='startupupif:fdditrue' # Create a pre-set running, startup and (extra) config. # The configs are identified by an interface called run, startup, extra. @@ -204,10 +204,10 @@ testrun init "$runvar" "$startvar" "$extravar" "$extravar" testrun none "$runvar" "$startvar" "$extravar" "$runvar" # Running mode: keep running but load also extra -testrun running "$runvar" "$startvar" "$extravar" 'extraif:fdditruerunif:fdditrue' +testrun running "$runvar" "$startvar" "$extravar" 'extraif:fdditruerunif:fdditrue' # Startup mode: scratch running, load startup with extra on top -testrun startup "$runvar" "$startvar" "$extravar" 'extraif:fdditruestartupif:fdditrue' +testrun startup "$runvar" "$startvar" "$extravar" 'extraif:fdditruestartupif:fdditrue' # 2. Try different modes on Invalid running/startup/extra WITHOUT failsafe # ensure all db:s are unchanged after failure.