diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2024-02-20 16:50:26 +0100 |
---|---|---|
committer | Igor Ryzhov <iryzhov@nfware.com> | 2024-02-20 17:06:49 +0100 |
commit | af8c6b5b566cfa7feb7c7225e3e7ef638c83e5c9 (patch) | |
tree | 96e667bdba63809263b67ca8fb69bc1449a5deb2 /zebra/zebra_nb_state.c | |
parent | zebra: add interface's bond to oper state (diff) | |
download | frr-af8c6b5b566cfa7feb7c7225e3e7ef638c83e5c9.tar.xz frr-af8c6b5b566cfa7feb7c7225e3e7ef638c83e5c9.zip |
zebra: implement zif-type oper state leaf
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'zebra/zebra_nb_state.c')
-rw-r--r-- | zebra/zebra_nb_state.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/zebra/zebra_nb_state.c b/zebra/zebra_nb_state.c index 8f81abc17..464c0be70 100644 --- a/zebra/zebra_nb_state.c +++ b/zebra/zebra_nb_state.c @@ -49,8 +49,46 @@ lib_interface_zebra_state_down_count_get_elem(struct nb_cb_get_elem_args *args) struct yang_data * lib_interface_zebra_state_zif_type_get_elem(struct nb_cb_get_elem_args *args) { - /* TODO: implement me. */ - return NULL; + const struct interface *ifp = args->list_entry; + struct zebra_if *zebra_if; + const char *type = NULL; + + zebra_if = ifp->info; + + switch (zebra_if->zif_type) { + case ZEBRA_IF_OTHER: + type = "frr-zebra:zif-other"; + break; + case ZEBRA_IF_VXLAN: + type = "frr-zebra:zif-vxlan"; + break; + case ZEBRA_IF_VRF: + type = "frr-zebra:zif-vrf"; + break; + case ZEBRA_IF_BRIDGE: + type = "frr-zebra:zif-bridge"; + break; + case ZEBRA_IF_VLAN: + type = "frr-zebra:zif-vlan"; + break; + case ZEBRA_IF_MACVLAN: + type = "frr-zebra:zif-macvlan"; + break; + case ZEBRA_IF_VETH: + type = "frr-zebra:zif-veth"; + break; + case ZEBRA_IF_BOND: + type = "frr-zebra:zif-bond"; + break; + case ZEBRA_IF_GRE: + type = "frr-zebra:zif-gre"; + break; + } + + if (!type) + return NULL; + + return yang_data_new_string(args->xpath, type); } /* |