lib: all: remove './' from xpath 22% speedup

fixes #8299

Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
Christian Hopps 2023-11-29 14:37:23 -05:00
parent 4aff978cee
commit 2c01083d35
33 changed files with 534 additions and 534 deletions

View file

@ -219,24 +219,24 @@ static void _bfd_cli_show_peer(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults __attribute__((__unused__)), bool show_defaults __attribute__((__unused__)),
bool mhop) bool mhop)
{ {
const char *vrf = yang_dnode_get_string(dnode, "./vrf"); const char *vrf = yang_dnode_get_string(dnode, "vrf");
vty_out(vty, " peer %s", vty_out(vty, " peer %s",
yang_dnode_get_string(dnode, "./dest-addr")); yang_dnode_get_string(dnode, "dest-addr"));
if (mhop) if (mhop)
vty_out(vty, " multihop"); vty_out(vty, " multihop");
if (yang_dnode_exists(dnode, "./source-addr")) if (yang_dnode_exists(dnode, "source-addr"))
vty_out(vty, " local-address %s", vty_out(vty, " local-address %s",
yang_dnode_get_string(dnode, "./source-addr")); yang_dnode_get_string(dnode, "source-addr"));
if (strcmp(vrf, VRF_DEFAULT_NAME)) if (strcmp(vrf, VRF_DEFAULT_NAME))
vty_out(vty, " vrf %s", vrf); vty_out(vty, " vrf %s", vrf);
if (!mhop) { if (!mhop) {
const char *ifname = const char *ifname =
yang_dnode_get_string(dnode, "./interface"); yang_dnode_get_string(dnode, "interface");
if (strcmp(ifname, "*")) if (strcmp(ifname, "*"))
vty_out(vty, " interface %s", ifname); vty_out(vty, " interface %s", ifname);
} }
@ -567,7 +567,7 @@ DEFPY_YANG(no_bfd_profile, no_bfd_profile_cmd,
void bfd_cli_show_profile(struct vty *vty, const struct lyd_node *dnode, void bfd_cli_show_profile(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " profile %s\n", yang_dnode_get_string(dnode, "./name")); vty_out(vty, " profile %s\n", yang_dnode_get_string(dnode, "name"));
} }
ALIAS_YANG(bfd_peer_mult, bfd_profile_mult_cmd, ALIAS_YANG(bfd_peer_mult, bfd_profile_mult_cmd,

View file

@ -24,17 +24,17 @@ static void bfd_session_get_key(bool mhop, const struct lyd_node *dnode,
struct sockaddr_any psa, lsa; struct sockaddr_any psa, lsa;
/* Required destination parameter. */ /* Required destination parameter. */
strtosa(yang_dnode_get_string(dnode, "./dest-addr"), &psa); strtosa(yang_dnode_get_string(dnode, "dest-addr"), &psa);
/* Get optional source address. */ /* Get optional source address. */
memset(&lsa, 0, sizeof(lsa)); memset(&lsa, 0, sizeof(lsa));
if (yang_dnode_exists(dnode, "./source-addr")) if (yang_dnode_exists(dnode, "source-addr"))
strtosa(yang_dnode_get_string(dnode, "./source-addr"), &lsa); strtosa(yang_dnode_get_string(dnode, "source-addr"), &lsa);
vrfname = yang_dnode_get_string(dnode, "./vrf"); vrfname = yang_dnode_get_string(dnode, "vrf");
if (!mhop) { if (!mhop) {
ifname = yang_dnode_get_string(dnode, "./interface"); ifname = yang_dnode_get_string(dnode, "interface");
if (strcmp(ifname, "*") == 0) if (strcmp(ifname, "*") == 0)
ifname = NULL; ifname = NULL;
} }
@ -53,7 +53,7 @@ static int session_iter_cb(const struct lyd_node *dnode, void *arg)
struct session_iter *iter = arg; struct session_iter *iter = arg;
const char *ifname; const char *ifname;
ifname = yang_dnode_get_string(dnode, "./interface"); ifname = yang_dnode_get_string(dnode, "interface");
if (strmatch(ifname, "*")) if (strmatch(ifname, "*"))
iter->wildcard = true; iter->wildcard = true;
@ -76,7 +76,7 @@ static int bfd_session_create(struct nb_cb_create_args *args, bool mhop)
switch (args->event) { switch (args->event) {
case NB_EV_VALIDATE: case NB_EV_VALIDATE:
yang_dnode_get_prefix(&p, args->dnode, "./dest-addr"); yang_dnode_get_prefix(&p, args->dnode, "dest-addr");
if (mhop) { if (mhop) {
/* /*
@ -97,7 +97,7 @@ static int bfd_session_create(struct nb_cb_create_args *args, bool mhop)
* require interface name, otherwise we can't figure * require interface name, otherwise we can't figure
* which interface to use to send the packets. * which interface to use to send the packets.
*/ */
ifname = yang_dnode_get_string(args->dnode, "./interface"); ifname = yang_dnode_get_string(args->dnode, "interface");
if (p.family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&p.u.prefix6) if (p.family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&p.u.prefix6)
&& strcmp(ifname, "*") == 0) { && strcmp(ifname, "*") == 0) {
@ -112,8 +112,8 @@ static int bfd_session_create(struct nb_cb_create_args *args, bool mhop)
sess_dnode = yang_dnode_get_parent(args->dnode, "sessions"); sess_dnode = yang_dnode_get_parent(args->dnode, "sessions");
dest = yang_dnode_get_string(args->dnode, "./dest-addr"); dest = yang_dnode_get_string(args->dnode, "dest-addr");
vrfname = yang_dnode_get_string(args->dnode, "./vrf"); vrfname = yang_dnode_get_string(args->dnode, "vrf");
yang_dnode_iterate(session_iter_cb, &iter, sess_dnode, yang_dnode_iterate(session_iter_cb, &iter, sess_dnode,
"./single-hop[dest-addr='%s'][vrf='%s']", "./single-hop[dest-addr='%s'][vrf='%s']",
@ -275,7 +275,7 @@ int bfdd_bfd_profile_create(struct nb_cb_create_args *args)
if (args->event != NB_EV_APPLY) if (args->event != NB_EV_APPLY)
return NB_OK; return NB_OK;
name = yang_dnode_get_string(args->dnode, "./name"); name = yang_dnode_get_string(args->dnode, "name");
bp = bfd_profile_new(name); bp = bfd_profile_new(name);
nb_running_set_entry(args->dnode, bp); nb_running_set_entry(args->dnode, bp);

View file

@ -1135,14 +1135,14 @@ lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish(
/* Add configuration. */ /* Add configuration. */
rhc = nb_running_get_entry(args->dnode, NULL, true); rhc = nb_running_get_entry(args->dnode, NULL, true);
value = yang_dnode_get_string(args->dnode, "./comm-list-name"); value = yang_dnode_get_string(args->dnode, "comm-list-name");
if (yang_dnode_exists(args->dnode, "./comm-list-name-exact-match")) if (yang_dnode_exists(args->dnode, "comm-list-name-exact-match"))
exact_match = yang_dnode_get_bool( exact_match = yang_dnode_get_bool(
args->dnode, "./comm-list-name-exact-match"); args->dnode, "./comm-list-name-exact-match");
if (yang_dnode_exists(args->dnode, "./comm-list-name-any")) if (yang_dnode_exists(args->dnode, "comm-list-name-any"))
any = yang_dnode_get_bool(args->dnode, "./comm-list-name-any"); any = yang_dnode_get_bool(args->dnode, "comm-list-name-any");
if (exact_match) { if (exact_match) {
argstr = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, argstr = XMALLOC(MTYPE_ROUTE_MAP_COMPILED,
@ -2745,8 +2745,8 @@ void lib_route_map_entry_set_action_rmap_set_action_aggregator_finish(
/* Add configuration. */ /* Add configuration. */
rhc = nb_running_get_entry(args->dnode, NULL, true); rhc = nb_running_get_entry(args->dnode, NULL, true);
asn = yang_dnode_get_string(args->dnode, "./aggregator-asn"); asn = yang_dnode_get_string(args->dnode, "aggregator-asn");
addr = yang_dnode_get_string(args->dnode, "./aggregator-address"); addr = yang_dnode_get_string(args->dnode, "aggregator-address");
argstr = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, argstr = XMALLOC(MTYPE_ROUTE_MAP_COMPILED,
strlen(asn) + strlen(addr) + 2); strlen(asn) + strlen(addr) + 2);
@ -2929,7 +2929,7 @@ lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_finish(
/* Add configuration. */ /* Add configuration. */
rhc = nb_running_get_entry(args->dnode, NULL, true); rhc = nb_running_get_entry(args->dnode, NULL, true);
lb_type = yang_dnode_get_enum(args->dnode, "./lb-type"); lb_type = yang_dnode_get_enum(args->dnode, "lb-type");
/* Set destroy information. */ /* Set destroy information. */
rhc->rhc_shook = generic_set_delete; rhc->rhc_shook = generic_set_delete;
@ -2938,7 +2938,7 @@ lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_finish(
switch (lb_type) { switch (lb_type) {
case EXPLICIT_BANDWIDTH: case EXPLICIT_BANDWIDTH:
bandwidth = yang_dnode_get_uint16(args->dnode, "./bandwidth"); bandwidth = yang_dnode_get_uint16(args->dnode, "bandwidth");
snprintf(str, sizeof(str), "%d", bandwidth); snprintf(str, sizeof(str), "%d", bandwidth);
break; break;
case CUMULATIVE_BANDWIDTH: case CUMULATIVE_BANDWIDTH:
@ -2948,7 +2948,7 @@ lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_finish(
snprintf(str, sizeof(str), "%s", "num-multipaths"); snprintf(str, sizeof(str), "%s", "num-multipaths");
} }
if (yang_dnode_get_bool(args->dnode, "./two-octet-as-specific")) if (yang_dnode_get_bool(args->dnode, "two-octet-as-specific"))
strlcat(str, " non-transitive", sizeof(str)); strlcat(str, " non-transitive", sizeof(str));
ret = generic_set_add(rhc->rhc_rmi, "extcommunity bandwidth", str, ret = generic_set_add(rhc->rhc_rmi, "extcommunity bandwidth", str,

View file

@ -69,8 +69,8 @@ DEFPY_YANG(
void eigrp_cli_show_header(struct vty *vty, const struct lyd_node *dnode, void eigrp_cli_show_header(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *asn = yang_dnode_get_string(dnode, "./asn"); const char *asn = yang_dnode_get_string(dnode, "asn");
const char *vrf = yang_dnode_get_string(dnode, "./vrf"); const char *vrf = yang_dnode_get_string(dnode, "vrf");
vty_out(vty, "router eigrp %s", asn); vty_out(vty, "router eigrp %s", asn);
if (strcmp(vrf, VRF_DEFAULT_NAME)) if (strcmp(vrf, VRF_DEFAULT_NAME))
@ -323,18 +323,18 @@ void eigrp_cli_show_metrics(struct vty *vty, const struct lyd_node *dnode,
{ {
const char *k1, *k2, *k3, *k4, *k5, *k6; const char *k1, *k2, *k3, *k4, *k5, *k6;
k1 = yang_dnode_exists(dnode, "./K1") ? k1 = yang_dnode_exists(dnode, "K1") ?
yang_dnode_get_string(dnode, "./K1") : "0"; yang_dnode_get_string(dnode, "K1") : "0";
k2 = yang_dnode_exists(dnode, "./K2") ? k2 = yang_dnode_exists(dnode, "K2") ?
yang_dnode_get_string(dnode, "./K2") : "0"; yang_dnode_get_string(dnode, "K2") : "0";
k3 = yang_dnode_exists(dnode, "./K3") ? k3 = yang_dnode_exists(dnode, "K3") ?
yang_dnode_get_string(dnode, "./K3") : "0"; yang_dnode_get_string(dnode, "K3") : "0";
k4 = yang_dnode_exists(dnode, "./K4") ? k4 = yang_dnode_exists(dnode, "K4") ?
yang_dnode_get_string(dnode, "./K4") : "0"; yang_dnode_get_string(dnode, "K4") : "0";
k5 = yang_dnode_exists(dnode, "./K5") ? k5 = yang_dnode_exists(dnode, "K5") ?
yang_dnode_get_string(dnode, "./K5") : "0"; yang_dnode_get_string(dnode, "K5") : "0";
k6 = yang_dnode_exists(dnode, "./K6") ? k6 = yang_dnode_exists(dnode, "K6") ?
yang_dnode_get_string(dnode, "./K6") : "0"; yang_dnode_get_string(dnode, "K6") : "0";
vty_out(vty, " metric weights %s %s %s %s %s", vty_out(vty, " metric weights %s %s %s %s %s",
k1, k2, k3, k4, k5); k1, k2, k3, k4, k5);
@ -456,19 +456,19 @@ DEFPY_YANG(
void eigrp_cli_show_redistribute(struct vty *vty, const struct lyd_node *dnode, void eigrp_cli_show_redistribute(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *proto = yang_dnode_get_string(dnode, "./protocol"); const char *proto = yang_dnode_get_string(dnode, "protocol");
const char *bw, *delay, *load, *mtu, *rlbt; const char *bw, *delay, *load, *mtu, *rlbt;
bw = yang_dnode_exists(dnode, "./metrics/bandwidth") ? bw = yang_dnode_exists(dnode, "metrics/bandwidth") ?
yang_dnode_get_string(dnode, "./metrics/bandwidth") : NULL; yang_dnode_get_string(dnode, "metrics/bandwidth") : NULL;
delay = yang_dnode_exists(dnode, "./metrics/delay") ? delay = yang_dnode_exists(dnode, "metrics/delay") ?
yang_dnode_get_string(dnode, "./metrics/delay") : NULL; yang_dnode_get_string(dnode, "metrics/delay") : NULL;
rlbt = yang_dnode_exists(dnode, "./metrics/reliability") ? rlbt = yang_dnode_exists(dnode, "metrics/reliability") ?
yang_dnode_get_string(dnode, "./metrics/reliability") : NULL; yang_dnode_get_string(dnode, "metrics/reliability") : NULL;
load = yang_dnode_exists(dnode, "./metrics/load") ? load = yang_dnode_exists(dnode, "metrics/load") ?
yang_dnode_get_string(dnode, "./metrics/load") : NULL; yang_dnode_get_string(dnode, "metrics/load") : NULL;
mtu = yang_dnode_exists(dnode, "./metrics/mtu") ? mtu = yang_dnode_exists(dnode, "metrics/mtu") ?
yang_dnode_get_string(dnode, "./metrics/mtu") : NULL; yang_dnode_get_string(dnode, "metrics/mtu") : NULL;
vty_out(vty, " redistribute %s", proto); vty_out(vty, " redistribute %s", proto);
if (bw || rlbt || delay || load || mtu) if (bw || rlbt || delay || load || mtu)
@ -693,7 +693,7 @@ void eigrp_cli_show_summarize_address(struct vty *vty,
{ {
const struct lyd_node *instance = const struct lyd_node *instance =
yang_dnode_get_parent(dnode, "instance"); yang_dnode_get_parent(dnode, "instance");
uint16_t asn = yang_dnode_get_uint16(instance, "./asn"); uint16_t asn = yang_dnode_get_uint16(instance, "asn");
const char *summarize_address = yang_dnode_get_string(dnode, NULL); const char *summarize_address = yang_dnode_get_string(dnode, NULL);
vty_out(vty, " ip summary-address eigrp %d %s\n", asn, vty_out(vty, " ip summary-address eigrp %d %s\n", asn,
@ -759,7 +759,7 @@ void eigrp_cli_show_authentication(struct vty *vty,
{ {
const struct lyd_node *instance = const struct lyd_node *instance =
yang_dnode_get_parent(dnode, "instance"); yang_dnode_get_parent(dnode, "instance");
uint16_t asn = yang_dnode_get_uint16(instance, "./asn"); uint16_t asn = yang_dnode_get_uint16(instance, "asn");
const char *crypt = yang_dnode_get_string(dnode, NULL); const char *crypt = yang_dnode_get_string(dnode, NULL);
vty_out(vty, " ip authentication mode eigrp %d %s\n", asn, crypt); vty_out(vty, " ip authentication mode eigrp %d %s\n", asn, crypt);
@ -819,7 +819,7 @@ void eigrp_cli_show_keychain(struct vty *vty, const struct lyd_node *dnode,
{ {
const struct lyd_node *instance = const struct lyd_node *instance =
yang_dnode_get_parent(dnode, "instance"); yang_dnode_get_parent(dnode, "instance");
uint16_t asn = yang_dnode_get_uint16(instance, "./asn"); uint16_t asn = yang_dnode_get_uint16(instance, "asn");
const char *keychain = yang_dnode_get_string(dnode, NULL); const char *keychain = yang_dnode_get_string(dnode, NULL);
vty_out(vty, " ip authentication key-chain eigrp %d %s\n", asn, vty_out(vty, " ip authentication key-chain eigrp %d %s\n", asn,

View file

@ -28,18 +28,18 @@ static void redistribute_get_metrics(const struct lyd_node *dnode,
{ {
memset(em, 0, sizeof(*em)); memset(em, 0, sizeof(*em));
if (yang_dnode_exists(dnode, "./bandwidth")) if (yang_dnode_exists(dnode, "bandwidth"))
em->bandwidth = yang_dnode_get_uint32(dnode, "./bandwidth"); em->bandwidth = yang_dnode_get_uint32(dnode, "bandwidth");
if (yang_dnode_exists(dnode, "./delay")) if (yang_dnode_exists(dnode, "delay"))
em->delay = yang_dnode_get_uint32(dnode, "./delay"); em->delay = yang_dnode_get_uint32(dnode, "delay");
#if 0 /* TODO: How does MTU work? */ #if 0 /* TODO: How does MTU work? */
if (yang_dnode_exists(dnode, "./mtu")) if (yang_dnode_exists(dnode, "mtu"))
em->mtu[0] = yang_dnode_get_uint32(dnode, "./mtu"); em->mtu[0] = yang_dnode_get_uint32(dnode, "mtu");
#endif #endif
if (yang_dnode_exists(dnode, "./load")) if (yang_dnode_exists(dnode, "load"))
em->load = yang_dnode_get_uint32(dnode, "./load"); em->load = yang_dnode_get_uint32(dnode, "load");
if (yang_dnode_exists(dnode, "./reliability")) if (yang_dnode_exists(dnode, "reliability"))
em->reliability = yang_dnode_get_uint32(dnode, "./reliability"); em->reliability = yang_dnode_get_uint32(dnode, "reliability");
} }
static struct eigrp_interface *eigrp_interface_lookup(const struct eigrp *eigrp, static struct eigrp_interface *eigrp_interface_lookup(const struct eigrp *eigrp,
@ -73,7 +73,7 @@ static int eigrpd_instance_create(struct nb_cb_create_args *args)
/* NOTHING */ /* NOTHING */
break; break;
case NB_EV_PREPARE: case NB_EV_PREPARE:
vrf = yang_dnode_get_string(args->dnode, "./vrf"); vrf = yang_dnode_get_string(args->dnode, "vrf");
pVrf = vrf_lookup_by_name(vrf); pVrf = vrf_lookup_by_name(vrf);
if (pVrf) if (pVrf)
@ -81,7 +81,7 @@ static int eigrpd_instance_create(struct nb_cb_create_args *args)
else else
vrfid = VRF_DEFAULT; vrfid = VRF_DEFAULT;
eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "./asn"), eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "asn"),
vrfid); vrfid);
args->resource->ptr = eigrp; args->resource->ptr = eigrp;
break; break;
@ -715,7 +715,7 @@ static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args)
switch (args->event) { switch (args->event) {
case NB_EV_VALIDATE: case NB_EV_VALIDATE:
proto = yang_dnode_get_enum(args->dnode, "./protocol"); proto = yang_dnode_get_enum(args->dnode, "protocol");
vrfname = yang_dnode_get_string(args->dnode, "../vrf"); vrfname = yang_dnode_get_string(args->dnode, "../vrf");
pVrf = vrf_lookup_by_name(vrfname); pVrf = vrf_lookup_by_name(vrfname);
@ -733,7 +733,7 @@ static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args)
break; break;
case NB_EV_APPLY: case NB_EV_APPLY:
eigrp = nb_running_get_entry(args->dnode, NULL, true); eigrp = nb_running_get_entry(args->dnode, NULL, true);
proto = yang_dnode_get_enum(args->dnode, "./protocol"); proto = yang_dnode_get_enum(args->dnode, "protocol");
redistribute_get_metrics(args->dnode, &metrics); redistribute_get_metrics(args->dnode, &metrics);
eigrp_redistribute_set(eigrp, proto, metrics); eigrp_redistribute_set(eigrp, proto, metrics);
break; break;
@ -755,7 +755,7 @@ static int eigrpd_instance_redistribute_destroy(struct nb_cb_destroy_args *args)
break; break;
case NB_EV_APPLY: case NB_EV_APPLY:
eigrp = nb_running_get_entry(args->dnode, NULL, true); eigrp = nb_running_get_entry(args->dnode, NULL, true);
proto = yang_dnode_get_enum(args->dnode, "./protocol"); proto = yang_dnode_get_enum(args->dnode, "protocol");
eigrp_redistribute_unset(eigrp, proto); eigrp_redistribute_unset(eigrp, proto);
break; break;
} }
@ -1120,7 +1120,7 @@ static int lib_interface_eigrp_instance_create(struct nb_cb_create_args *args)
break; break;
} }
eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "./asn"), eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "asn"),
ifp->vrf->vrf_id); ifp->vrf->vrf_id);
eif = eigrp_interface_lookup(eigrp, ifp->name); eif = eigrp_interface_lookup(eigrp, ifp->name);
if (eif == NULL) if (eif == NULL)
@ -1132,7 +1132,7 @@ static int lib_interface_eigrp_instance_create(struct nb_cb_create_args *args)
break; break;
case NB_EV_APPLY: case NB_EV_APPLY:
ifp = nb_running_get_entry(args->dnode, NULL, true); ifp = nb_running_get_entry(args->dnode, NULL, true);
eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "./asn"), eigrp = eigrp_get(yang_dnode_get_uint16(args->dnode, "asn"),
ifp->vrf->vrf_id); ifp->vrf->vrf_id);
eif = eigrp_interface_lookup(eigrp, ifp->name); eif = eigrp_interface_lookup(eigrp, ifp->name);
if (eif == NULL) if (eif == NULL)

View file

@ -85,13 +85,13 @@ void cli_show_router_isis(struct vty *vty, const struct lyd_node *dnode,
{ {
const char *vrf = NULL; const char *vrf = NULL;
vrf = yang_dnode_get_string(dnode, "./vrf"); vrf = yang_dnode_get_string(dnode, "vrf");
vty_out(vty, "!\n"); vty_out(vty, "!\n");
vty_out(vty, "router isis %s", vty_out(vty, "router isis %s",
yang_dnode_get_string(dnode, "./area-tag")); yang_dnode_get_string(dnode, "area-tag"));
if (!strmatch(vrf, VRF_DEFAULT_NAME)) if (!strmatch(vrf, VRF_DEFAULT_NAME))
vty_out(vty, " vrf %s", yang_dnode_get_string(dnode, "./vrf")); vty_out(vty, " vrf %s", yang_dnode_get_string(dnode, "vrf"));
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -172,7 +172,7 @@ DEFPY_YANG(no_ip_router_isis, no_ip_router_isis_cmd,
* If both ipv4 and ipv6 are off delete the interface isis container. * If both ipv4 and ipv6 are off delete the interface isis container.
*/ */
if (strmatch(ip, "ipv6")) { if (strmatch(ip, "ipv6")) {
if (!yang_dnode_get_bool(dnode, "./ipv4-routing")) if (!yang_dnode_get_bool(dnode, "ipv4-routing"))
nb_cli_enqueue_change(vty, "./frr-isisd:isis", nb_cli_enqueue_change(vty, "./frr-isisd:isis",
NB_OP_DESTROY, NULL); NB_OP_DESTROY, NULL);
else else
@ -180,7 +180,7 @@ DEFPY_YANG(no_ip_router_isis, no_ip_router_isis_cmd,
"./frr-isisd:isis/ipv6-routing", "./frr-isisd:isis/ipv6-routing",
NB_OP_MODIFY, "false"); NB_OP_MODIFY, "false");
} else { } else {
if (!yang_dnode_get_bool(dnode, "./ipv6-routing")) if (!yang_dnode_get_bool(dnode, "ipv6-routing"))
nb_cli_enqueue_change(vty, "./frr-isisd:isis", nb_cli_enqueue_change(vty, "./frr-isisd:isis",
NB_OP_DESTROY, NULL); NB_OP_DESTROY, NULL);
else else
@ -280,16 +280,16 @@ void cli_show_ip_isis_bfd_monitoring(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
if (!yang_dnode_get_bool(dnode, "./enabled")) { if (!yang_dnode_get_bool(dnode, "enabled")) {
if (show_defaults) if (show_defaults)
vty_out(vty, " no isis bfd\n"); vty_out(vty, " no isis bfd\n");
} else { } else {
vty_out(vty, " isis bfd\n"); vty_out(vty, " isis bfd\n");
} }
if (yang_dnode_exists(dnode, "./profile")) if (yang_dnode_exists(dnode, "profile"))
vty_out(vty, " isis bfd profile %s\n", vty_out(vty, " isis bfd profile %s\n",
yang_dnode_get_string(dnode, "./profile")); yang_dnode_get_string(dnode, "profile"));
} }
/* /*
@ -588,9 +588,9 @@ void cli_show_isis_area_pwd(struct vty *vty, const struct lyd_node *dnode,
const char *snp; const char *snp;
vty_out(vty, " area-password %s %s", vty_out(vty, " area-password %s %s",
yang_dnode_get_string(dnode, "./password-type"), yang_dnode_get_string(dnode, "password-type"),
yang_dnode_get_string(dnode, "./password")); yang_dnode_get_string(dnode, "password"));
snp = yang_dnode_get_string(dnode, "./authenticate-snp"); snp = yang_dnode_get_string(dnode, "authenticate-snp");
if (!strmatch("none", snp)) if (!strmatch("none", snp))
vty_out(vty, " authenticate snp %s", snp); vty_out(vty, " authenticate snp %s", snp);
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -638,9 +638,9 @@ void cli_show_isis_domain_pwd(struct vty *vty, const struct lyd_node *dnode,
const char *snp; const char *snp;
vty_out(vty, " domain-password %s %s", vty_out(vty, " domain-password %s %s",
yang_dnode_get_string(dnode, "./password-type"), yang_dnode_get_string(dnode, "password-type"),
yang_dnode_get_string(dnode, "./password")); yang_dnode_get_string(dnode, "password"));
snp = yang_dnode_get_string(dnode, "./authenticate-snp"); snp = yang_dnode_get_string(dnode, "authenticate-snp");
if (!strmatch("none", snp)) if (!strmatch("none", snp))
vty_out(vty, " authenticate snp %s", snp); vty_out(vty, " authenticate snp %s", snp);
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -861,17 +861,17 @@ void cli_show_isis_lsp_timers(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *l1_refresh = const char *l1_refresh =
yang_dnode_get_string(dnode, "./level-1/refresh-interval"); yang_dnode_get_string(dnode, "level-1/refresh-interval");
const char *l2_refresh = const char *l2_refresh =
yang_dnode_get_string(dnode, "./level-2/refresh-interval"); yang_dnode_get_string(dnode, "level-2/refresh-interval");
const char *l1_lifetime = const char *l1_lifetime =
yang_dnode_get_string(dnode, "./level-1/maximum-lifetime"); yang_dnode_get_string(dnode, "level-1/maximum-lifetime");
const char *l2_lifetime = const char *l2_lifetime =
yang_dnode_get_string(dnode, "./level-2/maximum-lifetime"); yang_dnode_get_string(dnode, "level-2/maximum-lifetime");
const char *l1_gen = const char *l1_gen =
yang_dnode_get_string(dnode, "./level-1/generation-interval"); yang_dnode_get_string(dnode, "level-1/generation-interval");
const char *l2_gen = const char *l2_gen =
yang_dnode_get_string(dnode, "./level-2/generation-interval"); yang_dnode_get_string(dnode, "level-2/generation-interval");
if (strmatch(l1_refresh, l2_refresh) if (strmatch(l1_refresh, l2_refresh)
&& strmatch(l1_lifetime, l2_lifetime) && strmatch(l1_gen, l2_gen)) && strmatch(l1_lifetime, l2_lifetime) && strmatch(l1_gen, l2_gen))
vty_out(vty, vty_out(vty,
@ -980,8 +980,8 @@ void cli_show_isis_spf_min_interval(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *l1 = yang_dnode_get_string(dnode, "./level-1"); const char *l1 = yang_dnode_get_string(dnode, "level-1");
const char *l2 = yang_dnode_get_string(dnode, "./level-2"); const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2)) if (strmatch(l1, l2))
vty_out(vty, " spf-interval %s\n", l1); vty_out(vty, " spf-interval %s\n", l1);
@ -1051,11 +1051,11 @@ void cli_show_isis_spf_ietf_backoff(struct vty *vty,
{ {
vty_out(vty, vty_out(vty,
" spf-delay-ietf init-delay %s short-delay %s long-delay %s holddown %s time-to-learn %s\n", " spf-delay-ietf init-delay %s short-delay %s long-delay %s holddown %s time-to-learn %s\n",
yang_dnode_get_string(dnode, "./init-delay"), yang_dnode_get_string(dnode, "init-delay"),
yang_dnode_get_string(dnode, "./short-delay"), yang_dnode_get_string(dnode, "short-delay"),
yang_dnode_get_string(dnode, "./long-delay"), yang_dnode_get_string(dnode, "long-delay"),
yang_dnode_get_string(dnode, "./hold-down"), yang_dnode_get_string(dnode, "hold-down"),
yang_dnode_get_string(dnode, "./time-to-learn")); yang_dnode_get_string(dnode, "time-to-learn"));
} }
/* /*
@ -1364,15 +1364,15 @@ static void vty_print_def_origin(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " default-information originate %s %s", family, level); vty_out(vty, " default-information originate %s %s", family, level);
if (yang_dnode_get_bool(dnode, "./always")) if (yang_dnode_get_bool(dnode, "always"))
vty_out(vty, " always"); vty_out(vty, " always");
if (yang_dnode_exists(dnode, "./route-map")) if (yang_dnode_exists(dnode, "route-map"))
vty_out(vty, " route-map %s", vty_out(vty, " route-map %s",
yang_dnode_get_string(dnode, "./route-map")); yang_dnode_get_string(dnode, "route-map"));
if (show_defaults || !yang_dnode_is_default(dnode, "./metric")) if (show_defaults || !yang_dnode_is_default(dnode, "metric"))
vty_out(vty, " metric %s", vty_out(vty, " metric %s",
yang_dnode_get_string(dnode, "./metric")); yang_dnode_get_string(dnode, "metric"));
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -1381,7 +1381,7 @@ void cli_show_isis_def_origin_ipv4(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *level = yang_dnode_get_string(dnode, "./level"); const char *level = yang_dnode_get_string(dnode, "level");
vty_print_def_origin(vty, dnode, "ipv4", level, show_defaults); vty_print_def_origin(vty, dnode, "ipv4", level, show_defaults);
} }
@ -1390,7 +1390,7 @@ void cli_show_isis_def_origin_ipv6(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *level = yang_dnode_get_string(dnode, "./level"); const char *level = yang_dnode_get_string(dnode, "level");
vty_print_def_origin(vty, dnode, "ipv6", level, show_defaults); vty_print_def_origin(vty, dnode, "ipv6", level, show_defaults);
} }
@ -1505,22 +1505,22 @@ static void vty_print_redistribute(struct vty *vty, const struct lyd_node *dnode
if (table) { if (table) {
level = yang_dnode_get_string(dnode, "../level"); level = yang_dnode_get_string(dnode, "../level");
tableid = yang_dnode_get_uint16(dnode, "./table"); tableid = yang_dnode_get_uint16(dnode, "table");
vty_out(vty, " redistribute %s table %d ", family, tableid); vty_out(vty, " redistribute %s table %d ", family, tableid);
} else { } else {
protocol = yang_dnode_get_string(dnode, "./protocol"); protocol = yang_dnode_get_string(dnode, "protocol");
if (!table && strmatch(protocol, "table")) if (!table && strmatch(protocol, "table"))
return; return;
level = yang_dnode_get_string(dnode, "./level"); level = yang_dnode_get_string(dnode, "level");
vty_out(vty, " redistribute %s %s ", family, protocol); vty_out(vty, " redistribute %s %s ", family, protocol);
} }
vty_out(vty, "%s", level); vty_out(vty, "%s", level);
if (show_defaults || !yang_dnode_is_default(dnode, "./metric")) if (show_defaults || !yang_dnode_is_default(dnode, "metric"))
vty_out(vty, " metric %s", vty_out(vty, " metric %s",
yang_dnode_get_string(dnode, "%s", "./metric")); yang_dnode_get_string(dnode, "%s", "metric"));
if (yang_dnode_exists(dnode, "./route-map")) if (yang_dnode_exists(dnode, "route-map"))
routemap = yang_dnode_get_string(dnode, "./route-map"); routemap = yang_dnode_get_string(dnode, "route-map");
if (routemap) if (routemap)
vty_out(vty, " route-map %s", routemap); vty_out(vty, " route-map %s", routemap);
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -1557,8 +1557,8 @@ void cli_show_isis_redistribute_ipv6_table(struct vty *vty,
int cli_cmp_isis_redistribute_table(const struct lyd_node *dnode1, int cli_cmp_isis_redistribute_table(const struct lyd_node *dnode1,
const struct lyd_node *dnode2) const struct lyd_node *dnode2)
{ {
uint16_t table1 = yang_dnode_get_uint16(dnode1, "./table"); uint16_t table1 = yang_dnode_get_uint16(dnode1, "table");
uint16_t table2 = yang_dnode_get_uint16(dnode2, "./table"); uint16_t table2 = yang_dnode_get_uint16(dnode2, "table");
return table1 - table2; return table1 - table2;
} }
@ -1619,7 +1619,7 @@ void cli_show_isis_mt_ipv4_multicast(struct vty *vty,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " topology ipv4-multicast"); vty_out(vty, " topology ipv4-multicast");
if (yang_dnode_get_bool(dnode, "./overload")) if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload"); vty_out(vty, " overload");
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -1628,7 +1628,7 @@ void cli_show_isis_mt_ipv4_mgmt(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " topology ipv4-mgmt"); vty_out(vty, " topology ipv4-mgmt");
if (yang_dnode_get_bool(dnode, "./overload")) if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload"); vty_out(vty, " overload");
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -1638,7 +1638,7 @@ void cli_show_isis_mt_ipv6_unicast(struct vty *vty,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " topology ipv6-unicast"); vty_out(vty, " topology ipv6-unicast");
if (yang_dnode_get_bool(dnode, "./overload")) if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload"); vty_out(vty, " overload");
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -1648,7 +1648,7 @@ void cli_show_isis_mt_ipv6_multicast(struct vty *vty,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " topology ipv6-multicast"); vty_out(vty, " topology ipv6-multicast");
if (yang_dnode_get_bool(dnode, "./overload")) if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload"); vty_out(vty, " overload");
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -1657,7 +1657,7 @@ void cli_show_isis_mt_ipv6_mgmt(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " topology ipv6-mgmt"); vty_out(vty, " topology ipv6-mgmt");
if (yang_dnode_get_bool(dnode, "./overload")) if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload"); vty_out(vty, " overload");
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -1666,7 +1666,7 @@ void cli_show_isis_mt_ipv6_dstsrc(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " topology ipv6-dstsrc"); vty_out(vty, " topology ipv6-dstsrc");
if (yang_dnode_get_bool(dnode, "./overload")) if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload"); vty_out(vty, " overload");
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -1771,13 +1771,13 @@ void cli_show_isis_label_blocks(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " segment-routing global-block %s %s", vty_out(vty, " segment-routing global-block %s %s",
yang_dnode_get_string(dnode, "./srgb/lower-bound"), yang_dnode_get_string(dnode, "srgb/lower-bound"),
yang_dnode_get_string(dnode, "./srgb/upper-bound")); yang_dnode_get_string(dnode, "srgb/upper-bound"));
if (!yang_dnode_is_default(dnode, "./srlb/lower-bound") if (!yang_dnode_is_default(dnode, "srlb/lower-bound")
|| !yang_dnode_is_default(dnode, "./srlb/upper-bound")) || !yang_dnode_is_default(dnode, "srlb/upper-bound"))
vty_out(vty, " local-block %s %s", vty_out(vty, " local-block %s %s",
yang_dnode_get_string(dnode, "./srlb/lower-bound"), yang_dnode_get_string(dnode, "srlb/lower-bound"),
yang_dnode_get_string(dnode, "./srlb/upper-bound")); yang_dnode_get_string(dnode, "srlb/upper-bound"));
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -1899,11 +1899,11 @@ void cli_show_isis_prefix_sid(struct vty *vty, const struct lyd_node *dnode,
const char *sid_value; const char *sid_value;
bool n_flag_clear; bool n_flag_clear;
prefix = yang_dnode_get_string(dnode, "./prefix"); prefix = yang_dnode_get_string(dnode, "prefix");
lh_behavior = yang_dnode_get_string(dnode, "./last-hop-behavior"); lh_behavior = yang_dnode_get_string(dnode, "last-hop-behavior");
sid_value_type = yang_dnode_get_string(dnode, "./sid-value-type"); sid_value_type = yang_dnode_get_string(dnode, "sid-value-type");
sid_value = yang_dnode_get_string(dnode, "./sid-value"); sid_value = yang_dnode_get_string(dnode, "sid-value");
n_flag_clear = yang_dnode_get_bool(dnode, "./n-flag-clear"); n_flag_clear = yang_dnode_get_bool(dnode, "n-flag-clear");
vty_out(vty, " segment-routing prefix %s", prefix); vty_out(vty, " segment-routing prefix %s", prefix);
if (strmatch(sid_value_type, "absolute")) if (strmatch(sid_value_type, "absolute"))
@ -2013,12 +2013,12 @@ void cli_show_isis_prefix_sid_algorithm(struct vty *vty,
bool n_flag_clear; bool n_flag_clear;
uint32_t algorithm; uint32_t algorithm;
prefix = yang_dnode_get_string(dnode, "./prefix"); prefix = yang_dnode_get_string(dnode, "prefix");
sid_value_type = yang_dnode_get_string(dnode, "./sid-value-type"); sid_value_type = yang_dnode_get_string(dnode, "sid-value-type");
sid_value = yang_dnode_get_string(dnode, "./sid-value"); sid_value = yang_dnode_get_string(dnode, "sid-value");
algorithm = yang_dnode_get_uint32(dnode, "./algo"); algorithm = yang_dnode_get_uint32(dnode, "algo");
lh_behavior = yang_dnode_get_string(dnode, "./last-hop-behavior"); lh_behavior = yang_dnode_get_string(dnode, "last-hop-behavior");
n_flag_clear = yang_dnode_get_bool(dnode, "./n-flag-clear"); n_flag_clear = yang_dnode_get_bool(dnode, "n-flag-clear");
vty_out(vty, " segment-routing prefix %s", prefix); vty_out(vty, " segment-routing prefix %s", prefix);
vty_out(vty, " algorithm %u", algorithm); vty_out(vty, " algorithm %u", algorithm);
@ -2220,22 +2220,22 @@ void cli_show_isis_srv6_node_msd(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " node-msd\n"); vty_out(vty, " node-msd\n");
if (yang_dnode_get_uint8(dnode, "./max-segs-left") != if (yang_dnode_get_uint8(dnode, "max-segs-left") !=
yang_get_default_uint8("%s/msd/node-msd/max-segs-left", ISIS_SRV6)) yang_get_default_uint8("%s/msd/node-msd/max-segs-left", ISIS_SRV6))
vty_out(vty, " max-segs-left %u\n", vty_out(vty, " max-segs-left %u\n",
yang_dnode_get_uint8(dnode, "./max-segs-left")); yang_dnode_get_uint8(dnode, "max-segs-left"));
if (yang_dnode_get_uint8(dnode, "./max-end-pop") != if (yang_dnode_get_uint8(dnode, "max-end-pop") !=
yang_get_default_uint8("%s/msd/node-msd/max-end-pop", ISIS_SRV6)) yang_get_default_uint8("%s/msd/node-msd/max-end-pop", ISIS_SRV6))
vty_out(vty, " max-end-pop %u\n", vty_out(vty, " max-end-pop %u\n",
yang_dnode_get_uint8(dnode, "./max-end-pop")); yang_dnode_get_uint8(dnode, "max-end-pop"));
if (yang_dnode_get_uint8(dnode, "./max-h-encaps") != if (yang_dnode_get_uint8(dnode, "max-h-encaps") !=
yang_get_default_uint8("%s/msd/node-msd/max-h-encaps", ISIS_SRV6)) yang_get_default_uint8("%s/msd/node-msd/max-h-encaps", ISIS_SRV6))
vty_out(vty, " max-h-encaps %u\n", vty_out(vty, " max-h-encaps %u\n",
yang_dnode_get_uint8(dnode, "./max-h-encaps")); yang_dnode_get_uint8(dnode, "max-h-encaps"));
if (yang_dnode_get_uint8(dnode, "./max-end-d") != if (yang_dnode_get_uint8(dnode, "max-end-d") !=
yang_get_default_uint8("%s/msd/node-msd/max-end-d", ISIS_SRV6)) yang_get_default_uint8("%s/msd/node-msd/max-end-d", ISIS_SRV6))
vty_out(vty, " max-end-d %u\n", vty_out(vty, " max-end-d %u\n",
yang_dnode_get_uint8(dnode, "./max-end-d")); yang_dnode_get_uint8(dnode, "max-end-d"));
} }
/* /*
@ -2381,8 +2381,8 @@ void cli_show_isis_frr_lfa_tiebreaker(struct vty *vty,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " fast-reroute lfa tiebreaker %s index %s %s\n", vty_out(vty, " fast-reroute lfa tiebreaker %s index %s %s\n",
yang_dnode_get_string(dnode, "./type"), yang_dnode_get_string(dnode, "type"),
yang_dnode_get_string(dnode, "./index"), yang_dnode_get_string(dnode, "index"),
dnode->parent->parent->schema->name); dnode->parent->parent->schema->name);
} }
@ -2554,8 +2554,8 @@ void cli_show_ip_isis_password(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " isis password %s %s\n", vty_out(vty, " isis password %s %s\n",
yang_dnode_get_string(dnode, "./password-type"), yang_dnode_get_string(dnode, "password-type"),
yang_dnode_get_string(dnode, "./password")); yang_dnode_get_string(dnode, "password"));
} }
/* /*
@ -2601,8 +2601,8 @@ DEFPY_YANG(no_isis_metric, no_isis_metric_cmd,
void cli_show_ip_isis_metric(struct vty *vty, const struct lyd_node *dnode, void cli_show_ip_isis_metric(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *l1 = yang_dnode_get_string(dnode, "./level-1"); const char *l1 = yang_dnode_get_string(dnode, "level-1");
const char *l2 = yang_dnode_get_string(dnode, "./level-2"); const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2)) if (strmatch(l1, l2))
vty_out(vty, " isis metric %s\n", l1); vty_out(vty, " isis metric %s\n", l1);
@ -2660,8 +2660,8 @@ void cli_show_ip_isis_hello_interval(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *l1 = yang_dnode_get_string(dnode, "./level-1"); const char *l1 = yang_dnode_get_string(dnode, "level-1");
const char *l2 = yang_dnode_get_string(dnode, "./level-2"); const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2)) if (strmatch(l1, l2))
vty_out(vty, " isis hello-interval %s\n", l1); vty_out(vty, " isis hello-interval %s\n", l1);
@ -2718,8 +2718,8 @@ DEFPY_YANG(no_isis_hello_multiplier, no_isis_hello_multiplier_cmd,
void cli_show_ip_isis_hello_multi(struct vty *vty, const struct lyd_node *dnode, void cli_show_ip_isis_hello_multi(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *l1 = yang_dnode_get_string(dnode, "./level-1"); const char *l1 = yang_dnode_get_string(dnode, "level-1");
const char *l2 = yang_dnode_get_string(dnode, "./level-2"); const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2)) if (strmatch(l1, l2))
vty_out(vty, " isis hello-multiplier %s\n", l1); vty_out(vty, " isis hello-multiplier %s\n", l1);
@ -2837,8 +2837,8 @@ void cli_show_ip_isis_csnp_interval(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *l1 = yang_dnode_get_string(dnode, "./level-1"); const char *l1 = yang_dnode_get_string(dnode, "level-1");
const char *l2 = yang_dnode_get_string(dnode, "./level-2"); const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2)) if (strmatch(l1, l2))
vty_out(vty, " isis csnp-interval %s\n", l1); vty_out(vty, " isis csnp-interval %s\n", l1);
@ -2896,8 +2896,8 @@ void cli_show_ip_isis_psnp_interval(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *l1 = yang_dnode_get_string(dnode, "./level-1"); const char *l1 = yang_dnode_get_string(dnode, "level-1");
const char *l2 = yang_dnode_get_string(dnode, "./level-2"); const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2)) if (strmatch(l1, l2))
vty_out(vty, " isis psnp-interval %s\n", l1); vty_out(vty, " isis psnp-interval %s\n", l1);
@ -3140,8 +3140,8 @@ DEFPY_YANG(no_isis_priority, no_isis_priority_cmd,
void cli_show_ip_isis_priority(struct vty *vty, const struct lyd_node *dnode, void cli_show_ip_isis_priority(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *l1 = yang_dnode_get_string(dnode, "./level-1"); const char *l1 = yang_dnode_get_string(dnode, "level-1");
const char *l2 = yang_dnode_get_string(dnode, "./level-2"); const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2)) if (strmatch(l1, l2))
vty_out(vty, " isis priority %s\n", l1); vty_out(vty, " isis priority %s\n", l1);
@ -3162,8 +3162,8 @@ void cli_show_ip_isis_frr(struct vty *vty, const struct lyd_node *dnode,
bool l1_link_fallback, l2_link_fallback; bool l1_link_fallback, l2_link_fallback;
/* Classic LFA */ /* Classic LFA */
l1_enabled = yang_dnode_get_bool(dnode, "./level-1/lfa/enable"); l1_enabled = yang_dnode_get_bool(dnode, "level-1/lfa/enable");
l2_enabled = yang_dnode_get_bool(dnode, "./level-2/lfa/enable"); l2_enabled = yang_dnode_get_bool(dnode, "level-2/lfa/enable");
if (l1_enabled || l2_enabled) { if (l1_enabled || l2_enabled) {
if (l1_enabled == l2_enabled) { if (l1_enabled == l2_enabled) {
@ -3180,8 +3180,8 @@ void cli_show_ip_isis_frr(struct vty *vty, const struct lyd_node *dnode,
} }
/* Remote LFA */ /* Remote LFA */
l1_enabled = yang_dnode_get_bool(dnode, "./level-1/remote-lfa/enable"); l1_enabled = yang_dnode_get_bool(dnode, "level-1/remote-lfa/enable");
l2_enabled = yang_dnode_get_bool(dnode, "./level-2/remote-lfa/enable"); l2_enabled = yang_dnode_get_bool(dnode, "level-2/remote-lfa/enable");
if (l1_enabled || l2_enabled) { if (l1_enabled || l2_enabled) {
if (l1_enabled == l2_enabled) { if (l1_enabled == l2_enabled) {
@ -3199,16 +3199,16 @@ void cli_show_ip_isis_frr(struct vty *vty, const struct lyd_node *dnode,
} }
/* TI-LFA */ /* TI-LFA */
l1_enabled = yang_dnode_get_bool(dnode, "./level-1/ti-lfa/enable"); l1_enabled = yang_dnode_get_bool(dnode, "level-1/ti-lfa/enable");
l2_enabled = yang_dnode_get_bool(dnode, "./level-2/ti-lfa/enable"); l2_enabled = yang_dnode_get_bool(dnode, "level-2/ti-lfa/enable");
l1_node_protection = l1_node_protection =
yang_dnode_get_bool(dnode, "./level-1/ti-lfa/node-protection"); yang_dnode_get_bool(dnode, "level-1/ti-lfa/node-protection");
l2_node_protection = l2_node_protection =
yang_dnode_get_bool(dnode, "./level-2/ti-lfa/node-protection"); yang_dnode_get_bool(dnode, "level-2/ti-lfa/node-protection");
l1_link_fallback = l1_link_fallback =
yang_dnode_get_bool(dnode, "./level-1/ti-lfa/link-fallback"); yang_dnode_get_bool(dnode, "level-1/ti-lfa/link-fallback");
l2_link_fallback = l2_link_fallback =
yang_dnode_get_bool(dnode, "./level-2/ti-lfa/link-fallback"); yang_dnode_get_bool(dnode, "level-2/ti-lfa/link-fallback");
if (l1_enabled || l2_enabled) { if (l1_enabled || l2_enabled) {
@ -3874,24 +3874,24 @@ void cli_show_isis_flex_algo(struct vty *vty, const struct lyd_node *dnode,
uint32_t priority; uint32_t priority;
char type_str[10]; char type_str[10];
algorithm = yang_dnode_get_uint32(dnode, "./flex-algo"); algorithm = yang_dnode_get_uint32(dnode, "flex-algo");
vty_out(vty, " flex-algo %u\n", algorithm); vty_out(vty, " flex-algo %u\n", algorithm);
if (yang_dnode_exists(dnode, "./advertise-definition")) if (yang_dnode_exists(dnode, "advertise-definition"))
vty_out(vty, " advertise-definition\n"); vty_out(vty, " advertise-definition\n");
if (yang_dnode_exists(dnode, "./dplane-sr-mpls")) if (yang_dnode_exists(dnode, "dplane-sr-mpls"))
vty_out(vty, " dataplane sr-mpls\n"); vty_out(vty, " dataplane sr-mpls\n");
if (yang_dnode_exists(dnode, "./dplane-srv6")) if (yang_dnode_exists(dnode, "dplane-srv6"))
vty_out(vty, " dataplane srv6\n"); vty_out(vty, " dataplane srv6\n");
if (yang_dnode_exists(dnode, "./dplane-ip")) if (yang_dnode_exists(dnode, "dplane-ip"))
vty_out(vty, " dataplane ip\n"); vty_out(vty, " dataplane ip\n");
if (yang_dnode_exists(dnode, "./prefix-metric")) if (yang_dnode_exists(dnode, "prefix-metric"))
vty_out(vty, " prefix-metric\n"); vty_out(vty, " prefix-metric\n");
if (yang_dnode_exists(dnode, "./metric-type")) { if (yang_dnode_exists(dnode, "metric-type")) {
metric_type = yang_dnode_get_enum(dnode, "./metric-type"); metric_type = yang_dnode_get_enum(dnode, "metric-type");
if (metric_type != MT_IGP) { if (metric_type != MT_IGP) {
flex_algo_metric_type_print(type_str, sizeof(type_str), flex_algo_metric_type_print(type_str, sizeof(type_str),
metric_type); metric_type);
@ -3899,8 +3899,8 @@ void cli_show_isis_flex_algo(struct vty *vty, const struct lyd_node *dnode,
} }
} }
if (yang_dnode_exists(dnode, "./priority")) { if (yang_dnode_exists(dnode, "priority")) {
priority = yang_dnode_get_uint32(dnode, "./priority"); priority = yang_dnode_get_uint32(dnode, "priority");
if (priority != FLEX_ALGO_PRIO_DEFAULT) if (priority != FLEX_ALGO_PRIO_DEFAULT)
vty_out(vty, " priority %u\n", priority); vty_out(vty, " priority %u\n", priority);
} }

View file

@ -60,8 +60,8 @@ int isis_instance_create(struct nb_cb_create_args *args)
if (args->event != NB_EV_APPLY) if (args->event != NB_EV_APPLY)
return NB_OK; return NB_OK;
vrf_name = yang_dnode_get_string(args->dnode, "./vrf"); vrf_name = yang_dnode_get_string(args->dnode, "vrf");
area_tag = yang_dnode_get_string(args->dnode, "./area-tag"); area_tag = yang_dnode_get_string(args->dnode, "area-tag");
area = isis_area_lookup_by_vrf(area_tag, vrf_name); area = isis_area_lookup_by_vrf(area_tag, vrf_name);
if (area) if (area)
@ -650,12 +650,12 @@ int isis_instance_lsp_generation_interval_level_2_modify(
*/ */
void ietf_backoff_delay_apply_finish(struct nb_cb_apply_finish_args *args) void ietf_backoff_delay_apply_finish(struct nb_cb_apply_finish_args *args)
{ {
long init_delay = yang_dnode_get_uint16(args->dnode, "./init-delay"); long init_delay = yang_dnode_get_uint16(args->dnode, "init-delay");
long short_delay = yang_dnode_get_uint16(args->dnode, "./short-delay"); long short_delay = yang_dnode_get_uint16(args->dnode, "short-delay");
long long_delay = yang_dnode_get_uint16(args->dnode, "./long-delay"); long long_delay = yang_dnode_get_uint16(args->dnode, "long-delay");
long holddown = yang_dnode_get_uint16(args->dnode, "./hold-down"); long holddown = yang_dnode_get_uint16(args->dnode, "hold-down");
long timetolearn = long timetolearn =
yang_dnode_get_uint16(args->dnode, "./time-to-learn"); yang_dnode_get_uint16(args->dnode, "time-to-learn");
struct isis_area *area = nb_running_get_entry(args->dnode, NULL, true); struct isis_area *area = nb_running_get_entry(args->dnode, NULL, true);
size_t bufsiz = strlen(area->area_tag) + sizeof("IS-IS Lx"); size_t bufsiz = strlen(area->area_tag) + sizeof("IS-IS Lx");
char *buf = XCALLOC(MTYPE_TMP, bufsiz); char *buf = XCALLOC(MTYPE_TMP, bufsiz);
@ -926,11 +926,11 @@ int isis_instance_spf_prefix_priorities_medium_access_list_name_destroy(
*/ */
void area_password_apply_finish(struct nb_cb_apply_finish_args *args) void area_password_apply_finish(struct nb_cb_apply_finish_args *args)
{ {
const char *password = yang_dnode_get_string(args->dnode, "./password"); const char *password = yang_dnode_get_string(args->dnode, "password");
struct isis_area *area = nb_running_get_entry(args->dnode, NULL, true); struct isis_area *area = nb_running_get_entry(args->dnode, NULL, true);
int pass_type = yang_dnode_get_enum(args->dnode, "./password-type"); int pass_type = yang_dnode_get_enum(args->dnode, "password-type");
uint8_t snp_auth = uint8_t snp_auth =
yang_dnode_get_enum(args->dnode, "./authenticate-snp"); yang_dnode_get_enum(args->dnode, "authenticate-snp");
switch (pass_type) { switch (pass_type) {
case ISIS_PASSWD_TYPE_CLEARTXT: case ISIS_PASSWD_TYPE_CLEARTXT:
@ -997,11 +997,11 @@ int isis_instance_area_password_authenticate_snp_modify(
*/ */
void domain_password_apply_finish(struct nb_cb_apply_finish_args *args) void domain_password_apply_finish(struct nb_cb_apply_finish_args *args)
{ {
const char *password = yang_dnode_get_string(args->dnode, "./password"); const char *password = yang_dnode_get_string(args->dnode, "password");
struct isis_area *area = nb_running_get_entry(args->dnode, NULL, true); struct isis_area *area = nb_running_get_entry(args->dnode, NULL, true);
int pass_type = yang_dnode_get_enum(args->dnode, "./password-type"); int pass_type = yang_dnode_get_enum(args->dnode, "password-type");
uint8_t snp_auth = uint8_t snp_auth =
yang_dnode_get_enum(args->dnode, "./authenticate-snp"); yang_dnode_get_enum(args->dnode, "authenticate-snp");
switch (pass_type) { switch (pass_type) {
case ISIS_PASSWD_TYPE_CLEARTXT: case ISIS_PASSWD_TYPE_CLEARTXT:
@ -1073,9 +1073,9 @@ void default_info_origin_apply_finish(const struct lyd_node *dnode, int family)
unsigned long metric = 0; unsigned long metric = 0;
const char *routemap = NULL; const char *routemap = NULL;
struct isis_area *area = nb_running_get_entry(dnode, NULL, true); struct isis_area *area = nb_running_get_entry(dnode, NULL, true);
int level = yang_dnode_get_enum(dnode, "./level"); int level = yang_dnode_get_enum(dnode, "level");
if (yang_dnode_get_bool(dnode, "./always")) { if (yang_dnode_get_bool(dnode, "always")) {
originate_type = DEFAULT_ORIGINATE_ALWAYS; originate_type = DEFAULT_ORIGINATE_ALWAYS;
} else if (family == AF_INET6) { } else if (family == AF_INET6) {
zlog_warn( zlog_warn(
@ -1083,10 +1083,10 @@ void default_info_origin_apply_finish(const struct lyd_node *dnode, int family)
__func__); __func__);
} }
if (yang_dnode_exists(dnode, "./metric")) if (yang_dnode_exists(dnode, "metric"))
metric = yang_dnode_get_uint32(dnode, "./metric"); metric = yang_dnode_get_uint32(dnode, "metric");
if (yang_dnode_exists(dnode, "./route-map")) if (yang_dnode_exists(dnode, "route-map"))
routemap = yang_dnode_get_string(dnode, "./route-map"); routemap = yang_dnode_get_string(dnode, "route-map");
isis_redist_set(area, level, family, DEFAULT_ROUTE, metric, routemap, isis_redist_set(area, level, family, DEFAULT_ROUTE, metric, routemap,
originate_type, 0); originate_type, 0);
@ -1119,7 +1119,7 @@ int isis_instance_default_information_originate_ipv4_destroy(
return NB_OK; return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
level = yang_dnode_get_enum(args->dnode, "./level"); level = yang_dnode_get_enum(args->dnode, "level");
isis_redist_unset(area, level, AF_INET, DEFAULT_ROUTE, 0); isis_redist_unset(area, level, AF_INET, DEFAULT_ROUTE, 0);
return NB_OK; return NB_OK;
@ -1182,7 +1182,7 @@ int isis_instance_default_information_originate_ipv6_destroy(
return NB_OK; return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
level = yang_dnode_get_enum(args->dnode, "./level"); level = yang_dnode_get_enum(args->dnode, "level");
isis_redist_unset(area, level, AF_INET6, DEFAULT_ROUTE, 0); isis_redist_unset(area, level, AF_INET6, DEFAULT_ROUTE, 0);
return NB_OK; return NB_OK;
@ -1236,14 +1236,14 @@ void redistribute_apply_finish(const struct lyd_node *dnode, int family)
const char *routemap = NULL; const char *routemap = NULL;
struct isis_area *area; struct isis_area *area;
type = yang_dnode_get_enum(dnode, "./protocol"); type = yang_dnode_get_enum(dnode, "protocol");
level = yang_dnode_get_enum(dnode, "./level"); level = yang_dnode_get_enum(dnode, "level");
area = nb_running_get_entry(dnode, NULL, true); area = nb_running_get_entry(dnode, NULL, true);
if (yang_dnode_exists(dnode, "./metric")) if (yang_dnode_exists(dnode, "metric"))
metric = yang_dnode_get_uint32(dnode, "./metric"); metric = yang_dnode_get_uint32(dnode, "metric");
if (yang_dnode_exists(dnode, "./route-map")) if (yang_dnode_exists(dnode, "route-map"))
routemap = yang_dnode_get_string(dnode, "./route-map"); routemap = yang_dnode_get_string(dnode, "route-map");
isis_redist_set(area, level, family, type, metric, routemap, 0, 0); isis_redist_set(area, level, family, type, metric, routemap, 0, 0);
} }
@ -1273,8 +1273,8 @@ int isis_instance_redistribute_ipv4_destroy(struct nb_cb_destroy_args *args)
return NB_OK; return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
level = yang_dnode_get_enum(args->dnode, "./level"); level = yang_dnode_get_enum(args->dnode, "level");
type = yang_dnode_get_enum(args->dnode, "./protocol"); type = yang_dnode_get_enum(args->dnode, "protocol");
isis_redist_unset(area, level, AF_INET, type, 0); isis_redist_unset(area, level, AF_INET, type, 0);
return NB_OK; return NB_OK;
@ -1333,12 +1333,12 @@ int isis_instance_redistribute_ipv4_table_create(struct nb_cb_create_args *args)
level = yang_dnode_get_enum(args->dnode, "../level"); level = yang_dnode_get_enum(args->dnode, "../level");
area = nb_running_get_entry(args->dnode, "../.", true); area = nb_running_get_entry(args->dnode, "../.", true);
if (yang_dnode_exists(args->dnode, "./metric")) if (yang_dnode_exists(args->dnode, "metric"))
metric = yang_dnode_get_uint32(args->dnode, "./metric"); metric = yang_dnode_get_uint32(args->dnode, "metric");
if (yang_dnode_exists(args->dnode, "./route-map")) if (yang_dnode_exists(args->dnode, "route-map"))
routemap = yang_dnode_get_string(args->dnode, "./route-map"); routemap = yang_dnode_get_string(args->dnode, "route-map");
table = yang_dnode_get_uint16(args->dnode, "./table"); table = yang_dnode_get_uint16(args->dnode, "table");
isis_redist_set(area, level, AF_INET, type, metric, routemap, 0, table); isis_redist_set(area, level, AF_INET, type, metric, routemap, 0, table);
return NB_OK; return NB_OK;
@ -1355,7 +1355,7 @@ int isis_instance_redistribute_ipv4_table_destroy(struct nb_cb_destroy_args *arg
area = nb_running_get_entry(args->dnode, "../.", true); area = nb_running_get_entry(args->dnode, "../.", true);
level = yang_dnode_get_enum(args->dnode, "../level"); level = yang_dnode_get_enum(args->dnode, "../level");
type = yang_dnode_get_enum(args->dnode, "../protocol"); type = yang_dnode_get_enum(args->dnode, "../protocol");
table = yang_dnode_get_uint16(args->dnode, "./table"); table = yang_dnode_get_uint16(args->dnode, "table");
isis_redist_unset(area, level, AF_INET, type, table); isis_redist_unset(area, level, AF_INET, type, table);
return NB_OK; return NB_OK;
@ -1379,8 +1379,8 @@ int isis_instance_redistribute_ipv6_destroy(struct nb_cb_destroy_args *args)
return NB_OK; return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
level = yang_dnode_get_enum(args->dnode, "./level"); level = yang_dnode_get_enum(args->dnode, "level");
type = yang_dnode_get_enum(args->dnode, "./protocol"); type = yang_dnode_get_enum(args->dnode, "protocol");
isis_redist_unset(area, level, AF_INET6, type, 0); isis_redist_unset(area, level, AF_INET6, type, 0);
return NB_OK; return NB_OK;
@ -1732,8 +1732,8 @@ int isis_instance_fast_reroute_level_1_lfa_tiebreaker_create(
return NB_OK; return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
index = yang_dnode_get_uint8(args->dnode, "./index"); index = yang_dnode_get_uint8(args->dnode, "index");
type = yang_dnode_get_enum(args->dnode, "./type"); type = yang_dnode_get_enum(args->dnode, "type");
tie_b = isis_lfa_tiebreaker_add(area, ISIS_LEVEL1, index, type); tie_b = isis_lfa_tiebreaker_add(area, ISIS_LEVEL1, index, type);
nb_running_set_entry(args->dnode, tie_b); nb_running_set_entry(args->dnode, tie_b);
@ -1881,8 +1881,8 @@ int isis_instance_fast_reroute_level_2_lfa_tiebreaker_create(
return NB_OK; return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
index = yang_dnode_get_uint8(args->dnode, "./index"); index = yang_dnode_get_uint8(args->dnode, "index");
type = yang_dnode_get_enum(args->dnode, "./type"); type = yang_dnode_get_enum(args->dnode, "type");
tie_b = isis_lfa_tiebreaker_add(area, ISIS_LEVEL2, index, type); tie_b = isis_lfa_tiebreaker_add(area, ISIS_LEVEL2, index, type);
nb_running_set_entry(args->dnode, tie_b); nb_running_set_entry(args->dnode, tie_b);
@ -2212,10 +2212,10 @@ int isis_instance_segment_routing_label_blocks_pre_validate(
uint32_t srlb_lbound; uint32_t srlb_lbound;
uint32_t srlb_ubound; uint32_t srlb_ubound;
srgb_lbound = yang_dnode_get_uint32(args->dnode, "./srgb/lower-bound"); srgb_lbound = yang_dnode_get_uint32(args->dnode, "srgb/lower-bound");
srgb_ubound = yang_dnode_get_uint32(args->dnode, "./srgb/upper-bound"); srgb_ubound = yang_dnode_get_uint32(args->dnode, "srgb/upper-bound");
srlb_lbound = yang_dnode_get_uint32(args->dnode, "./srlb/lower-bound"); srlb_lbound = yang_dnode_get_uint32(args->dnode, "srlb/lower-bound");
srlb_ubound = yang_dnode_get_uint32(args->dnode, "./srlb/upper-bound"); srlb_ubound = yang_dnode_get_uint32(args->dnode, "srlb/upper-bound");
/* Check that the block size does not exceed 65535 */ /* Check that the block size does not exceed 65535 */
if ((srgb_ubound - srgb_lbound + 1) > 65535) { if ((srgb_ubound - srgb_lbound + 1) > 65535) {
@ -2255,8 +2255,8 @@ void isis_instance_segment_routing_srgb_apply_finish(
uint32_t lower_bound, upper_bound; uint32_t lower_bound, upper_bound;
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
lower_bound = yang_dnode_get_uint32(args->dnode, "./lower-bound"); lower_bound = yang_dnode_get_uint32(args->dnode, "lower-bound");
upper_bound = yang_dnode_get_uint32(args->dnode, "./upper-bound"); upper_bound = yang_dnode_get_uint32(args->dnode, "upper-bound");
isis_sr_cfg_srgb_update(area, lower_bound, upper_bound); isis_sr_cfg_srgb_update(area, lower_bound, upper_bound);
} }
@ -2321,8 +2321,8 @@ void isis_instance_segment_routing_srlb_apply_finish(
uint32_t lower_bound, upper_bound; uint32_t lower_bound, upper_bound;
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
lower_bound = yang_dnode_get_uint32(args->dnode, "./lower-bound"); lower_bound = yang_dnode_get_uint32(args->dnode, "lower-bound");
upper_bound = yang_dnode_get_uint32(args->dnode, "./upper-bound"); upper_bound = yang_dnode_get_uint32(args->dnode, "upper-bound");
isis_sr_cfg_srlb_update(area, lower_bound, upper_bound); isis_sr_cfg_srlb_update(area, lower_bound, upper_bound);
} }
@ -2428,7 +2428,7 @@ int isis_instance_segment_routing_prefix_sid_map_prefix_sid_create(
return NB_OK; return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
pcfg = isis_sr_cfg_prefix_add(area, &prefix, SR_ALGORITHM_SPF); pcfg = isis_sr_cfg_prefix_add(area, &prefix, SR_ALGORITHM_SPF);
nb_running_set_entry(args->dnode, pcfg); nb_running_set_entry(args->dnode, pcfg);
@ -2466,13 +2466,13 @@ int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate(
enum sr_sid_value_type sid_type; enum sr_sid_value_type sid_type;
struct isis_prefix_sid psid = {}; struct isis_prefix_sid psid = {};
yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
srgb_lbound = yang_dnode_get_uint32( srgb_lbound = yang_dnode_get_uint32(
args->dnode, "../../label-blocks/srgb/lower-bound"); args->dnode, "../../label-blocks/srgb/lower-bound");
srgb_ubound = yang_dnode_get_uint32( srgb_ubound = yang_dnode_get_uint32(
args->dnode, "../../label-blocks/srgb/upper-bound"); args->dnode, "../../label-blocks/srgb/upper-bound");
sid = yang_dnode_get_uint32(args->dnode, "./sid-value"); sid = yang_dnode_get_uint32(args->dnode, "sid-value");
sid_type = yang_dnode_get_enum(args->dnode, "./sid-value-type"); sid_type = yang_dnode_get_enum(args->dnode, "sid-value-type");
/* Check for invalid indexes/labels. */ /* Check for invalid indexes/labels. */
srgb_range = srgb_ubound - srgb_lbound + 1; srgb_range = srgb_ubound - srgb_lbound + 1;
@ -2636,8 +2636,8 @@ int isis_instance_segment_routing_algorithm_prefix_sid_create(
return NB_OK; return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
algorithm = yang_dnode_get_uint32(args->dnode, "./algo"); algorithm = yang_dnode_get_uint32(args->dnode, "algo");
pcfg = isis_sr_cfg_prefix_add(area, &prefix, algorithm); pcfg = isis_sr_cfg_prefix_add(area, &prefix, algorithm);
pcfg->algorithm = algorithm; pcfg->algorithm = algorithm;
@ -2676,13 +2676,13 @@ int isis_instance_segment_routing_algorithm_prefix_sid_pre_validate(
enum sr_sid_value_type sid_type; enum sr_sid_value_type sid_type;
struct isis_prefix_sid psid = {}; struct isis_prefix_sid psid = {};
yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
srgb_lbound = yang_dnode_get_uint32( srgb_lbound = yang_dnode_get_uint32(
args->dnode, "../../label-blocks/srgb/lower-bound"); args->dnode, "../../label-blocks/srgb/lower-bound");
srgb_ubound = yang_dnode_get_uint32( srgb_ubound = yang_dnode_get_uint32(
args->dnode, "../../label-blocks/srgb/upper-bound"); args->dnode, "../../label-blocks/srgb/upper-bound");
sid = yang_dnode_get_uint32(args->dnode, "./sid-value"); sid = yang_dnode_get_uint32(args->dnode, "sid-value");
sid_type = yang_dnode_get_enum(args->dnode, "./sid-value-type"); sid_type = yang_dnode_get_enum(args->dnode, "sid-value-type");
/* Check for invalid indexes/labels. */ /* Check for invalid indexes/labels. */
srgb_range = srgb_ubound - srgb_lbound + 1; srgb_range = srgb_ubound - srgb_lbound + 1;
@ -2840,8 +2840,8 @@ int isis_instance_flex_algo_create(struct nb_cb_create_args *args)
uint32_t priority = FLEX_ALGO_PRIO_DEFAULT; uint32_t priority = FLEX_ALGO_PRIO_DEFAULT;
struct isis_flex_algo_alloc_arg arg; struct isis_flex_algo_alloc_arg arg;
algorithm = yang_dnode_get_uint32(args->dnode, "./flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "flex-algo");
advertise = yang_dnode_exists(args->dnode, "./advertise-definition"); advertise = yang_dnode_exists(args->dnode, "advertise-definition");
switch (args->event) { switch (args->event) {
case NB_EV_APPLY: case NB_EV_APPLY:
@ -2875,7 +2875,7 @@ int isis_instance_flex_algo_destroy(struct nb_cb_destroy_args *args)
struct isis_area *area; struct isis_area *area;
uint32_t algorithm; uint32_t algorithm;
algorithm = yang_dnode_get_uint32(args->dnode, "./flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "flex-algo");
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
switch (args->event) { switch (args->event) {
@ -2904,8 +2904,8 @@ int isis_instance_flex_algo_advertise_definition_modify(
uint32_t algorithm; uint32_t algorithm;
algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
advertise = yang_dnode_exists(args->dnode, "./../advertise-definition"); advertise = yang_dnode_exists(args->dnode, "../advertise-definition");
switch (args->event) { switch (args->event) {
case NB_EV_APPLY: case NB_EV_APPLY:
@ -2937,7 +2937,7 @@ int isis_instance_flex_algo_advertise_definition_destroy(
area = nb_running_get_entry(args->dnode, NULL, true); area = nb_running_get_entry(args->dnode, NULL, true);
algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
switch (args->event) { switch (args->event) {
case NB_EV_APPLY: case NB_EV_APPLY:
@ -3153,7 +3153,7 @@ int isis_instance_flex_algo_prefix_metric_create(struct nb_cb_create_args *args)
if (!area) if (!area)
return NB_ERR_RESOURCE; return NB_ERR_RESOURCE;
algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
switch (args->event) { switch (args->event) {
case NB_EV_APPLY: case NB_EV_APPLY:
@ -3188,7 +3188,7 @@ int isis_instance_flex_algo_prefix_metric_destroy(
if (!area) if (!area)
return NB_ERR_RESOURCE; return NB_ERR_RESOURCE;
algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
switch (args->event) { switch (args->event) {
case NB_EV_APPLY: case NB_EV_APPLY:
@ -3223,7 +3223,7 @@ static int isis_instance_flex_algo_dplane_set(struct nb_cb_create_args *args,
if (!area) if (!area)
return NB_ERR_RESOURCE; return NB_ERR_RESOURCE;
algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
switch (args->event) { switch (args->event) {
case NB_EV_APPLY: case NB_EV_APPLY:
@ -3265,7 +3265,7 @@ static int isis_instance_flex_algo_dplane_unset(struct nb_cb_destroy_args *args,
if (!area) if (!area)
return NB_ERR_RESOURCE; return NB_ERR_RESOURCE;
algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
switch (args->event) { switch (args->event) {
case NB_EV_APPLY: case NB_EV_APPLY:
@ -3348,7 +3348,7 @@ int isis_instance_flex_algo_metric_type_modify(struct nb_cb_modify_args *args)
if (!area) if (!area)
return NB_ERR_RESOURCE; return NB_ERR_RESOURCE;
algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
metric_type = yang_dnode_get_enum(args->dnode, NULL); metric_type = yang_dnode_get_enum(args->dnode, NULL);
switch (args->event) { switch (args->event) {
@ -3388,7 +3388,7 @@ int isis_instance_flex_algo_priority_modify(struct nb_cb_modify_args *args)
if (!area) if (!area)
return NB_ERR_RESOURCE; return NB_ERR_RESOURCE;
algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
priority = yang_dnode_get_uint32(args->dnode, NULL); priority = yang_dnode_get_uint32(args->dnode, NULL);
switch (args->event) { switch (args->event) {
@ -3424,7 +3424,7 @@ int isis_instance_flex_algo_priority_destroy(struct nb_cb_destroy_args *args)
if (!area) if (!area)
return NB_ERR_RESOURCE; return NB_ERR_RESOURCE;
algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
priority = yang_dnode_get_uint32(args->dnode, NULL); priority = yang_dnode_get_uint32(args->dnode, NULL);
switch (args->event) { switch (args->event) {
@ -3754,7 +3754,7 @@ int lib_interface_isis_create(struct nb_cb_create_args *args)
{ {
struct interface *ifp; struct interface *ifp;
struct isis_circuit *circuit = NULL; struct isis_circuit *circuit = NULL;
const char *area_tag = yang_dnode_get_string(args->dnode, "./area-tag"); const char *area_tag = yang_dnode_get_string(args->dnode, "area-tag");
switch (args->event) { switch (args->event) {
case NB_EV_PREPARE: case NB_EV_PREPARE:

View file

@ -93,8 +93,8 @@ void cli_show_affinity_map(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults __attribute__((__unused__))) bool show_defaults __attribute__((__unused__)))
{ {
vty_out(vty, "affinity-map %s bit-position %u\n", vty_out(vty, "affinity-map %s bit-position %u\n",
yang_dnode_get_string(dnode, "./name"), yang_dnode_get_string(dnode, "name"),
yang_dnode_get_uint16(dnode, "./value")); yang_dnode_get_uint16(dnode, "value"));
} }
/* Initialization of affinity map vector. */ /* Initialization of affinity map vector. */

View file

@ -1004,8 +1004,8 @@ ALIAS(
int access_list_cmp(const struct lyd_node *dnode1, int access_list_cmp(const struct lyd_node *dnode1,
const struct lyd_node *dnode2) const struct lyd_node *dnode2)
{ {
uint32_t seq1 = yang_dnode_get_uint32(dnode1, "./sequence"); uint32_t seq1 = yang_dnode_get_uint32(dnode1, "sequence");
uint32_t seq2 = yang_dnode_get_uint32(dnode2, "./sequence"); uint32_t seq2 = yang_dnode_get_uint32(dnode2, "sequence");
return seq1 - seq2; return seq1 - seq2;
} }
@ -1022,23 +1022,23 @@ void access_list_show(struct vty *vty, const struct lyd_node *dnode,
struct in_addr addr, mask; struct in_addr addr, mask;
char macstr[PREFIX2STR_BUFFER]; char macstr[PREFIX2STR_BUFFER];
is_any = yang_dnode_exists(dnode, "./any"); is_any = yang_dnode_exists(dnode, "any");
switch (type) { switch (type) {
case YALT_IPV4: case YALT_IPV4:
if (is_any) if (is_any)
break; break;
if (yang_dnode_exists(dnode, "./host") if (yang_dnode_exists(dnode, "host")
|| yang_dnode_exists(dnode, "./network/address") || yang_dnode_exists(dnode, "network/address")
|| yang_dnode_exists(dnode, "./source-any")) { || yang_dnode_exists(dnode, "source-any")) {
cisco_style = true; cisco_style = true;
if (yang_dnode_exists(dnode, "./destination-host") if (yang_dnode_exists(dnode, "destination-host")
|| yang_dnode_exists( || yang_dnode_exists(
dnode, "./destination-network/address") dnode, "./destination-network/address")
|| yang_dnode_exists(dnode, "./destination-any")) || yang_dnode_exists(dnode, "destination-any"))
cisco_extended = true; cisco_extended = true;
} else { } else {
yang_dnode_get_prefix(&p, dnode, "./ipv4-prefix"); yang_dnode_get_prefix(&p, dnode, "ipv4-prefix");
is_exact = yang_dnode_get_bool(dnode, is_exact = yang_dnode_get_bool(dnode,
"./ipv4-exact-match"); "./ipv4-exact-match");
} }
@ -1048,39 +1048,39 @@ void access_list_show(struct vty *vty, const struct lyd_node *dnode,
if (is_any) if (is_any)
break; break;
yang_dnode_get_prefix(&p, dnode, "./ipv6-prefix"); yang_dnode_get_prefix(&p, dnode, "ipv6-prefix");
is_exact = yang_dnode_get_bool(dnode, "./ipv6-exact-match"); is_exact = yang_dnode_get_bool(dnode, "ipv6-exact-match");
break; break;
case YALT_MAC: /* mac */ case YALT_MAC: /* mac */
vty_out(vty, "mac "); vty_out(vty, "mac ");
if (is_any) if (is_any)
break; break;
yang_dnode_get_prefix(&p, dnode, "./mac"); yang_dnode_get_prefix(&p, dnode, "mac");
break; break;
} }
vty_out(vty, "access-list %s seq %s %s", vty_out(vty, "access-list %s seq %s %s",
yang_dnode_get_string(dnode, "../name"), yang_dnode_get_string(dnode, "../name"),
yang_dnode_get_string(dnode, "./sequence"), yang_dnode_get_string(dnode, "sequence"),
yang_dnode_get_string(dnode, "./action")); yang_dnode_get_string(dnode, "action"));
/* Handle Cisco style access lists. */ /* Handle Cisco style access lists. */
if (cisco_style) { if (cisco_style) {
if (cisco_extended) if (cisco_extended)
vty_out(vty, " ip"); vty_out(vty, " ip");
if (yang_dnode_exists(dnode, "./network")) { if (yang_dnode_exists(dnode, "network")) {
yang_dnode_get_ipv4(&addr, dnode, "./network/address"); yang_dnode_get_ipv4(&addr, dnode, "network/address");
yang_dnode_get_ipv4(&mask, dnode, "./network/mask"); yang_dnode_get_ipv4(&mask, dnode, "network/mask");
vty_out(vty, " %pI4 %pI4", &addr, &mask); vty_out(vty, " %pI4 %pI4", &addr, &mask);
} else if (yang_dnode_exists(dnode, "./host")) { } else if (yang_dnode_exists(dnode, "host")) {
if (cisco_extended) if (cisco_extended)
vty_out(vty, " host"); vty_out(vty, " host");
vty_out(vty, " %s", vty_out(vty, " %s",
yang_dnode_get_string(dnode, "./host")); yang_dnode_get_string(dnode, "host"));
} else if (yang_dnode_exists(dnode, "./source-any")) } else if (yang_dnode_exists(dnode, "source-any"))
vty_out(vty, " any"); vty_out(vty, " any");
/* Not extended, exit earlier. */ /* Not extended, exit earlier. */
@ -1090,17 +1090,17 @@ void access_list_show(struct vty *vty, const struct lyd_node *dnode,
} }
/* Handle destination address. */ /* Handle destination address. */
if (yang_dnode_exists(dnode, "./destination-network")) { if (yang_dnode_exists(dnode, "destination-network")) {
yang_dnode_get_ipv4(&addr, dnode, yang_dnode_get_ipv4(&addr, dnode,
"./destination-network/address"); "./destination-network/address");
yang_dnode_get_ipv4(&mask, dnode, yang_dnode_get_ipv4(&mask, dnode,
"./destination-network/mask"); "./destination-network/mask");
vty_out(vty, " %pI4 %pI4", &addr, &mask); vty_out(vty, " %pI4 %pI4", &addr, &mask);
} else if (yang_dnode_exists(dnode, "./destination-host")) } else if (yang_dnode_exists(dnode, "destination-host"))
vty_out(vty, " host %s", vty_out(vty, " host %s",
yang_dnode_get_string(dnode, yang_dnode_get_string(dnode,
"./destination-host")); "./destination-host"));
else if (yang_dnode_exists(dnode, "./destination-any")) else if (yang_dnode_exists(dnode, "destination-any"))
vty_out(vty, " any"); vty_out(vty, " any");
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -1644,8 +1644,8 @@ ALIAS(
int prefix_list_cmp(const struct lyd_node *dnode1, int prefix_list_cmp(const struct lyd_node *dnode1,
const struct lyd_node *dnode2) const struct lyd_node *dnode2)
{ {
uint32_t seq1 = yang_dnode_get_uint32(dnode1, "./sequence"); uint32_t seq1 = yang_dnode_get_uint32(dnode1, "sequence");
uint32_t seq2 = yang_dnode_get_uint32(dnode2, "./sequence"); uint32_t seq2 = yang_dnode_get_uint32(dnode2, "sequence");
return seq1 - seq2; return seq1 - seq2;
} }
@ -1658,11 +1658,11 @@ void prefix_list_show(struct vty *vty, const struct lyd_node *dnode,
bool is_any; bool is_any;
struct prefix p; struct prefix p;
is_any = yang_dnode_exists(dnode, "./any"); is_any = yang_dnode_exists(dnode, "any");
switch (type) { switch (type) {
case YPLT_IPV4: case YPLT_IPV4:
if (!is_any) if (!is_any)
yang_dnode_get_prefix(&p, dnode, "./ipv4-prefix"); yang_dnode_get_prefix(&p, dnode, "ipv4-prefix");
if (yang_dnode_exists(dnode, if (yang_dnode_exists(dnode,
"./ipv4-prefix-length-greater-or-equal")) "./ipv4-prefix-length-greater-or-equal"))
ge_str = yang_dnode_get_string( ge_str = yang_dnode_get_string(
@ -1692,8 +1692,8 @@ void prefix_list_show(struct vty *vty, const struct lyd_node *dnode,
vty_out(vty, "prefix-list %s seq %s %s", vty_out(vty, "prefix-list %s seq %s %s",
yang_dnode_get_string(dnode, "../name"), yang_dnode_get_string(dnode, "../name"),
yang_dnode_get_string(dnode, "./sequence"), yang_dnode_get_string(dnode, "sequence"),
yang_dnode_get_string(dnode, "./action")); yang_dnode_get_string(dnode, "action"));
if (is_any) { if (is_any) {
vty_out(vty, " any\n"); vty_out(vty, " any\n");

View file

@ -112,7 +112,7 @@ prefix_list_nb_validate_v4_af_type(const struct lyd_node *plist_dnode,
{ {
int af_type; int af_type;
af_type = yang_dnode_get_enum(plist_dnode, "./type"); af_type = yang_dnode_get_enum(plist_dnode, "type");
if (af_type != YPLT_IPV4) { if (af_type != YPLT_IPV4) {
snprintf(errmsg, errmsg_len, snprintf(errmsg, errmsg_len,
"prefix-list type %u is mismatched.", af_type); "prefix-list type %u is mismatched.", af_type);
@ -128,7 +128,7 @@ prefix_list_nb_validate_v6_af_type(const struct lyd_node *plist_dnode,
{ {
int af_type; int af_type;
af_type = yang_dnode_get_enum(plist_dnode, "./type"); af_type = yang_dnode_get_enum(plist_dnode, "type");
if (af_type != YPLT_IPV6) { if (af_type != YPLT_IPV6) {
snprintf(errmsg, errmsg_len, snprintf(errmsg, errmsg_len,
"prefix-list type %u is mismatched.", af_type); "prefix-list type %u is mismatched.", af_type);
@ -381,14 +381,14 @@ static void plist_dnode_to_prefix(const struct lyd_node *dnode, bool *any,
*ge = 0; *ge = 0;
*le = 0; *le = 0;
if (yang_dnode_exists(dnode, "./any")) { if (yang_dnode_exists(dnode, "any")) {
*any = true; *any = true;
return; return;
} }
switch (yang_dnode_get_enum(dnode, "../type")) { switch (yang_dnode_get_enum(dnode, "../type")) {
case YPLT_IPV4: case YPLT_IPV4:
yang_dnode_get_prefix(p, dnode, "./ipv4-prefix"); yang_dnode_get_prefix(p, dnode, "ipv4-prefix");
if (yang_dnode_exists(dnode, if (yang_dnode_exists(dnode,
"./ipv4-prefix-length-greater-or-equal")) "./ipv4-prefix-length-greater-or-equal"))
*ge = yang_dnode_get_uint8( *ge = yang_dnode_get_uint8(
@ -399,7 +399,7 @@ static void plist_dnode_to_prefix(const struct lyd_node *dnode, bool *any,
dnode, "./ipv4-prefix-length-lesser-or-equal"); dnode, "./ipv4-prefix-length-lesser-or-equal");
break; break;
case YPLT_IPV6: case YPLT_IPV6:
yang_dnode_get_prefix(p, dnode, "./ipv6-prefix"); yang_dnode_get_prefix(p, dnode, "ipv6-prefix");
if (yang_dnode_exists(dnode, if (yang_dnode_exists(dnode,
"./ipv6-prefix-length-greater-or-equal")) "./ipv6-prefix-length-greater-or-equal"))
*ge = yang_dnode_get_uint8( *ge = yang_dnode_get_uint8(
@ -468,8 +468,8 @@ static int lib_access_list_create(struct nb_cb_create_args *args)
if (args->event != NB_EV_APPLY) if (args->event != NB_EV_APPLY)
return NB_OK; return NB_OK;
type = yang_dnode_get_enum(args->dnode, "./type"); type = yang_dnode_get_enum(args->dnode, "type");
acl_name = yang_dnode_get_string(args->dnode, "./name"); acl_name = yang_dnode_get_string(args->dnode, "name");
switch (type) { switch (type) {
case YALT_IPV4: case YALT_IPV4:
@ -550,7 +550,7 @@ static int lib_access_list_entry_create(struct nb_cb_create_args *args)
return NB_OK; return NB_OK;
f = filter_new(); f = filter_new();
f->seq = yang_dnode_get_uint32(args->dnode, "./sequence"); f->seq = yang_dnode_get_uint32(args->dnode, "sequence");
acl = nb_running_get_entry(args->dnode, NULL, true); acl = nb_running_get_entry(args->dnode, NULL, true);
f->acl = acl; f->acl = acl;
@ -1123,8 +1123,8 @@ static int lib_prefix_list_create(struct nb_cb_create_args *args)
if (args->event != NB_EV_APPLY) if (args->event != NB_EV_APPLY)
return NB_OK; return NB_OK;
type = yang_dnode_get_enum(args->dnode, "./type"); type = yang_dnode_get_enum(args->dnode, "type");
name = yang_dnode_get_string(args->dnode, "./name"); name = yang_dnode_get_string(args->dnode, "name");
switch (type) { switch (type) {
case 0: /* ipv4 */ case 0: /* ipv4 */
pl = prefix_list_get(AFI_IP, 0, name); pl = prefix_list_get(AFI_IP, 0, name);
@ -1201,7 +1201,7 @@ static int lib_prefix_list_entry_create(struct nb_cb_create_args *args)
pl = nb_running_get_entry(args->dnode, NULL, true); pl = nb_running_get_entry(args->dnode, NULL, true);
ple = prefix_list_entry_new(); ple = prefix_list_entry_new();
ple->pl = pl; ple->pl = pl;
ple->seq = yang_dnode_get_uint32(args->dnode, "./sequence"); ple->seq = yang_dnode_get_uint32(args->dnode, "sequence");
prefix_list_entry_set_empty(ple); prefix_list_entry_set_empty(ple);
nb_running_set_entry(args->dnode, ple); nb_running_set_entry(args->dnode, ple);

View file

@ -1319,14 +1319,14 @@ static void cli_show_interface(struct vty *vty, const struct lyd_node *dnode,
char ifname[XPATH_MAXLEN]; char ifname[XPATH_MAXLEN];
char vrfname[XPATH_MAXLEN]; char vrfname[XPATH_MAXLEN];
netns_ifname_split(yang_dnode_get_string(dnode, "./name"), netns_ifname_split(yang_dnode_get_string(dnode, "name"),
ifname, vrfname); ifname, vrfname);
vty_out(vty, "interface %s", ifname); vty_out(vty, "interface %s", ifname);
if (!strmatch(vrfname, VRF_DEFAULT_NAME)) if (!strmatch(vrfname, VRF_DEFAULT_NAME))
vty_out(vty, " vrf %s", vrfname); vty_out(vty, " vrf %s", vrfname);
} else { } else {
const char *ifname = yang_dnode_get_string(dnode, "./name"); const char *ifname = yang_dnode_get_string(dnode, "name");
vty_out(vty, "interface %s", ifname); vty_out(vty, "interface %s", ifname);
} }
@ -1466,7 +1466,7 @@ static int lib_interface_create(struct nb_cb_create_args *args)
const char *ifname; const char *ifname;
struct interface *ifp; struct interface *ifp;
ifname = yang_dnode_get_string(args->dnode, "./name"); ifname = yang_dnode_get_string(args->dnode, "name");
switch (args->event) { switch (args->event) {
case NB_EV_VALIDATE: case NB_EV_VALIDATE:

View file

@ -243,14 +243,14 @@ DEFPY_YANG(no_if_ipv6_route_map, no_if_ipv6_route_map_cmd,
void cli_show_if_route_map(struct vty *vty, const struct lyd_node *dnode, void cli_show_if_route_map(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
if (yang_dnode_exists(dnode, "./in-route-map")) if (yang_dnode_exists(dnode, "in-route-map"))
vty_out(vty, " route-map %s in %s\n", vty_out(vty, " route-map %s in %s\n",
yang_dnode_get_string(dnode, "./in-route-map"), yang_dnode_get_string(dnode, "in-route-map"),
yang_dnode_get_string(dnode, "./interface")); yang_dnode_get_string(dnode, "interface"));
if (yang_dnode_exists(dnode, "./out-route-map")) if (yang_dnode_exists(dnode, "out-route-map"))
vty_out(vty, " route-map %s out %s\n", vty_out(vty, " route-map %s out %s\n",
yang_dnode_get_string(dnode, "./out-route-map"), yang_dnode_get_string(dnode, "out-route-map"),
yang_dnode_get_string(dnode, "./interface")); yang_dnode_get_string(dnode, "interface"));
} }
void if_rmap_yang_modify_cb(struct if_rmap_ctx *ctx, void if_rmap_yang_modify_cb(struct if_rmap_ctx *ctx,

View file

@ -90,8 +90,8 @@ DEFPY_YANG(
int route_map_instance_cmp(const struct lyd_node *dnode1, int route_map_instance_cmp(const struct lyd_node *dnode1,
const struct lyd_node *dnode2) const struct lyd_node *dnode2)
{ {
uint16_t seq1 = yang_dnode_get_uint16(dnode1, "./sequence"); uint16_t seq1 = yang_dnode_get_uint16(dnode1, "sequence");
uint16_t seq2 = yang_dnode_get_uint16(dnode2, "./sequence"); uint16_t seq2 = yang_dnode_get_uint16(dnode2, "sequence");
return seq1 - seq2; return seq1 - seq2;
} }
@ -100,8 +100,8 @@ void route_map_instance_show(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *name = yang_dnode_get_string(dnode, "../name"); const char *name = yang_dnode_get_string(dnode, "../name");
const char *action = yang_dnode_get_string(dnode, "./action"); const char *action = yang_dnode_get_string(dnode, "action");
const char *sequence = yang_dnode_get_string(dnode, "./sequence"); const char *sequence = yang_dnode_get_string(dnode, "sequence");
vty_out(vty, "route-map %s %s %s\n", name, action, sequence); vty_out(vty, "route-map %s %s %s\n", name, action, sequence);
@ -526,7 +526,7 @@ DEFPY_YANG(
void route_map_condition_show(struct vty *vty, const struct lyd_node *dnode, void route_map_condition_show(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *condition = yang_dnode_get_string(dnode, "./condition"); const char *condition = yang_dnode_get_string(dnode, "condition");
const struct lyd_node *ln; const struct lyd_node *ln;
const char *acl; const char *acl;
@ -1050,7 +1050,7 @@ DEFUN_YANG (no_set_srte_color,
void route_map_action_show(struct vty *vty, const struct lyd_node *dnode, void route_map_action_show(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
const char *action = yang_dnode_get_string(dnode, "./action"); const char *action = yang_dnode_get_string(dnode, "action");
const struct lyd_node *ln; const struct lyd_node *ln;
const char *acl; const char *acl;
@ -1102,7 +1102,7 @@ void route_map_action_show(struct vty *vty, const struct lyd_node *dnode,
"./rmap-set-action/max-metric")); "./rmap-set-action/max-metric"));
} else if (IS_SET_TAG(action)) { } else if (IS_SET_TAG(action)) {
vty_out(vty, " set tag %s\n", vty_out(vty, " set tag %s\n",
yang_dnode_get_string(dnode, "./rmap-set-action/tag")); yang_dnode_get_string(dnode, "rmap-set-action/tag"));
} else if (IS_SET_SR_TE_COLOR(action)) { } else if (IS_SET_SR_TE_COLOR(action)) {
vty_out(vty, " set sr-te color %s\n", vty_out(vty, " set sr-te color %s\n",
yang_dnode_get_string(dnode, yang_dnode_get_string(dnode,
@ -1196,7 +1196,7 @@ void route_map_action_show(struct vty *vty, const struct lyd_node *dnode,
vty_out(vty, " set large-comm-list %s delete\n", acl); vty_out(vty, " set large-comm-list %s delete\n", acl);
} else if (IS_SET_EXTCOMM_LIST_DEL(action)) { } else if (IS_SET_EXTCOMM_LIST_DEL(action)) {
acl = NULL; acl = NULL;
ln = yang_dnode_get(dnode, "./rmap-set-action/frr-bgp-route-map:comm-list-name"); ln = yang_dnode_get(dnode, "rmap-set-action/frr-bgp-route-map:comm-list-name");
if (ln) if (ln)
acl = yang_dnode_get_string(ln, NULL); acl = yang_dnode_get_string(ln, NULL);

View file

@ -98,7 +98,7 @@ static int lib_route_map_create(struct nb_cb_create_args *args)
/* NOTHING */ /* NOTHING */
break; break;
case NB_EV_APPLY: case NB_EV_APPLY:
rm_name = yang_dnode_get_string(args->dnode, "./name"); rm_name = yang_dnode_get_string(args->dnode, "name");
rm = route_map_get(rm_name); rm = route_map_get(rm_name);
nb_running_set_entry(args->dnode, rm); nb_running_set_entry(args->dnode, rm);
break; break;
@ -167,8 +167,8 @@ static int lib_route_map_entry_create(struct nb_cb_create_args *args)
/* NOTHING */ /* NOTHING */
break; break;
case NB_EV_APPLY: case NB_EV_APPLY:
sequence = yang_dnode_get_uint16(args->dnode, "./sequence"); sequence = yang_dnode_get_uint16(args->dnode, "sequence");
action = yang_dnode_get_enum(args->dnode, "./action") == 0 action = yang_dnode_get_enum(args->dnode, "action") == 0
? RMAP_PERMIT ? RMAP_PERMIT
: RMAP_DENY; : RMAP_DENY;
rm = nb_running_get_entry(args->dnode, NULL, true); rm = nb_running_get_entry(args->dnode, NULL, true);

View file

@ -44,7 +44,7 @@ int routing_control_plane_protocols_control_plane_protocol_create(
* find the vrf and store the pointer. * find the vrf and store the pointer.
*/ */
if (nb_node_has_dependency(args->dnode->schema->priv)) { if (nb_node_has_dependency(args->dnode->schema->priv)) {
vrfname = yang_dnode_get_string(args->dnode, "./vrf"); vrfname = yang_dnode_get_string(args->dnode, "vrf");
vrf = vrf_lookup_by_name(vrfname); vrf = vrf_lookup_by_name(vrfname);
assert(vrf); assert(vrf);
nb_running_set_entry(args->dnode, vrf); nb_running_set_entry(args->dnode, vrf);
@ -76,7 +76,7 @@ static void vrf_to_control_plane_protocol(const struct lyd_node *dnode,
{ {
const char *vrf; const char *vrf;
vrf = yang_dnode_get_string(dnode, "./name"); vrf = yang_dnode_get_string(dnode, "name");
snprintf(xpath, XPATH_MAXLEN, FRR_ROUTING_KEY_XPATH_VRF, vrf); snprintf(xpath, XPATH_MAXLEN, FRR_ROUTING_KEY_XPATH_VRF, vrf);
} }
@ -86,7 +86,7 @@ static void control_plane_protocol_to_vrf(const struct lyd_node *dnode,
{ {
const char *vrf; const char *vrf;
vrf = yang_dnode_get_string(dnode, "./vrf"); vrf = yang_dnode_get_string(dnode, "vrf");
snprintf(xpath, XPATH_MAXLEN, FRR_VRF_KEY_XPATH, vrf); snprintf(xpath, XPATH_MAXLEN, FRR_VRF_KEY_XPATH, vrf);
} }

View file

@ -914,7 +914,7 @@ static int lib_vrf_create(struct nb_cb_create_args *args)
const char *vrfname; const char *vrfname;
struct vrf *vrfp; struct vrf *vrfp;
vrfname = yang_dnode_get_string(args->dnode, "./name"); vrfname = yang_dnode_get_string(args->dnode, "name");
if (args->event != NB_EV_APPLY) if (args->event != NB_EV_APPLY)
return NB_OK; return NB_OK;

View file

@ -146,7 +146,7 @@ struct yang_translator *yang_translator_load(const char *path)
*/ */
assert(dnode); assert(dnode);
family = yang_dnode_get_string(dnode, "./family"); family = yang_dnode_get_string(dnode, "family");
translator = yang_translator_find(family); translator = yang_translator_find(family);
if (translator != NULL) { if (translator != NULL) {
flog_warn(EC_LIB_YANG_TRANSLATOR_LOAD, flog_warn(EC_LIB_YANG_TRANSLATOR_LOAD,
@ -182,7 +182,7 @@ struct yang_translator *yang_translator_load(const char *path)
tmodule = tmodule =
XCALLOC(MTYPE_YANG_TRANSLATOR_MODULE, sizeof(*tmodule)); XCALLOC(MTYPE_YANG_TRANSLATOR_MODULE, sizeof(*tmodule));
module_name = yang_dnode_get_string(set->dnodes[i], "./name"); module_name = yang_dnode_get_string(set->dnodes[i], "name");
tmodule->module = ly_ctx_load_module(translator->ly_ctx, tmodule->module = ly_ctx_load_module(translator->ly_ctx,
module_name, NULL, NULL); module_name, NULL, NULL);
if (!tmodule->module) { if (!tmodule->module) {
@ -233,7 +233,7 @@ struct yang_translator *yang_translator_load(const char *path)
const struct lysc_node *snode_custom, *snode_native; const struct lysc_node *snode_custom, *snode_native;
xpath_custom = xpath_custom =
yang_dnode_get_string(set->dnodes[i], "./custom"); yang_dnode_get_string(set->dnodes[i], "custom");
snode_custom = snode_custom =
yang_find_snode(translator->ly_ctx, xpath_custom, 0); yang_find_snode(translator->ly_ctx, xpath_custom, 0);
@ -246,7 +246,7 @@ struct yang_translator *yang_translator_load(const char *path)
} }
xpath_native = xpath_native =
yang_dnode_get_string(set->dnodes[i], "./native"); yang_dnode_get_string(set->dnodes[i], "native");
snode_native = yang_find_snode(ly_native_ctx, xpath_native, 0); snode_native = yang_find_snode(ly_native_ctx, xpath_native, 0);
if (!snode_native) { if (!snode_native) {
flog_warn(EC_LIB_YANG_TRANSLATOR_LOAD, flog_warn(EC_LIB_YANG_TRANSLATOR_LOAD,

View file

@ -287,7 +287,7 @@ void cli_show_srte_segment_list(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " segment-list %s\n", vty_out(vty, " segment-list %s\n",
yang_dnode_get_string(dnode, "./name")); yang_dnode_get_string(dnode, "name"));
} }
void cli_show_srte_segment_list_end(struct vty *vty, void cli_show_srte_segment_list_end(struct vty *vty,
@ -546,37 +546,37 @@ void cli_show_srte_segment_list_segment(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " index %s", yang_dnode_get_string(dnode, "./index")); vty_out(vty, " index %s", yang_dnode_get_string(dnode, "index"));
if (yang_dnode_exists(dnode, "./sid-value")) { if (yang_dnode_exists(dnode, "sid-value")) {
vty_out(vty, " mpls label %s", vty_out(vty, " mpls label %s",
yang_dnode_get_string(dnode, "./sid-value")); yang_dnode_get_string(dnode, "sid-value"));
} }
if (yang_dnode_exists(dnode, "./nai")) { if (yang_dnode_exists(dnode, "nai")) {
struct ipaddr addr; struct ipaddr addr;
struct ipaddr addr_rmt; struct ipaddr addr_rmt;
switch (yang_dnode_get_enum(dnode, "./nai/type")) { switch (yang_dnode_get_enum(dnode, "nai/type")) {
case SRTE_SEGMENT_NAI_TYPE_IPV4_NODE: case SRTE_SEGMENT_NAI_TYPE_IPV4_NODE:
case SRTE_SEGMENT_NAI_TYPE_IPV4_LOCAL_IFACE: case SRTE_SEGMENT_NAI_TYPE_IPV4_LOCAL_IFACE:
case SRTE_SEGMENT_NAI_TYPE_IPV4_ALGORITHM: case SRTE_SEGMENT_NAI_TYPE_IPV4_ALGORITHM:
yang_dnode_get_ip(&addr, dnode, "./nai/local-address"); yang_dnode_get_ip(&addr, dnode, "nai/local-address");
vty_out(vty, " nai prefix %pI4", &addr.ipaddr_v4); vty_out(vty, " nai prefix %pI4", &addr.ipaddr_v4);
break; break;
case SRTE_SEGMENT_NAI_TYPE_IPV6_NODE: case SRTE_SEGMENT_NAI_TYPE_IPV6_NODE:
case SRTE_SEGMENT_NAI_TYPE_IPV6_LOCAL_IFACE: case SRTE_SEGMENT_NAI_TYPE_IPV6_LOCAL_IFACE:
case SRTE_SEGMENT_NAI_TYPE_IPV6_ALGORITHM: case SRTE_SEGMENT_NAI_TYPE_IPV6_ALGORITHM:
yang_dnode_get_ip(&addr, dnode, "./nai/local-address"); yang_dnode_get_ip(&addr, dnode, "nai/local-address");
vty_out(vty, " nai prefix %pI6", &addr.ipaddr_v6); vty_out(vty, " nai prefix %pI6", &addr.ipaddr_v6);
break; break;
case SRTE_SEGMENT_NAI_TYPE_IPV4_ADJACENCY: case SRTE_SEGMENT_NAI_TYPE_IPV4_ADJACENCY:
yang_dnode_get_ip(&addr, dnode, "./nai/local-address"); yang_dnode_get_ip(&addr, dnode, "nai/local-address");
yang_dnode_get_ip(&addr_rmt, dnode, yang_dnode_get_ip(&addr_rmt, dnode,
"./nai/remote-address"); "./nai/remote-address");
vty_out(vty, " nai adjacency %pI4", &addr.ipaddr_v4); vty_out(vty, " nai adjacency %pI4", &addr.ipaddr_v4);
vty_out(vty, " %pI4", &addr_rmt.ipaddr_v4); vty_out(vty, " %pI4", &addr_rmt.ipaddr_v4);
break; break;
case SRTE_SEGMENT_NAI_TYPE_IPV6_ADJACENCY: case SRTE_SEGMENT_NAI_TYPE_IPV6_ADJACENCY:
yang_dnode_get_ip(&addr, dnode, "./nai/local-address"); yang_dnode_get_ip(&addr, dnode, "nai/local-address");
yang_dnode_get_ip(&addr_rmt, dnode, yang_dnode_get_ip(&addr_rmt, dnode,
"./nai/remote-address"); "./nai/remote-address");
vty_out(vty, " nai adjacency %pI6", &addr.ipaddr_v6); vty_out(vty, " nai adjacency %pI6", &addr.ipaddr_v6);
@ -585,17 +585,17 @@ void cli_show_srte_segment_list_segment(struct vty *vty,
default: default:
break; break;
} }
if (yang_dnode_exists(dnode, "./nai/local-prefix-len")) { if (yang_dnode_exists(dnode, "nai/local-prefix-len")) {
vty_out(vty, "/%s", vty_out(vty, "/%s",
yang_dnode_get_string( yang_dnode_get_string(
dnode, "./nai/local-prefix-len")); dnode, "./nai/local-prefix-len"));
} }
if (yang_dnode_exists(dnode, "./nai/local-interface")) { if (yang_dnode_exists(dnode, "nai/local-interface")) {
vty_out(vty, " iface %s", vty_out(vty, " iface %s",
yang_dnode_get_string(dnode, yang_dnode_get_string(dnode,
"./nai/local-interface")); "./nai/local-interface"));
} }
if (yang_dnode_exists(dnode, "./nai/algorithm")) { if (yang_dnode_exists(dnode, "nai/algorithm")) {
vty_out(vty, " algorithm %s", vty_out(vty, " algorithm %s",
yang_dnode_get_string(dnode, yang_dnode_get_string(dnode,
"./nai/algorithm")); "./nai/algorithm"));
@ -658,8 +658,8 @@ void cli_show_srte_policy(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " policy color %s endpoint %s\n", vty_out(vty, " policy color %s endpoint %s\n",
yang_dnode_get_string(dnode, "./color"), yang_dnode_get_string(dnode, "color"),
yang_dnode_get_string(dnode, "./endpoint")); yang_dnode_get_string(dnode, "endpoint"));
} }
void cli_show_srte_policy_end(struct vty *vty, const struct lyd_node *dnode) void cli_show_srte_policy_end(struct vty *vty, const struct lyd_node *dnode)
@ -1183,11 +1183,11 @@ static int config_write_metric_cb(const struct lyd_node *dnode, void *arg)
bool required, is_bound = false; bool required, is_bound = false;
float value; float value;
type = yang_dnode_get_enum(dnode, "./type"); type = yang_dnode_get_enum(dnode, "type");
value = (float)yang_dnode_get_dec64(dnode, "./value"); value = (float)yang_dnode_get_dec64(dnode, "value");
required = yang_dnode_get_bool(dnode, "./required"); required = yang_dnode_get_bool(dnode, "required");
if (yang_dnode_exists(dnode, "./is-bound")) if (yang_dnode_exists(dnode, "is-bound"))
is_bound = yang_dnode_get_bool(dnode, "./is-bound"); is_bound = yang_dnode_get_bool(dnode, "is-bound");
config_write_metric(vty, type, value, required, is_bound); config_write_metric(vty, type, value, required, is_bound);
return YANG_ITER_CONTINUE; return YANG_ITER_CONTINUE;
@ -1201,18 +1201,18 @@ void cli_show_srte_policy_candidate_path(struct vty *vty,
uint32_t affinity; uint32_t affinity;
bool required; bool required;
enum objfun_type objfun_type; enum objfun_type objfun_type;
const char *type = yang_dnode_get_string(dnode, "./type"); const char *type = yang_dnode_get_string(dnode, "type");
vty_out(vty, " candidate-path preference %s name %s %s", vty_out(vty, " candidate-path preference %s name %s %s",
yang_dnode_get_string(dnode, "./preference"), yang_dnode_get_string(dnode, "preference"),
yang_dnode_get_string(dnode, "./name"), type); yang_dnode_get_string(dnode, "name"), type);
if (strmatch(type, "explicit")) if (strmatch(type, "explicit"))
vty_out(vty, " segment-list %s", vty_out(vty, " segment-list %s",
yang_dnode_get_string(dnode, "./segment-list-name")); yang_dnode_get_string(dnode, "segment-list-name"));
vty_out(vty, "\n"); vty_out(vty, "\n");
if (strmatch(type, "dynamic")) { if (strmatch(type, "dynamic")) {
if (yang_dnode_exists(dnode, "./constraints/bandwidth")) { if (yang_dnode_exists(dnode, "constraints/bandwidth")) {
bandwidth = (float)yang_dnode_get_dec64( bandwidth = (float)yang_dnode_get_dec64(
dnode, "./constraints/bandwidth/value"); dnode, "./constraints/bandwidth/value");
required = yang_dnode_get_bool( required = yang_dnode_get_bool(
@ -1262,7 +1262,7 @@ void cli_show_srte_policy_candidate_path(struct vty *vty,
void cli_show_srte_policy_candidate_path_end(struct vty *vty, void cli_show_srte_policy_candidate_path_end(struct vty *vty,
const struct lyd_node *dnode) const struct lyd_node *dnode)
{ {
const char *type = yang_dnode_get_string(dnode, "./type"); const char *type = yang_dnode_get_string(dnode, "type");
if (strmatch(type, "dynamic")) if (strmatch(type, "dynamic"))
vty_out(vty, " exit\n"); vty_out(vty, " exit\n");

View file

@ -313,8 +313,8 @@ int iter_objfun_cb(const struct lyd_node *dnode, void *arg)
pref = &of_arg->prefs[of_arg->free_slot++]; pref = &of_arg->prefs[of_arg->free_slot++];
pref->index = yang_dnode_get_uint32(dnode, "./index"); pref->index = yang_dnode_get_uint32(dnode, "index");
pref->type = yang_dnode_get_enum(dnode, "./type"); pref->type = yang_dnode_get_enum(dnode, "type");
/* Simplistic insertion sort */ /* Simplistic insertion sort */
p = &of_arg->first; p = &of_arg->first;

View file

@ -31,7 +31,7 @@ int pathd_srte_segment_list_create(struct nb_cb_create_args *args)
if (args->event != NB_EV_APPLY) if (args->event != NB_EV_APPLY)
return NB_OK; return NB_OK;
name = yang_dnode_get_string(args->dnode, "./name"); name = yang_dnode_get_string(args->dnode, "name");
segment_list = srte_segment_list_add(name); segment_list = srte_segment_list_add(name);
nb_running_set_entry(args->dnode, segment_list); nb_running_set_entry(args->dnode, segment_list);
SET_FLAG(segment_list->flags, F_SEGMENT_LIST_NEW); SET_FLAG(segment_list->flags, F_SEGMENT_LIST_NEW);
@ -104,7 +104,7 @@ int pathd_srte_segment_list_segment_create(struct nb_cb_create_args *args)
return NB_OK; return NB_OK;
segment_list = nb_running_get_entry(args->dnode, NULL, true); segment_list = nb_running_get_entry(args->dnode, NULL, true);
index = yang_dnode_get_uint32(args->dnode, "./index"); index = yang_dnode_get_uint32(args->dnode, "index");
segment = srte_segment_entry_add(segment_list, index); segment = srte_segment_entry_add(segment_list, index);
nb_running_set_entry(args->dnode, segment); nb_running_set_entry(args->dnode, segment);
SET_FLAG(segment_list->flags, F_SEGMENT_LIST_MODIFIED); SET_FLAG(segment_list->flags, F_SEGMENT_LIST_MODIFIED);
@ -191,9 +191,9 @@ void pathd_srte_segment_list_segment_nai_apply_finish(
const char *algo_buf, *local_prefix_len_buf; const char *algo_buf, *local_prefix_len_buf;
segment = nb_running_get_entry(args->dnode, NULL, true); segment = nb_running_get_entry(args->dnode, NULL, true);
type = yang_dnode_get_enum(args->dnode, "./type"); type = yang_dnode_get_enum(args->dnode, "type");
yang_dnode_get_ip(&local_addr, args->dnode, "./local-address"); yang_dnode_get_ip(&local_addr, args->dnode, "local-address");
switch (type) { switch (type) {
case SRTE_SEGMENT_NAI_TYPE_IPV4_NODE: case SRTE_SEGMENT_NAI_TYPE_IPV4_NODE:
@ -208,12 +208,12 @@ void pathd_srte_segment_list_segment_nai_apply_finish(
yang_dnode_get_ip(&remote_addr, args->dnode, yang_dnode_get_ip(&remote_addr, args->dnode,
"./remote-address"); "./remote-address");
local_iface = local_iface =
yang_dnode_get_uint32(args->dnode, "./local-interface"); yang_dnode_get_uint32(args->dnode, "local-interface");
remote_iface = yang_dnode_get_uint32(args->dnode, remote_iface = yang_dnode_get_uint32(args->dnode,
"./remote-interface"); "./remote-interface");
break; break;
case SRTE_SEGMENT_NAI_TYPE_IPV4_ALGORITHM: case SRTE_SEGMENT_NAI_TYPE_IPV4_ALGORITHM:
algo_buf = yang_dnode_get_string(args->dnode, "./algorithm"); algo_buf = yang_dnode_get_string(args->dnode, "algorithm");
algo = atoi(algo_buf); algo = atoi(algo_buf);
local_prefix_len_buf = yang_dnode_get_string( local_prefix_len_buf = yang_dnode_get_string(
args->dnode, "./local-prefix-len"); args->dnode, "./local-prefix-len");
@ -221,7 +221,7 @@ void pathd_srte_segment_list_segment_nai_apply_finish(
break; break;
case SRTE_SEGMENT_NAI_TYPE_IPV4_LOCAL_IFACE: case SRTE_SEGMENT_NAI_TYPE_IPV4_LOCAL_IFACE:
local_iface = local_iface =
yang_dnode_get_uint32(args->dnode, "./local-interface"); yang_dnode_get_uint32(args->dnode, "local-interface");
local_prefix_len_buf = yang_dnode_get_string( local_prefix_len_buf = yang_dnode_get_string(
args->dnode, "./local-prefix-len"); args->dnode, "./local-prefix-len");
local_prefix_len = atoi(local_prefix_len_buf); local_prefix_len = atoi(local_prefix_len_buf);
@ -254,8 +254,8 @@ int pathd_srte_policy_create(struct nb_cb_create_args *args)
if (args->event != NB_EV_APPLY) if (args->event != NB_EV_APPLY)
return NB_OK; return NB_OK;
color = yang_dnode_get_uint32(args->dnode, "./color"); color = yang_dnode_get_uint32(args->dnode, "color");
yang_dnode_get_ip(&endpoint, args->dnode, "./endpoint"); yang_dnode_get_ip(&endpoint, args->dnode, "endpoint");
policy = srte_policy_add(color, &endpoint, SRTE_ORIGIN_LOCAL, NULL); policy = srte_policy_add(color, &endpoint, SRTE_ORIGIN_LOCAL, NULL);
nb_running_set_entry(args->dnode, policy); nb_running_set_entry(args->dnode, policy);
@ -377,7 +377,7 @@ int pathd_srte_policy_candidate_path_create(struct nb_cb_create_args *args)
return NB_OK; return NB_OK;
policy = nb_running_get_entry(args->dnode, NULL, true); policy = nb_running_get_entry(args->dnode, NULL, true);
preference = yang_dnode_get_uint32(args->dnode, "./preference"); preference = yang_dnode_get_uint32(args->dnode, "preference");
candidate = candidate =
srte_candidate_add(policy, preference, SRTE_ORIGIN_LOCAL, NULL); srte_candidate_add(policy, preference, SRTE_ORIGIN_LOCAL, NULL);
nb_running_set_entry(args->dnode, candidate); nb_running_set_entry(args->dnode, candidate);
@ -539,7 +539,7 @@ int pathd_srte_policy_candidate_path_metrics_destroy(
assert(args->context != NULL); assert(args->context != NULL);
candidate = nb_running_get_entry(args->dnode, NULL, true); candidate = nb_running_get_entry(args->dnode, NULL, true);
type = yang_dnode_get_enum(args->dnode, "./type"); type = yang_dnode_get_enum(args->dnode, "type");
srte_candidate_unset_metric(candidate, type); srte_candidate_unset_metric(candidate, type);
return NB_OK; return NB_OK;
@ -557,13 +557,13 @@ void pathd_srte_policy_candidate_path_metrics_apply_finish(
candidate = nb_running_get_entry(args->dnode, NULL, true); candidate = nb_running_get_entry(args->dnode, NULL, true);
type = yang_dnode_get_enum(args->dnode, "./type"); type = yang_dnode_get_enum(args->dnode, "type");
value = (float)yang_dnode_get_dec64(args->dnode, "./value"); value = (float)yang_dnode_get_dec64(args->dnode, "value");
required = yang_dnode_get_bool(args->dnode, "./required"); required = yang_dnode_get_bool(args->dnode, "required");
if (yang_dnode_exists(args->dnode, "./is-bound")) if (yang_dnode_exists(args->dnode, "is-bound"))
is_bound = yang_dnode_get_bool(args->dnode, "./is-bound"); is_bound = yang_dnode_get_bool(args->dnode, "is-bound");
if (yang_dnode_exists(args->dnode, "./is-computed")) if (yang_dnode_exists(args->dnode, "is-computed"))
is_computed = yang_dnode_get_bool(args->dnode, "./is-computed"); is_computed = yang_dnode_get_bool(args->dnode, "is-computed");
srte_candidate_set_metric(candidate, type, value, required, is_bound, srte_candidate_set_metric(candidate, type, value, required, is_bound,
is_computed); is_computed);
@ -597,8 +597,8 @@ void pathd_srte_policy_candidate_path_objfun_apply_finish(
bool required; bool required;
candidate = nb_running_get_entry(args->dnode, NULL, true); candidate = nb_running_get_entry(args->dnode, NULL, true);
required = yang_dnode_get_bool(args->dnode, "./required"); required = yang_dnode_get_bool(args->dnode, "required");
type = yang_dnode_get_enum(args->dnode, "./type"); type = yang_dnode_get_enum(args->dnode, "type");
srte_candidate_set_objfun(candidate, required, type); srte_candidate_set_objfun(candidate, required, type);
} }
@ -739,8 +739,8 @@ void pathd_srte_policy_candidate_path_bandwidth_apply_finish(
assert(args->context != NULL); assert(args->context != NULL);
candidate = nb_running_get_entry(args->dnode, NULL, true); candidate = nb_running_get_entry(args->dnode, NULL, true);
value = (float)yang_dnode_get_dec64(args->dnode, "./value"); value = (float)yang_dnode_get_dec64(args->dnode, "value");
required = yang_dnode_get_bool(args->dnode, "./required"); required = yang_dnode_get_bool(args->dnode, "required");
srte_candidate_set_bandwidth(candidate, value, required); srte_candidate_set_bandwidth(candidate, value, required);
} }

View file

@ -68,7 +68,7 @@ const char *pim_cli_get_vrf_name(struct vty *vty)
return NULL; return NULL;
} }
return yang_dnode_get_string(vrf_node, "./name"); return yang_dnode_get_string(vrf_node, "name");
} }
int pim_process_join_prune_cmd(struct vty *vty, const char *jpi_str) int pim_process_join_prune_cmd(struct vty *vty, const char *jpi_str)

View file

@ -485,7 +485,7 @@ int routing_control_plane_protocols_name_validate(
{ {
const char *name; const char *name;
name = yang_dnode_get_string(args->dnode, "./name"); name = yang_dnode_get_string(args->dnode, "name");
if (!strmatch(name, "pim")) { if (!strmatch(name, "pim")) {
snprintf(args->errmsg, args->errmsg_len, snprintf(args->errmsg, args->errmsg_len,
"pim supports only one instance with name pimd"); "pim supports only one instance with name pimd");
@ -779,7 +779,7 @@ void routing_control_plane_protocols_control_plane_protocol_pim_address_family_s
vrf = nb_running_get_entry(args->dnode, NULL, true); vrf = nb_running_get_entry(args->dnode, NULL, true);
pim = vrf->info; pim = vrf->info;
spt_switch_action = yang_dnode_get_enum(args->dnode, "./spt-action"); spt_switch_action = yang_dnode_get_enum(args->dnode, "spt-action");
switch (spt_switch_action) { switch (spt_switch_action) {
case PIM_SPT_INFINITY: case PIM_SPT_INFINITY:
@ -1233,8 +1233,8 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_ms
case NB_EV_APPLY: case NB_EV_APPLY:
vrf = nb_running_get_entry(args->dnode, NULL, true); vrf = nb_running_get_entry(args->dnode, NULL, true);
pim = vrf->info; pim = vrf->info;
yang_dnode_get_ip(&peer_ip, args->dnode, "./peer-ip"); yang_dnode_get_ip(&peer_ip, args->dnode, "peer-ip");
yang_dnode_get_ip(&source_ip, args->dnode, "./source-ip"); yang_dnode_get_ip(&source_ip, args->dnode, "source-ip");
mp = pim_msdp_peer_add(pim, &peer_ip.ipaddr_v4, mp = pim_msdp_peer_add(pim, &peer_ip.ipaddr_v4,
&source_ip.ipaddr_v4, NULL); &source_ip.ipaddr_v4, NULL);
nb_running_set_entry(args->dnode, mp); nb_running_set_entry(args->dnode, mp);
@ -1338,16 +1338,16 @@ void routing_control_plane_protocols_control_plane_protocol_pim_address_family_m
struct interface *ifp; struct interface *ifp;
struct ipaddr reg_addr; struct ipaddr reg_addr;
ifname = yang_dnode_get_string(args->dnode, "./peerlink-rif"); ifname = yang_dnode_get_string(args->dnode, "peerlink-rif");
ifp = if_lookup_by_name(ifname, VRF_DEFAULT); ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
if (!ifp) { if (!ifp) {
snprintf(args->errmsg, args->errmsg_len, snprintf(args->errmsg, args->errmsg_len,
"No such interface name %s", ifname); "No such interface name %s", ifname);
return; return;
} }
role = yang_dnode_get_enum(args->dnode, "./my-role"); role = yang_dnode_get_enum(args->dnode, "my-role");
peer_state = yang_dnode_get_bool(args->dnode, "./peer-state"); peer_state = yang_dnode_get_bool(args->dnode, "peer-state");
yang_dnode_get_ip(&reg_addr, args->dnode, "./reg-address"); yang_dnode_get_ip(&reg_addr, args->dnode, "reg-address");
pim_vxlan_mlag_update(true, peer_state, role, ifp, pim_vxlan_mlag_update(true, peer_state, role, ifp,
&reg_addr.ip._v4_addr); &reg_addr.ip._v4_addr);
@ -1759,11 +1759,11 @@ void lib_interface_pim_address_family_bfd_apply_finish(
} }
pim_ifp->bfd_config.detection_multiplier = pim_ifp->bfd_config.detection_multiplier =
yang_dnode_get_uint8(args->dnode, "./detect_mult"); yang_dnode_get_uint8(args->dnode, "detect_mult");
pim_ifp->bfd_config.min_rx = pim_ifp->bfd_config.min_rx =
yang_dnode_get_uint16(args->dnode, "./min-rx-interval"); yang_dnode_get_uint16(args->dnode, "min-rx-interval");
pim_ifp->bfd_config.min_tx = pim_ifp->bfd_config.min_tx =
yang_dnode_get_uint16(args->dnode, "./min-tx-interval"); yang_dnode_get_uint16(args->dnode, "min-tx-interval");
pim_bfd_reg_dereg_all_nbr(ifp); pim_bfd_reg_dereg_all_nbr(ifp);
} }
@ -2191,7 +2191,7 @@ int lib_interface_pim_address_family_mroute_destroy(
pim_iifp = iif->info; pim_iifp = iif->info;
pim = pim_iifp->pim; pim = pim_iifp->pim;
oifname = yang_dnode_get_string(args->dnode, "./oif"); oifname = yang_dnode_get_string(args->dnode, "oif");
oif = if_lookup_by_name(oifname, pim->vrf->vrf_id); oif = if_lookup_by_name(oifname, pim->vrf->vrf_id);
if (!oif) { if (!oif) {
@ -2201,8 +2201,8 @@ int lib_interface_pim_address_family_mroute_destroy(
return NB_ERR_INCONSISTENCY; return NB_ERR_INCONSISTENCY;
} }
yang_dnode_get_pimaddr(&source_addr, args->dnode, "./source-addr"); yang_dnode_get_pimaddr(&source_addr, args->dnode, "source-addr");
yang_dnode_get_pimaddr(&group_addr, args->dnode, "./group-addr"); yang_dnode_get_pimaddr(&group_addr, args->dnode, "group-addr");
if (pim_static_del(pim, iif, oif, group_addr, source_addr)) { if (pim_static_del(pim, iif, oif, group_addr, source_addr)) {
snprintf(args->errmsg, args->errmsg_len, snprintf(args->errmsg, args->errmsg_len,
@ -2341,9 +2341,9 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp
case NB_EV_APPLY: case NB_EV_APPLY:
vrf = nb_running_get_entry(args->dnode, NULL, true); vrf = nb_running_get_entry(args->dnode, NULL, true);
pim = vrf->info; pim = vrf->info;
yang_dnode_get_pimaddr(&rp_addr, args->dnode, "./rp-address"); yang_dnode_get_pimaddr(&rp_addr, args->dnode, "rp-address");
if (yang_dnode_get(args->dnode, "./group-list")) { if (yang_dnode_get(args->dnode, "group-list")) {
yang_dnode_get_prefix(&group, args->dnode, yang_dnode_get_prefix(&group, args->dnode,
"./group-list"); "./group-list");
apply_mask(&group); apply_mask(&group);
@ -2352,7 +2352,7 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_rp
args->errmsg_len); args->errmsg_len);
} }
else if (yang_dnode_get(args->dnode, "./prefix-list")) { else if (yang_dnode_get(args->dnode, "prefix-list")) {
plist = yang_dnode_get_string(args->dnode, plist = yang_dnode_get_string(args->dnode,
"./prefix-list"); "./prefix-list");
if (!pim_get_all_mcast_group(&group)) { if (!pim_get_all_mcast_group(&group)) {

View file

@ -73,7 +73,7 @@ void cli_show_router_rip(struct vty *vty, const struct lyd_node *dnode,
{ {
const char *vrf_name; const char *vrf_name;
vrf_name = yang_dnode_get_string(dnode, "./vrf"); vrf_name = yang_dnode_get_string(dnode, "vrf");
vty_out(vty, "!\n"); vty_out(vty, "!\n");
vty_out(vty, "router rip"); vty_out(vty, "router rip");
@ -255,11 +255,11 @@ void cli_show_rip_distance_source(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " distance %s %s", vty_out(vty, " distance %s %s",
yang_dnode_get_string(dnode, "./distance"), yang_dnode_get_string(dnode, "distance"),
yang_dnode_get_string(dnode, "./prefix")); yang_dnode_get_string(dnode, "prefix"));
if (yang_dnode_exists(dnode, "./access-list")) if (yang_dnode_exists(dnode, "access-list"))
vty_out(vty, " %s", vty_out(vty, " %s",
yang_dnode_get_string(dnode, "./access-list")); yang_dnode_get_string(dnode, "access-list"));
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -362,12 +362,12 @@ void cli_show_rip_offset_list(struct vty *vty, const struct lyd_node *dnode,
{ {
const char *interface; const char *interface;
interface = yang_dnode_get_string(dnode, "./interface"); interface = yang_dnode_get_string(dnode, "interface");
vty_out(vty, " offset-list %s %s %s", vty_out(vty, " offset-list %s %s %s",
yang_dnode_get_string(dnode, "./access-list"), yang_dnode_get_string(dnode, "access-list"),
yang_dnode_get_string(dnode, "./direction"), yang_dnode_get_string(dnode, "direction"),
yang_dnode_get_string(dnode, "./metric")); yang_dnode_get_string(dnode, "metric"));
if (!strmatch(interface, "*")) if (!strmatch(interface, "*"))
vty_out(vty, " %s", interface); vty_out(vty, " %s", interface);
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -475,13 +475,13 @@ void cli_show_rip_redistribute(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " redistribute %s", vty_out(vty, " redistribute %s",
yang_dnode_get_string(dnode, "./protocol")); yang_dnode_get_string(dnode, "protocol"));
if (yang_dnode_exists(dnode, "./metric")) if (yang_dnode_exists(dnode, "metric"))
vty_out(vty, " metric %s", vty_out(vty, " metric %s",
yang_dnode_get_string(dnode, "./metric")); yang_dnode_get_string(dnode, "metric"));
if (yang_dnode_exists(dnode, "./route-map")) if (yang_dnode_exists(dnode, "route-map"))
vty_out(vty, " route-map %s", vty_out(vty, " route-map %s",
yang_dnode_get_string(dnode, "./route-map")); yang_dnode_get_string(dnode, "route-map"));
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -550,9 +550,9 @@ void cli_show_rip_timers(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " timers basic %s %s %s\n", vty_out(vty, " timers basic %s %s %s\n",
yang_dnode_get_string(dnode, "./update-interval"), yang_dnode_get_string(dnode, "update-interval"),
yang_dnode_get_string(dnode, "./holddown-interval"), yang_dnode_get_string(dnode, "holddown-interval"),
yang_dnode_get_string(dnode, "./flush-interval")); yang_dnode_get_string(dnode, "flush-interval"));
} }
/* /*
@ -591,7 +591,7 @@ void cli_show_rip_version(struct vty *vty, const struct lyd_node *dnode,
* We have only one "version" command and three possible combinations of * We have only one "version" command and three possible combinations of
* send/receive values. * send/receive values.
*/ */
switch (yang_dnode_get_enum(dnode, "./receive")) { switch (yang_dnode_get_enum(dnode, "receive")) {
case RI_RIP_VERSION_1: case RI_RIP_VERSION_1:
vty_out(vty, " version 1\n"); vty_out(vty, " version 1\n");
break; break;
@ -912,7 +912,7 @@ void cli_show_ip_rip_authentication_scheme(struct vty *vty,
const struct lyd_node *dnode, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
switch (yang_dnode_get_enum(dnode, "./mode")) { switch (yang_dnode_get_enum(dnode, "mode")) {
case RIP_NO_AUTH: case RIP_NO_AUTH:
vty_out(vty, " no ip rip authentication mode\n"); vty_out(vty, " no ip rip authentication mode\n");
break; break;
@ -922,8 +922,8 @@ void cli_show_ip_rip_authentication_scheme(struct vty *vty,
case RIP_AUTH_MD5: case RIP_AUTH_MD5:
vty_out(vty, " ip rip authentication mode md5"); vty_out(vty, " ip rip authentication mode md5");
if (show_defaults if (show_defaults
|| !yang_dnode_is_default(dnode, "./md5-auth-length")) { || !yang_dnode_is_default(dnode, "md5-auth-length")) {
if (yang_dnode_get_enum(dnode, "./md5-auth-length") if (yang_dnode_get_enum(dnode, "md5-auth-length")
== RIP_AUTH_MD5_SIZE) == RIP_AUTH_MD5_SIZE)
vty_out(vty, " auth-length rfc"); vty_out(vty, " auth-length rfc");
else else

View file

@ -35,7 +35,7 @@ int ripd_instance_create(struct nb_cb_create_args *args)
const char *vrf_name; const char *vrf_name;
int socket; int socket;
vrf_name = yang_dnode_get_string(args->dnode, "./vrf"); vrf_name = yang_dnode_get_string(args->dnode, "vrf");
vrf = vrf_lookup_by_name(vrf_name); vrf = vrf_lookup_by_name(vrf_name);
/* /*
@ -189,7 +189,7 @@ int ripd_instance_distance_source_create(struct nb_cb_create_args *args)
if (args->event != NB_EV_APPLY) if (args->event != NB_EV_APPLY)
return NB_OK; return NB_OK;
yang_dnode_get_ipv4p(&prefix, args->dnode, "./prefix"); yang_dnode_get_ipv4p(&prefix, args->dnode, "prefix");
apply_mask_ipv4(&prefix); apply_mask_ipv4(&prefix);
/* Get RIP distance node. */ /* Get RIP distance node. */
@ -395,7 +395,7 @@ int ripd_instance_offset_list_create(struct nb_cb_create_args *args)
return NB_OK; return NB_OK;
rip = nb_running_get_entry(args->dnode, NULL, true); rip = nb_running_get_entry(args->dnode, NULL, true);
ifname = yang_dnode_get_string(args->dnode, "./interface"); ifname = yang_dnode_get_string(args->dnode, "interface");
offset = rip_offset_list_new(rip, ifname); offset = rip_offset_list_new(rip, ifname);
nb_running_set_entry(args->dnode, offset); nb_running_set_entry(args->dnode, offset);
@ -411,7 +411,7 @@ int ripd_instance_offset_list_destroy(struct nb_cb_destroy_args *args)
if (args->event != NB_EV_APPLY) if (args->event != NB_EV_APPLY)
return NB_OK; return NB_OK;
direct = yang_dnode_get_enum(args->dnode, "./direction"); direct = yang_dnode_get_enum(args->dnode, "direction");
offset = nb_running_unset_entry(args->dnode); offset = nb_running_unset_entry(args->dnode);
if (offset->direct[direct].alist_name) { if (offset->direct[direct].alist_name) {
@ -560,7 +560,7 @@ int ripd_instance_redistribute_create(struct nb_cb_create_args *args)
return NB_OK; return NB_OK;
rip = nb_running_get_entry(args->dnode, NULL, true); rip = nb_running_get_entry(args->dnode, NULL, true);
type = yang_dnode_get_enum(args->dnode, "./protocol"); type = yang_dnode_get_enum(args->dnode, "protocol");
rip->redist[type].enabled = true; rip->redist[type].enabled = true;
@ -576,7 +576,7 @@ int ripd_instance_redistribute_destroy(struct nb_cb_destroy_args *args)
return NB_OK; return NB_OK;
rip = nb_running_get_entry(args->dnode, NULL, true); rip = nb_running_get_entry(args->dnode, NULL, true);
type = yang_dnode_get_enum(args->dnode, "./protocol"); type = yang_dnode_get_enum(args->dnode, "protocol");
rip->redist[type].enabled = false; rip->redist[type].enabled = false;
if (rip->redist[type].route_map.name) { if (rip->redist[type].route_map.name) {
@ -600,7 +600,7 @@ void ripd_instance_redistribute_apply_finish(
int type; int type;
rip = nb_running_get_entry(args->dnode, NULL, true); rip = nb_running_get_entry(args->dnode, NULL, true);
type = yang_dnode_get_enum(args->dnode, "./protocol"); type = yang_dnode_get_enum(args->dnode, "protocol");
if (rip->enabled) if (rip->enabled)
rip_redistribute_conf_update(rip, type); rip_redistribute_conf_update(rip, type);
@ -1123,12 +1123,12 @@ int lib_interface_rip_bfd_create(struct nb_cb_create_args *args)
ifp = nb_running_get_entry(args->dnode, NULL, true); ifp = nb_running_get_entry(args->dnode, NULL, true);
ri = ifp->info; ri = ifp->info;
ri->bfd.enabled = yang_dnode_get_bool(args->dnode, "./enable"); ri->bfd.enabled = yang_dnode_get_bool(args->dnode, "enable");
XFREE(MTYPE_RIP_BFD_PROFILE, ri->bfd.profile); XFREE(MTYPE_RIP_BFD_PROFILE, ri->bfd.profile);
if (yang_dnode_exists(args->dnode, "./profile")) if (yang_dnode_exists(args->dnode, "profile"))
ri->bfd.profile = XSTRDUP( ri->bfd.profile = XSTRDUP(
MTYPE_RIP_BFD_PROFILE, MTYPE_RIP_BFD_PROFILE,
yang_dnode_get_string(args->dnode, "./profile")); yang_dnode_get_string(args->dnode, "profile"));
rip_bfd_interface_update(ri); rip_bfd_interface_update(ri);

View file

@ -73,7 +73,7 @@ void cli_show_router_ripng(struct vty *vty, const struct lyd_node *dnode,
{ {
const char *vrf_name; const char *vrf_name;
vrf_name = yang_dnode_get_string(dnode, "./vrf"); vrf_name = yang_dnode_get_string(dnode, "vrf");
vty_out(vty, "!\n"); vty_out(vty, "!\n");
vty_out(vty, "router ripng"); vty_out(vty, "router ripng");
@ -267,12 +267,12 @@ void cli_show_ripng_offset_list(struct vty *vty, const struct lyd_node *dnode,
{ {
const char *interface; const char *interface;
interface = yang_dnode_get_string(dnode, "./interface"); interface = yang_dnode_get_string(dnode, "interface");
vty_out(vty, " offset-list %s %s %s", vty_out(vty, " offset-list %s %s %s",
yang_dnode_get_string(dnode, "./access-list"), yang_dnode_get_string(dnode, "access-list"),
yang_dnode_get_string(dnode, "./direction"), yang_dnode_get_string(dnode, "direction"),
yang_dnode_get_string(dnode, "./metric")); yang_dnode_get_string(dnode, "metric"));
if (!strmatch(interface, "*")) if (!strmatch(interface, "*"))
vty_out(vty, " %s", interface); vty_out(vty, " %s", interface);
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -335,13 +335,13 @@ void cli_show_ripng_redistribute(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " redistribute %s", vty_out(vty, " redistribute %s",
yang_dnode_get_string(dnode, "./protocol")); yang_dnode_get_string(dnode, "protocol"));
if (yang_dnode_exists(dnode, "./metric")) if (yang_dnode_exists(dnode, "metric"))
vty_out(vty, " metric %s", vty_out(vty, " metric %s",
yang_dnode_get_string(dnode, "./metric")); yang_dnode_get_string(dnode, "metric"));
if (yang_dnode_exists(dnode, "./route-map")) if (yang_dnode_exists(dnode, "route-map"))
vty_out(vty, " route-map %s", vty_out(vty, " route-map %s",
yang_dnode_get_string(dnode, "./route-map")); yang_dnode_get_string(dnode, "route-map"));
vty_out(vty, "\n"); vty_out(vty, "\n");
} }
@ -435,9 +435,9 @@ void cli_show_ripng_timers(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
vty_out(vty, " timers basic %s %s %s\n", vty_out(vty, " timers basic %s %s %s\n",
yang_dnode_get_string(dnode, "./update-interval"), yang_dnode_get_string(dnode, "update-interval"),
yang_dnode_get_string(dnode, "./holddown-interval"), yang_dnode_get_string(dnode, "holddown-interval"),
yang_dnode_get_string(dnode, "./flush-interval")); yang_dnode_get_string(dnode, "flush-interval"));
} }
/* /*

View file

@ -35,7 +35,7 @@ int ripngd_instance_create(struct nb_cb_create_args *args)
const char *vrf_name; const char *vrf_name;
int socket; int socket;
vrf_name = yang_dnode_get_string(args->dnode, "./vrf"); vrf_name = yang_dnode_get_string(args->dnode, "vrf");
vrf = vrf_lookup_by_name(vrf_name); vrf = vrf_lookup_by_name(vrf_name);
/* /*
@ -262,7 +262,7 @@ int ripngd_instance_offset_list_create(struct nb_cb_create_args *args)
return NB_OK; return NB_OK;
ripng = nb_running_get_entry(args->dnode, NULL, true); ripng = nb_running_get_entry(args->dnode, NULL, true);
ifname = yang_dnode_get_string(args->dnode, "./interface"); ifname = yang_dnode_get_string(args->dnode, "interface");
offset = ripng_offset_list_new(ripng, ifname); offset = ripng_offset_list_new(ripng, ifname);
nb_running_set_entry(args->dnode, offset); nb_running_set_entry(args->dnode, offset);
@ -278,7 +278,7 @@ int ripngd_instance_offset_list_destroy(struct nb_cb_destroy_args *args)
if (args->event != NB_EV_APPLY) if (args->event != NB_EV_APPLY)
return NB_OK; return NB_OK;
direct = yang_dnode_get_enum(args->dnode, "./direction"); direct = yang_dnode_get_enum(args->dnode, "direction");
offset = nb_running_unset_entry(args->dnode); offset = nb_running_unset_entry(args->dnode);
if (offset->direct[direct].alist_name) { if (offset->direct[direct].alist_name) {
@ -380,7 +380,7 @@ int ripngd_instance_redistribute_create(struct nb_cb_create_args *args)
return NB_OK; return NB_OK;
ripng = nb_running_get_entry(args->dnode, NULL, true); ripng = nb_running_get_entry(args->dnode, NULL, true);
type = yang_dnode_get_enum(args->dnode, "./protocol"); type = yang_dnode_get_enum(args->dnode, "protocol");
ripng->redist[type].enabled = true; ripng->redist[type].enabled = true;
@ -396,7 +396,7 @@ int ripngd_instance_redistribute_destroy(struct nb_cb_destroy_args *args)
return NB_OK; return NB_OK;
ripng = nb_running_get_entry(args->dnode, NULL, true); ripng = nb_running_get_entry(args->dnode, NULL, true);
type = yang_dnode_get_enum(args->dnode, "./protocol"); type = yang_dnode_get_enum(args->dnode, "protocol");
ripng->redist[type].enabled = false; ripng->redist[type].enabled = false;
if (ripng->redist[type].route_map.name) { if (ripng->redist[type].route_map.name) {
@ -420,7 +420,7 @@ void ripngd_instance_redistribute_apply_finish(
int type; int type;
ripng = nb_running_get_entry(args->dnode, NULL, true); ripng = nb_running_get_entry(args->dnode, NULL, true);
type = yang_dnode_get_enum(args->dnode, "./protocol"); type = yang_dnode_get_enum(args->dnode, "protocol");
if (ripng->enabled) if (ripng->enabled)
ripng_redistribute_conf_update(ripng, type); ripng_redistribute_conf_update(ripng, type);

View file

@ -91,11 +91,11 @@ void static_next_hop_bfd_monitor_enable(struct static_nexthop *sn,
struct vrf *vrf = NULL; struct vrf *vrf = NULL;
use_interface = false; use_interface = false;
use_source = yang_dnode_exists(dnode, "./source"); use_source = yang_dnode_exists(dnode, "source");
use_profile = yang_dnode_exists(dnode, "./profile"); use_profile = yang_dnode_exists(dnode, "profile");
onlink = yang_dnode_exists(dnode, "../onlink") && onlink = yang_dnode_exists(dnode, "../onlink") &&
yang_dnode_get_bool(dnode, "../onlink"); yang_dnode_get_bool(dnode, "../onlink");
mhop = yang_dnode_get_bool(dnode, "./multi-hop"); mhop = yang_dnode_get_bool(dnode, "multi-hop");
vrf = vrf_lookup_by_name(yang_dnode_get_string(dnode, "../vrf")); vrf = vrf_lookup_by_name(yang_dnode_get_string(dnode, "../vrf"));
family = static_next_hop_type_to_family(sn); family = static_next_hop_type_to_family(sn);
@ -112,7 +112,7 @@ void static_next_hop_bfd_monitor_enable(struct static_nexthop *sn,
/* Configure the session. */ /* Configure the session. */
if (use_source) if (use_source)
yang_dnode_get_ip(&source, dnode, "./source"); yang_dnode_get_ip(&source, dnode, "source");
if (onlink || mhop == false) if (onlink || mhop == false)
bfd_sess_set_auto_source(sn->bsp, false); bfd_sess_set_auto_source(sn->bsp, false);

View file

@ -33,8 +33,8 @@ static int static_path_list_create(struct nb_cb_create_args *args)
case NB_EV_VALIDATE: case NB_EV_VALIDATE:
vrf_dnode = yang_dnode_get_parent(args->dnode, vrf_dnode = yang_dnode_get_parent(args->dnode,
"control-plane-protocol"); "control-plane-protocol");
vrf = yang_dnode_get_string(vrf_dnode, "./vrf"); vrf = yang_dnode_get_string(vrf_dnode, "vrf");
table_id = yang_dnode_get_uint32(args->dnode, "./table-id"); table_id = yang_dnode_get_uint32(args->dnode, "table-id");
/* /*
* TableId is not applicable for VRF. Consider the case of * TableId is not applicable for VRF. Consider the case of
@ -55,8 +55,8 @@ static int static_path_list_create(struct nb_cb_create_args *args)
break; break;
case NB_EV_APPLY: case NB_EV_APPLY:
rn = nb_running_get_entry(args->dnode, NULL, true); rn = nb_running_get_entry(args->dnode, NULL, true);
distance = yang_dnode_get_uint8(args->dnode, "./distance"); distance = yang_dnode_get_uint8(args->dnode, "distance");
table_id = yang_dnode_get_uint32(args->dnode, "./table-id"); table_id = yang_dnode_get_uint32(args->dnode, "table-id");
pn = static_add_path(rn, table_id, distance); pn = static_add_path(rn, table_id, distance);
nb_running_set_entry(args->dnode, pn); nb_running_set_entry(args->dnode, pn);
} }
@ -111,7 +111,7 @@ static int nexthop_iter_cb(const struct lyd_node *dnode, void *arg)
struct nexthop_iter *iter = arg; struct nexthop_iter *iter = arg;
enum static_nh_type nh_type; enum static_nh_type nh_type;
nh_type = yang_dnode_get_enum(dnode, "./nh-type"); nh_type = yang_dnode_get_enum(dnode, "nh-type");
if (nh_type == STATIC_BLACKHOLE) if (nh_type == STATIC_BLACKHOLE)
iter->blackhole = true; iter->blackhole = true;
@ -134,8 +134,8 @@ static bool static_nexthop_create(struct nb_cb_create_args *args)
switch (args->event) { switch (args->event) {
case NB_EV_VALIDATE: case NB_EV_VALIDATE:
ifname = yang_dnode_get_string(args->dnode, "./interface"); ifname = yang_dnode_get_string(args->dnode, "interface");
nh_type = yang_dnode_get_enum(args->dnode, "./nh-type"); nh_type = yang_dnode_get_enum(args->dnode, "nh-type");
if (ifname != NULL && nh_type != STATIC_BLACKHOLE) { if (ifname != NULL && nh_type != STATIC_BLACKHOLE) {
if (strcasecmp(ifname, "Null0") == 0 if (strcasecmp(ifname, "Null0") == 0
|| strcasecmp(ifname, "reject") == 0 || strcasecmp(ifname, "reject") == 0
@ -170,10 +170,10 @@ static bool static_nexthop_create(struct nb_cb_create_args *args)
case NB_EV_ABORT: case NB_EV_ABORT:
break; break;
case NB_EV_APPLY: case NB_EV_APPLY:
yang_dnode_get_ip(&ipaddr, args->dnode, "./gateway"); yang_dnode_get_ip(&ipaddr, args->dnode, "gateway");
nh_type = yang_dnode_get_enum(args->dnode, "./nh-type"); nh_type = yang_dnode_get_enum(args->dnode, "nh-type");
ifname = yang_dnode_get_string(args->dnode, "./interface"); ifname = yang_dnode_get_string(args->dnode, "interface");
nh_vrf = yang_dnode_get_string(args->dnode, "./vrf"); nh_vrf = yang_dnode_get_string(args->dnode, "vrf");
pn = nb_running_get_entry(args->dnode, NULL, true); pn = nb_running_get_entry(args->dnode, NULL, true);
if (!static_add_nexthop_validate(nh_vrf, nh_type, &ipaddr)) if (!static_add_nexthop_validate(nh_vrf, nh_type, &ipaddr))
@ -535,7 +535,7 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_pa
const struct lyd_node *mls_dnode; const struct lyd_node *mls_dnode;
uint32_t count; uint32_t count;
mls_dnode = yang_dnode_get(args->dnode, "./mpls-label-stack"); mls_dnode = yang_dnode_get(args->dnode, "mpls-label-stack");
count = yang_get_list_elements_count(lyd_child(mls_dnode)); count = yang_get_list_elements_count(lyd_child(mls_dnode));
if (count > MPLS_MAX_LABELS) { if (count > MPLS_MAX_LABELS) {
@ -552,7 +552,7 @@ int routing_control_plane_protocols_name_validate(
{ {
const char *name; const char *name;
name = yang_dnode_get_string(args->dnode, "./name"); name = yang_dnode_get_string(args->dnode, "name");
if (!strmatch(name, "staticd")) { if (!strmatch(name, "staticd")) {
snprintf(args->errmsg, args->errmsg_len, snprintf(args->errmsg, args->errmsg_len,
"static routing supports only one instance with name staticd"); "static routing supports only one instance with name staticd");
@ -579,15 +579,15 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
switch (args->event) { switch (args->event) {
case NB_EV_VALIDATE: case NB_EV_VALIDATE:
yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
afi_safi = yang_dnode_get_string(args->dnode, "./afi-safi"); afi_safi = yang_dnode_get_string(args->dnode, "afi-safi");
yang_afi_safi_identity2value(afi_safi, &afi, &safi); yang_afi_safi_identity2value(afi_safi, &afi, &safi);
prefix_afi = family2afi(prefix.family); prefix_afi = family2afi(prefix.family);
if (afi != prefix_afi) { if (afi != prefix_afi) {
flog_warn( flog_warn(
EC_LIB_NB_CB_CONFIG_VALIDATE, EC_LIB_NB_CB_CONFIG_VALIDATE,
"route node %s creation failed", "route node %s creation failed",
yang_dnode_get_string(args->dnode, "./prefix")); yang_dnode_get_string(args->dnode, "prefix"));
return NB_ERR_VALIDATION; return NB_ERR_VALIDATION;
} }
break; break;
@ -600,8 +600,8 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
vrf = nb_running_get_entry(vrf_dnode, NULL, true); vrf = nb_running_get_entry(vrf_dnode, NULL, true);
s_vrf = vrf->info; s_vrf = vrf->info;
yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
afi_safi = yang_dnode_get_string(args->dnode, "./afi-safi"); afi_safi = yang_dnode_get_string(args->dnode, "afi-safi");
yang_afi_safi_identity2value(afi_safi, &afi, &safi); yang_afi_safi_identity2value(afi_safi, &afi, &safi);
rn = static_add_route(afi, safi, &prefix, NULL, s_vrf); rn = static_add_route(afi, safi, &prefix, NULL, s_vrf);
@ -609,7 +609,7 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr
snprintf( snprintf(
args->errmsg, args->errmsg_len, args->errmsg, args->errmsg_len,
"Static Route to %s not installed currently because dependent config not fully available", "Static Route to %s not installed currently because dependent config not fully available",
yang_dnode_get_string(args->dnode, "./prefix")); yang_dnode_get_string(args->dnode, "prefix"));
nb_running_set_entry(args->dnode, rn); nb_running_set_entry(args->dnode, rn);
break; break;
} }
@ -1036,7 +1036,7 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_sr
rn = nb_running_get_entry(args->dnode, NULL, true); rn = nb_running_get_entry(args->dnode, NULL, true);
info = route_table_get_info(rn->table); info = route_table_get_info(rn->table);
s_vrf = info->svrf; s_vrf = info->svrf;
yang_dnode_get_ipv6p(&src_prefix, args->dnode, "./src-prefix"); yang_dnode_get_ipv6p(&src_prefix, args->dnode, "src-prefix");
afi = family2afi(src_prefix.family); afi = family2afi(src_prefix.family);
src_rn = src_rn =
static_add_route(afi, safi, &rn->p, &src_prefix, s_vrf); static_add_route(afi, safi, &rn->p, &src_prefix, s_vrf);

View file

@ -101,7 +101,7 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
return CMD_WARNING_CONFIG_FAILED; return CMD_WARNING_CONFIG_FAILED;
} }
args->vrf = yang_dnode_get_string(vrf_dnode, "./name"); args->vrf = yang_dnode_get_string(vrf_dnode, "name");
} else { } else {
if (args->vrf == NULL) if (args->vrf == NULL)
args->vrf = VRF_DEFAULT_NAME; args->vrf = VRF_DEFAULT_NAME;
@ -1264,13 +1264,13 @@ static int mpls_label_iter_cb(const struct lyd_node *dnode, void *arg)
{ {
struct mpls_label_iter *iter = arg; struct mpls_label_iter *iter = arg;
if (yang_dnode_exists(dnode, "./label")) { if (yang_dnode_exists(dnode, "label")) {
if (iter->first) if (iter->first)
vty_out(iter->vty, " label %s", vty_out(iter->vty, " label %s",
yang_dnode_get_string(dnode, "./label")); yang_dnode_get_string(dnode, "label"));
else else
vty_out(iter->vty, "/%s", vty_out(iter->vty, "/%s",
yang_dnode_get_string(dnode, "./label")); yang_dnode_get_string(dnode, "label"));
iter->first = false; iter->first = false;
} }
@ -1288,16 +1288,16 @@ static int srv6_seg_iter_cb(const struct lyd_node *dnode, void *arg)
char buffer[INET6_ADDRSTRLEN]; char buffer[INET6_ADDRSTRLEN];
struct in6_addr cli_seg; struct in6_addr cli_seg;
if (yang_dnode_exists(dnode, "./seg")) { if (yang_dnode_exists(dnode, "seg")) {
if (iter->first) { if (iter->first) {
yang_dnode_get_ipv6(&cli_seg, dnode, "./seg"); yang_dnode_get_ipv6(&cli_seg, dnode, "seg");
if (inet_ntop(AF_INET6, &cli_seg, buffer, if (inet_ntop(AF_INET6, &cli_seg, buffer,
INET6_ADDRSTRLEN) == NULL) { INET6_ADDRSTRLEN) == NULL) {
return 1; return 1;
} }
vty_out(iter->vty, " segments %s", buffer); vty_out(iter->vty, " segments %s", buffer);
} else { } else {
yang_dnode_get_ipv6(&cli_seg, dnode, "./seg"); yang_dnode_get_ipv6(&cli_seg, dnode, "seg");
if (inet_ntop(AF_INET6, &cli_seg, buffer, if (inet_ntop(AF_INET6, &cli_seg, buffer,
INET6_ADDRSTRLEN) == NULL) { INET6_ADDRSTRLEN) == NULL) {
return 1; return 1;
@ -1331,7 +1331,7 @@ static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
vrf = yang_dnode_get_string(route, "../../vrf"); vrf = yang_dnode_get_string(route, "../../vrf");
afi_safi = yang_dnode_get_string(route, "./afi-safi"); afi_safi = yang_dnode_get_string(route, "afi-safi");
yang_afi_safi_identity2value(afi_safi, &afi, &safi); yang_afi_safi_identity2value(afi_safi, &afi, &safi);
if (afi == AFI_IP) if (afi == AFI_IP)
@ -1346,32 +1346,32 @@ static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
else else
vty_out(vty, " mroute"); vty_out(vty, " mroute");
vty_out(vty, " %s", yang_dnode_get_string(route, "./prefix")); vty_out(vty, " %s", yang_dnode_get_string(route, "prefix"));
if (src) if (src)
vty_out(vty, " from %s", vty_out(vty, " from %s",
yang_dnode_get_string(src, "./src-prefix")); yang_dnode_get_string(src, "src-prefix"));
nh_type = yang_dnode_get_enum(nexthop, "./nh-type"); nh_type = yang_dnode_get_enum(nexthop, "nh-type");
switch (nh_type) { switch (nh_type) {
case STATIC_IFNAME: case STATIC_IFNAME:
vty_out(vty, " %s", vty_out(vty, " %s",
yang_dnode_get_string(nexthop, "./interface")); yang_dnode_get_string(nexthop, "interface"));
break; break;
case STATIC_IPV4_GATEWAY: case STATIC_IPV4_GATEWAY:
case STATIC_IPV6_GATEWAY: case STATIC_IPV6_GATEWAY:
vty_out(vty, " %s", vty_out(vty, " %s",
yang_dnode_get_string(nexthop, "./gateway")); yang_dnode_get_string(nexthop, "gateway"));
break; break;
case STATIC_IPV4_GATEWAY_IFNAME: case STATIC_IPV4_GATEWAY_IFNAME:
case STATIC_IPV6_GATEWAY_IFNAME: case STATIC_IPV6_GATEWAY_IFNAME:
vty_out(vty, " %s", vty_out(vty, " %s",
yang_dnode_get_string(nexthop, "./gateway")); yang_dnode_get_string(nexthop, "gateway"));
vty_out(vty, " %s", vty_out(vty, " %s",
yang_dnode_get_string(nexthop, "./interface")); yang_dnode_get_string(nexthop, "interface"));
break; break;
case STATIC_BLACKHOLE: case STATIC_BLACKHOLE:
bh_type = yang_dnode_get_enum(nexthop, "./bh-type"); bh_type = yang_dnode_get_enum(nexthop, "bh-type");
switch (bh_type) { switch (bh_type) {
case STATIC_BLACKHOLE_DROP: case STATIC_BLACKHOLE_DROP:
vty_out(vty, " blackhole"); vty_out(vty, " blackhole");
@ -1386,13 +1386,13 @@ static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
break; break;
} }
if (yang_dnode_exists(path, "./tag")) { if (yang_dnode_exists(path, "tag")) {
tag = yang_dnode_get_uint32(path, "./tag"); tag = yang_dnode_get_uint32(path, "tag");
if (tag != 0 || show_defaults) if (tag != 0 || show_defaults)
vty_out(vty, " tag %" PRIu32, tag); vty_out(vty, " tag %" PRIu32, tag);
} }
distance = yang_dnode_get_uint8(path, "./distance"); distance = yang_dnode_get_uint8(path, "distance");
if (distance != ZEBRA_STATIC_DISTANCE_DEFAULT || show_defaults) if (distance != ZEBRA_STATIC_DISTANCE_DEFAULT || show_defaults)
vty_out(vty, " %" PRIu8, distance); vty_out(vty, " %" PRIu8, distance);
@ -1406,41 +1406,41 @@ static void nexthop_cli_show(struct vty *vty, const struct lyd_node *route,
yang_dnode_iterate(srv6_seg_iter_cb, &seg_iter, nexthop, yang_dnode_iterate(srv6_seg_iter_cb, &seg_iter, nexthop,
"./srv6-segs-stack/entry"); "./srv6-segs-stack/entry");
nexthop_vrf = yang_dnode_get_string(nexthop, "./vrf"); nexthop_vrf = yang_dnode_get_string(nexthop, "vrf");
if (strcmp(vrf, nexthop_vrf)) if (strcmp(vrf, nexthop_vrf))
vty_out(vty, " nexthop-vrf %s", nexthop_vrf); vty_out(vty, " nexthop-vrf %s", nexthop_vrf);
table_id = yang_dnode_get_uint32(path, "./table-id"); table_id = yang_dnode_get_uint32(path, "table-id");
if (table_id || show_defaults) if (table_id || show_defaults)
vty_out(vty, " table %" PRIu32, table_id); vty_out(vty, " table %" PRIu32, table_id);
if (yang_dnode_exists(nexthop, "./onlink")) { if (yang_dnode_exists(nexthop, "onlink")) {
onlink = yang_dnode_get_bool(nexthop, "./onlink"); onlink = yang_dnode_get_bool(nexthop, "onlink");
if (onlink) if (onlink)
vty_out(vty, " onlink"); vty_out(vty, " onlink");
} }
if (yang_dnode_exists(nexthop, "./srte-color")) if (yang_dnode_exists(nexthop, "srte-color"))
vty_out(vty, " color %s", vty_out(vty, " color %s",
yang_dnode_get_string(nexthop, "./srte-color")); yang_dnode_get_string(nexthop, "srte-color"));
if (yang_dnode_exists(nexthop, "./bfd-monitoring")) { if (yang_dnode_exists(nexthop, "bfd-monitoring")) {
const struct lyd_node *bfd_dnode = const struct lyd_node *bfd_dnode =
yang_dnode_get(nexthop, "./bfd-monitoring"); yang_dnode_get(nexthop, "bfd-monitoring");
if (yang_dnode_get_bool(bfd_dnode, "./multi-hop")) { if (yang_dnode_get_bool(bfd_dnode, "multi-hop")) {
vty_out(vty, " bfd multi-hop"); vty_out(vty, " bfd multi-hop");
if (yang_dnode_exists(bfd_dnode, "./source")) if (yang_dnode_exists(bfd_dnode, "source"))
vty_out(vty, " source %s", vty_out(vty, " source %s",
yang_dnode_get_string(bfd_dnode, yang_dnode_get_string(bfd_dnode,
"./source")); "./source"));
} else } else
vty_out(vty, " bfd"); vty_out(vty, " bfd");
if (yang_dnode_exists(bfd_dnode, "./profile")) if (yang_dnode_exists(bfd_dnode, "profile"))
vty_out(vty, " profile %s", vty_out(vty, " profile %s",
yang_dnode_get_string(bfd_dnode, "./profile")); yang_dnode_get_string(bfd_dnode, "profile"));
} }
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -1476,8 +1476,8 @@ static int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
const char *vrf1, *vrf2; const char *vrf1, *vrf2;
int ret = 0; int ret = 0;
nh_type1 = yang_dnode_get_enum(dnode1, "./nh-type"); nh_type1 = yang_dnode_get_enum(dnode1, "nh-type");
nh_type2 = yang_dnode_get_enum(dnode2, "./nh-type"); nh_type2 = yang_dnode_get_enum(dnode2, "nh-type");
if (nh_type1 != nh_type2) if (nh_type1 != nh_type2)
return (int)nh_type1 - (int)nh_type2; return (int)nh_type1 - (int)nh_type2;
@ -1485,24 +1485,24 @@ static int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
switch (nh_type1) { switch (nh_type1) {
case STATIC_IFNAME: case STATIC_IFNAME:
ret = if_cmp_name_func( ret = if_cmp_name_func(
yang_dnode_get_string(dnode1, "./interface"), yang_dnode_get_string(dnode1, "interface"),
yang_dnode_get_string(dnode2, "./interface")); yang_dnode_get_string(dnode2, "interface"));
break; break;
case STATIC_IPV4_GATEWAY: case STATIC_IPV4_GATEWAY:
case STATIC_IPV6_GATEWAY: case STATIC_IPV6_GATEWAY:
yang_dnode_get_prefix(&prefix1, dnode1, "./gateway"); yang_dnode_get_prefix(&prefix1, dnode1, "gateway");
yang_dnode_get_prefix(&prefix2, dnode2, "./gateway"); yang_dnode_get_prefix(&prefix2, dnode2, "gateway");
ret = prefix_cmp(&prefix1, &prefix2); ret = prefix_cmp(&prefix1, &prefix2);
break; break;
case STATIC_IPV4_GATEWAY_IFNAME: case STATIC_IPV4_GATEWAY_IFNAME:
case STATIC_IPV6_GATEWAY_IFNAME: case STATIC_IPV6_GATEWAY_IFNAME:
yang_dnode_get_prefix(&prefix1, dnode1, "./gateway"); yang_dnode_get_prefix(&prefix1, dnode1, "gateway");
yang_dnode_get_prefix(&prefix2, dnode2, "./gateway"); yang_dnode_get_prefix(&prefix2, dnode2, "gateway");
ret = prefix_cmp(&prefix1, &prefix2); ret = prefix_cmp(&prefix1, &prefix2);
if (!ret) if (!ret)
ret = if_cmp_name_func( ret = if_cmp_name_func(
yang_dnode_get_string(dnode1, "./interface"), yang_dnode_get_string(dnode1, "interface"),
yang_dnode_get_string(dnode2, "./interface")); yang_dnode_get_string(dnode2, "interface"));
break; break;
case STATIC_BLACKHOLE: case STATIC_BLACKHOLE:
/* There's only one blackhole nexthop per route */ /* There's only one blackhole nexthop per route */
@ -1513,10 +1513,10 @@ static int static_nexthop_cli_cmp(const struct lyd_node *dnode1,
if (ret) if (ret)
return ret; return ret;
vrf1 = yang_dnode_get_string(dnode1, "./vrf"); vrf1 = yang_dnode_get_string(dnode1, "vrf");
if (strmatch(vrf1, "default")) if (strmatch(vrf1, "default"))
vrf1 = ""; vrf1 = "";
vrf2 = yang_dnode_get_string(dnode2, "./vrf"); vrf2 = yang_dnode_get_string(dnode2, "vrf");
if (strmatch(vrf2, "default")) if (strmatch(vrf2, "default"))
vrf2 = ""; vrf2 = "";
@ -1531,10 +1531,10 @@ static int static_route_list_cli_cmp(const struct lyd_node *dnode1,
safi_t safi1, safi2; safi_t safi1, safi2;
struct prefix prefix1, prefix2; struct prefix prefix1, prefix2;
afi_safi1 = yang_dnode_get_string(dnode1, "./afi-safi"); afi_safi1 = yang_dnode_get_string(dnode1, "afi-safi");
yang_afi_safi_identity2value(afi_safi1, &afi1, &safi1); yang_afi_safi_identity2value(afi_safi1, &afi1, &safi1);
afi_safi2 = yang_dnode_get_string(dnode2, "./afi-safi"); afi_safi2 = yang_dnode_get_string(dnode2, "afi-safi");
yang_afi_safi_identity2value(afi_safi2, &afi2, &safi2); yang_afi_safi_identity2value(afi_safi2, &afi2, &safi2);
if (afi1 != afi2) if (afi1 != afi2)
@ -1543,8 +1543,8 @@ static int static_route_list_cli_cmp(const struct lyd_node *dnode1,
if (safi1 != safi2) if (safi1 != safi2)
return (int)safi1 - (int)safi2; return (int)safi1 - (int)safi2;
yang_dnode_get_prefix(&prefix1, dnode1, "./prefix"); yang_dnode_get_prefix(&prefix1, dnode1, "prefix");
yang_dnode_get_prefix(&prefix2, dnode2, "./prefix"); yang_dnode_get_prefix(&prefix2, dnode2, "prefix");
return prefix_cmp(&prefix1, &prefix2); return prefix_cmp(&prefix1, &prefix2);
} }
@ -1554,8 +1554,8 @@ static int static_src_list_cli_cmp(const struct lyd_node *dnode1,
{ {
struct prefix prefix1, prefix2; struct prefix prefix1, prefix2;
yang_dnode_get_prefix(&prefix1, dnode1, "./src-prefix"); yang_dnode_get_prefix(&prefix1, dnode1, "src-prefix");
yang_dnode_get_prefix(&prefix2, dnode2, "./src-prefix"); yang_dnode_get_prefix(&prefix2, dnode2, "src-prefix");
return prefix_cmp(&prefix1, &prefix2); return prefix_cmp(&prefix1, &prefix2);
} }
@ -1566,14 +1566,14 @@ static int static_path_list_cli_cmp(const struct lyd_node *dnode1,
uint32_t table_id1, table_id2; uint32_t table_id1, table_id2;
uint8_t distance1, distance2; uint8_t distance1, distance2;
table_id1 = yang_dnode_get_uint32(dnode1, "./table-id"); table_id1 = yang_dnode_get_uint32(dnode1, "table-id");
table_id2 = yang_dnode_get_uint32(dnode2, "./table-id"); table_id2 = yang_dnode_get_uint32(dnode2, "table-id");
if (table_id1 != table_id2) if (table_id1 != table_id2)
return (int)table_id1 - (int)table_id2; return (int)table_id1 - (int)table_id2;
distance1 = yang_dnode_get_uint8(dnode1, "./distance"); distance1 = yang_dnode_get_uint8(dnode1, "distance");
distance2 = yang_dnode_get_uint8(dnode2, "./distance"); distance2 = yang_dnode_get_uint8(dnode2, "distance");
return (int)distance1 - (int)distance2; return (int)distance1 - (int)distance2;
} }

View file

@ -27,8 +27,8 @@ static int lib_interface_vrrp_vrrp_group_create(struct nb_cb_create_args *args)
uint8_t version = 3; uint8_t version = 3;
struct vrrp_vrouter *vr; struct vrrp_vrouter *vr;
vrid = yang_dnode_get_uint8(args->dnode, "./virtual-router-id"); vrid = yang_dnode_get_uint8(args->dnode, "virtual-router-id");
version = yang_dnode_get_enum(args->dnode, "./version"); version = yang_dnode_get_enum(args->dnode, "version");
switch (args->event) { switch (args->event) {
case NB_EV_VALIDATE: case NB_EV_VALIDATE:

View file

@ -62,11 +62,11 @@ DEFPY_YANG(vrrp_vrid,
void cli_show_vrrp(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) void cli_show_vrrp(struct vty *vty, const struct lyd_node *dnode, bool show_defaults)
{ {
const char *vrid = yang_dnode_get_string(dnode, "./virtual-router-id"); const char *vrid = yang_dnode_get_string(dnode, "virtual-router-id");
const char *ver = yang_dnode_get_string(dnode, "./version"); const char *ver = yang_dnode_get_string(dnode, "version");
vty_out(vty, " vrrp %s", vrid); vty_out(vty, " vrrp %s", vrid);
if (show_defaults || !yang_dnode_is_default(dnode, "./version")) if (show_defaults || !yang_dnode_is_default(dnode, "version"))
vty_out(vty, " version %s", ver); vty_out(vty, " version %s", ver);
vty_out(vty, "\n"); vty_out(vty, "\n");
} }

View file

@ -4804,11 +4804,11 @@ static int ag_iter_cb(const struct lyd_node *dnode, void *arg)
void cli_show_legacy_admin_group(struct vty *vty, const struct lyd_node *dnode, void cli_show_legacy_admin_group(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
if (!yang_dnode_exists(dnode, "./legacy-admin-group")) if (!yang_dnode_exists(dnode, "legacy-admin-group"))
return; return;
vty_out(vty, " admin-group 0x%x\n", vty_out(vty, " admin-group 0x%x\n",
yang_dnode_get_uint32(dnode, "./legacy-admin-group")); yang_dnode_get_uint32(dnode, "legacy-admin-group"));
} }
void cli_show_affinity_mode(struct vty *vty, const struct lyd_node *dnode, void cli_show_affinity_mode(struct vty *vty, const struct lyd_node *dnode,
@ -4825,11 +4825,11 @@ void cli_show_affinity_mode(struct vty *vty, const struct lyd_node *dnode,
void cli_show_affinity(struct vty *vty, const struct lyd_node *dnode, void cli_show_affinity(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults) bool show_defaults)
{ {
if (!yang_dnode_exists(dnode, "./affinity")) if (!yang_dnode_exists(dnode, "affinity"))
return; return;
vty_out(vty, " affinity"); vty_out(vty, " affinity");
yang_dnode_iterate(ag_iter_cb, vty, dnode, "./affinity"); yang_dnode_iterate(ag_iter_cb, vty, dnode, "affinity");
vty_out(vty, "\n"); vty_out(vty, "\n");
} }

View file

@ -830,8 +830,8 @@ int lib_interface_zebra_ip_addrs_create(struct nb_cb_create_args *args)
struct interface *ifp; struct interface *ifp;
struct prefix prefix; struct prefix prefix;
// addr_family = yang_dnode_get_enum(dnode, "./address-family"); // addr_family = yang_dnode_get_enum(dnode, "address-family");
yang_dnode_get_prefix(&prefix, args->dnode, "./ip-prefix"); yang_dnode_get_prefix(&prefix, args->dnode, "ip-prefix");
apply_mask(&prefix); apply_mask(&prefix);
switch (args->event) { switch (args->event) {
@ -870,7 +870,7 @@ int lib_interface_zebra_ip_addrs_destroy(struct nb_cb_destroy_args *args)
struct prefix prefix; struct prefix prefix;
struct connected *ifc; struct connected *ifc;
yang_dnode_get_prefix(&prefix, args->dnode, "./ip-prefix"); yang_dnode_get_prefix(&prefix, args->dnode, "ip-prefix");
apply_mask(&prefix); apply_mask(&prefix);
switch (args->event) { switch (args->event) {
@ -1033,7 +1033,7 @@ int lib_interface_zebra_link_detect_modify(struct nb_cb_modify_args *args)
bool link_detect; bool link_detect;
ifp = nb_running_get_entry(args->dnode, NULL, true); ifp = nb_running_get_entry(args->dnode, NULL, true);
link_detect = yang_dnode_get_bool(args->dnode, "./link-detect"); link_detect = yang_dnode_get_bool(args->dnode, "link-detect");
if_linkdetect(ifp, link_detect); if_linkdetect(ifp, link_detect);
@ -1049,7 +1049,7 @@ int lib_interface_zebra_link_detect_destroy(struct nb_cb_destroy_args *args)
bool link_detect; bool link_detect;
ifp = nb_running_get_entry(args->dnode, NULL, true); ifp = nb_running_get_entry(args->dnode, NULL, true);
link_detect = yang_dnode_get_bool(args->dnode, "./link-detect"); link_detect = yang_dnode_get_bool(args->dnode, "link-detect");
if_linkdetect(ifp, link_detect); if_linkdetect(ifp, link_detect);
@ -1143,7 +1143,7 @@ int lib_interface_zebra_bandwidth_modify(struct nb_cb_modify_args *args)
uint32_t bandwidth; uint32_t bandwidth;
ifp = nb_running_get_entry(args->dnode, NULL, true); ifp = nb_running_get_entry(args->dnode, NULL, true);
bandwidth = yang_dnode_get_uint32(args->dnode, "./bandwidth"); bandwidth = yang_dnode_get_uint32(args->dnode, "bandwidth");
ifp->bandwidth = bandwidth; ifp->bandwidth = bandwidth;
@ -1465,7 +1465,7 @@ int lib_vrf_zebra_l3vni_id_modify(struct nb_cb_modify_args *args)
* if zebra vrf already mapped to different vni id. * if zebra vrf already mapped to different vni id.
*/ */
pn_dnode = yang_dnode_get_parent(args->dnode, "vrf"); pn_dnode = yang_dnode_get_parent(args->dnode, "vrf");
vrfname = yang_dnode_get_string(pn_dnode, "./name"); vrfname = yang_dnode_get_string(pn_dnode, "name");
zvrf = zebra_vrf_lookup_by_name(vrfname); zvrf = zebra_vrf_lookup_by_name(vrfname);
if (!zvrf) { if (!zvrf) {
snprintf(args->errmsg, args->errmsg_len, snprintf(args->errmsg, args->errmsg_len,