zebra: implement zif-type oper state leaf

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
Igor Ryzhov 2024-02-20 17:50:26 +02:00
parent 7a7bb6bc78
commit af8c6b5b56
4 changed files with 44 additions and 10 deletions

View File

@ -14,7 +14,8 @@
"frr-zebra:zebra": { "frr-zebra:zebra": {
"state": { "state": {
"up-count": 0, "up-count": 0,
"down-count": 0 "down-count": 0,
"zif-type": "zif-veth"
} }
} }
} }

View File

@ -25,7 +25,8 @@
}, },
"state": { "state": {
"up-count": 0, "up-count": 0,
"down-count": 0 "down-count": 0,
"zif-type": "zif-veth"
} }
} }
} }

View File

@ -145,12 +145,6 @@ module frr-zebra {
"Zebra interface type bond."; "Zebra interface type bond.";
} }
identity zif-bond-slave {
base zebra-interface-type;
description
"Zebra interface type bond slave.";
}
identity zif-macvlan { identity zif-macvlan {
base zebra-interface-type; base zebra-interface-type;
description description

View File

@ -49,8 +49,46 @@ lib_interface_zebra_state_down_count_get_elem(struct nb_cb_get_elem_args *args)
struct yang_data * struct yang_data *
lib_interface_zebra_state_zif_type_get_elem(struct nb_cb_get_elem_args *args) lib_interface_zebra_state_zif_type_get_elem(struct nb_cb_get_elem_args *args)
{ {
/* TODO: implement me. */ const struct interface *ifp = args->list_entry;
return NULL; 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);
} }
/* /*