diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-04-16 19:39:14 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-16 19:39:14 -0400 |
| commit | a83014ccd66477fa624ee54eb97e0a2a30a5a106 (patch) | |
| tree | 3d7faaad38c74b74409785cc54c0a58b8f72a23a /lib/if.c | |
| parent | 2ff99507ad97fed3c2a0910605bd72524f497441 (diff) | |
| parent | 40664f16e3abdec2371010137cf68a65fa325448 (diff) | |
Merge pull request #6247 from FRRouting/nb_conversions
Merge nb_converions branch to master
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 139 |
1 files changed, 138 insertions, 1 deletions
@@ -1667,8 +1667,97 @@ static int lib_interface_description_destroy(enum nb_event event, return NB_OK; } -/* clang-format off */ +/* + * XPath: /frr-interface:lib/interface/state/if-index + */ +struct yang_data *lib_interface_state_if_index_get_elem(const char *xpath, + const void *list_entry) +{ + const struct interface *ifp = list_entry; + + return yang_data_new_int32(xpath, ifp->ifindex); +} + +/* + * XPath: /frr-interface:lib/interface/state/mtu + */ +struct yang_data *lib_interface_state_mtu_get_elem(const char *xpath, + const void *list_entry) +{ + const struct interface *ifp = list_entry; + + return yang_data_new_uint16(xpath, ifp->mtu); +} + +/* + * XPath: /frr-interface:lib/interface/state/mtu6 + */ +struct yang_data *lib_interface_state_mtu6_get_elem(const char *xpath, + const void *list_entry) +{ + const struct interface *ifp = list_entry; + + return yang_data_new_uint32(xpath, ifp->mtu6); +} + +/* + * XPath: /frr-interface:lib/interface/state/speed + */ +struct yang_data *lib_interface_state_speed_get_elem(const char *xpath, + const void *list_entry) +{ + const struct interface *ifp = list_entry; + + return yang_data_new_uint32(xpath, ifp->speed); +} + +/* + * XPath: /frr-interface:lib/interface/state/metric + */ +struct yang_data *lib_interface_state_metric_get_elem(const char *xpath, + const void *list_entry) +{ + const struct interface *ifp = list_entry; + + return yang_data_new_uint32(xpath, ifp->metric); +} + +/* + * XPath: /frr-interface:lib/interface/state/flags + */ +struct yang_data *lib_interface_state_flags_get_elem(const char *xpath, + const void *list_entry) +{ + /* TODO: implement me. */ + return NULL; +} + +/* + * XPath: /frr-interface:lib/interface/state/type + */ +struct yang_data *lib_interface_state_type_get_elem(const char *xpath, + const void *list_entry) +{ + /* TODO: implement me. */ + return NULL; +} + +/* + * XPath: /frr-interface:lib/interface/state/phy-address + */ +struct yang_data * +lib_interface_state_phy_address_get_elem(const char *xpath, + const void *list_entry) +{ + const struct interface *ifp = list_entry; + struct ethaddr macaddr; + + memcpy(&macaddr.octet, ifp->hw_addr, ETH_ALEN); + + return yang_data_new_mac(xpath, &macaddr); +} +/* clang-format off */ const struct frr_yang_module_info frr_interface_info = { .name = "frr-interface", .nodes = { @@ -1692,6 +1781,54 @@ const struct frr_yang_module_info frr_interface_info = { }, }, { + .xpath = "/frr-interface:lib/interface/state/if-index", + .cbs = { + .get_elem = lib_interface_state_if_index_get_elem, + } + }, + { + .xpath = "/frr-interface:lib/interface/state/mtu", + .cbs = { + .get_elem = lib_interface_state_mtu_get_elem, + } + }, + { + .xpath = "/frr-interface:lib/interface/state/mtu6", + .cbs = { + .get_elem = lib_interface_state_mtu6_get_elem, + } + }, + { + .xpath = "/frr-interface:lib/interface/state/speed", + .cbs = { + .get_elem = lib_interface_state_speed_get_elem, + } + }, + { + .xpath = "/frr-interface:lib/interface/state/metric", + .cbs = { + .get_elem = lib_interface_state_metric_get_elem, + } + }, + { + .xpath = "/frr-interface:lib/interface/state/flags", + .cbs = { + .get_elem = lib_interface_state_flags_get_elem, + } + }, + { + .xpath = "/frr-interface:lib/interface/state/type", + .cbs = { + .get_elem = lib_interface_state_type_get_elem, + } + }, + { + .xpath = "/frr-interface:lib/interface/state/phy-address", + .cbs = { + .get_elem = lib_interface_state_phy_address_get_elem, + } + }, + { .xpath = NULL, }, } |
