Skip to content

Commit

Permalink
Merge pull request #6247 from FRRouting/nb_conversions
Browse files Browse the repository at this point in the history
Merge nb_converions branch to master
  • Loading branch information
donaldsharp authored Apr 16, 2020
2 parents 2ff9950 + 40664f1 commit a83014c
Show file tree
Hide file tree
Showing 44 changed files with 6,650 additions and 2,429 deletions.
8 changes: 4 additions & 4 deletions babeld/babel_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ struct option longopts[] =
{ 0 }
};

static const struct frr_yang_module_info *const babeld_yang_modules[] =
{
&frr_interface_info,
};
static const struct frr_yang_module_info *const babeld_yang_modules[] = {
&frr_interface_info,
&frr_vrf_info,
};

FRR_DAEMON_INFO(babeld, BABELD,
.vty_port = BABEL_VTY_PORT,
Expand Down
1 change: 1 addition & 0 deletions bfdd/bfdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ static struct quagga_signal_t bfd_signals[] = {
static const struct frr_yang_module_info *const bfdd_yang_modules[] = {
&frr_interface_info,
&frr_bfdd_info,
&frr_vrf_info,
};

FRR_DAEMON_INFO(bfdd, BFD, .vty_port = 2617,
Expand Down
1 change: 1 addition & 0 deletions bgpd/bgp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ static void bgp_vrf_terminate(void)
static const struct frr_yang_module_info *const bgpd_yang_modules[] = {
&frr_interface_info,
&frr_route_map_info,
&frr_vrf_info,
};

FRR_DAEMON_INFO(bgpd, BGP, .vty_port = BGP_VTY_PORT,
Expand Down
1 change: 1 addition & 0 deletions eigrpd/eigrp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ static const struct frr_yang_module_info *const eigrpd_yang_modules[] = {
&frr_eigrpd_info,
&frr_interface_info,
&frr_route_map_info,
&frr_vrf_info,
};

FRR_DAEMON_INFO(eigrpd, EIGRP, .vty_port = EIGRP_VTY_PORT,
Expand Down
1 change: 1 addition & 0 deletions isisd/isis_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ static const struct frr_yang_module_info *const isisd_yang_modules[] = {
&frr_isisd_info,
#endif /* ifndef FABRICD */
&frr_route_map_info,
&frr_vrf_info,
};

#ifdef FABRICD
Expand Down
1 change: 1 addition & 0 deletions ldpd/ldpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ static struct quagga_signal_t ldp_signals[] =
};

static const struct frr_yang_module_info *const ldpd_yang_modules[] = {
&frr_vrf_info,
};

FRR_DAEMON_INFO(ldpd, LDP,
Expand Down
139 changes: 138 additions & 1 deletion lib/if.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -1691,6 +1780,54 @@ const struct frr_yang_module_info frr_interface_info = {
.cli_show = cli_show_interface_desc,
},
},
{
.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,
},
Expand Down
18 changes: 18 additions & 0 deletions lib/if.h
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,24 @@ extern void if_destroy_via_zapi(struct interface *ifp);

extern const struct frr_yang_module_info frr_interface_info;

struct yang_data *lib_interface_state_if_index_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *lib_interface_state_mtu_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *lib_interface_state_mtu6_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *lib_interface_state_speed_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *lib_interface_state_metric_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *lib_interface_state_flags_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *lib_interface_state_type_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_interface_state_phy_address_get_elem(const char *xpath,
const void *list_entry);

#ifdef __cplusplus
}
#endif
Expand Down
5 changes: 5 additions & 0 deletions lib/subdir.am
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ nodist_lib_libfrr_la_SOURCES = \
yang/frr-interface.yang.c \
yang/frr-route-map.yang.c \
yang/frr-route-types.yang.c \
yang/frr-vrf.yang.c \
yang/frr-routing.yang.c \
yang/ietf/ietf-routing-types.yang.c \
yang/ietf/ietf-interfaces.yang.c \
yang/frr-module-translator.yang.c \
yang/frr-nexthop.yang.c \
yang/frr-igmp.yang.c \
# end

vtysh_scan += \
Expand Down
Loading

0 comments on commit a83014c

Please sign in to comment.