ripd: yang: extend nexthops functionality in YANG model - skeleton

Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
Christian Hopps 2023-04-06 17:28:37 -04:00
parent 01bdc91ef5
commit 0b7f0e3548
4 changed files with 299 additions and 9 deletions

View file

@ -337,6 +337,66 @@ const struct frr_yang_module_info frr_ripd_info = {
.get_elem = ripd_instance_state_routes_route_interface_get_elem,
},
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop",
.cbs = {
.get_next = ripd_instance_state_routes_route_nexthops_nexthop_get_next,
}
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/nh-type",
.cbs = {
.get_elem = ripd_instance_state_routes_route_nexthops_nexthop_nh_type_get_elem,
}
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/protocol",
.cbs = {
.get_elem = ripd_instance_state_routes_route_nexthops_nexthop_protocol_get_elem,
}
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/rip-type",
.cbs = {
.get_elem = ripd_instance_state_routes_route_nexthops_nexthop_rip_type_get_elem,
}
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/gateway",
.cbs = {
.get_elem = ripd_instance_state_routes_route_nexthops_nexthop_gateway_get_elem,
}
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/interface",
.cbs = {
.get_elem = ripd_instance_state_routes_route_nexthops_nexthop_interface_get_elem,
}
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/from",
.cbs = {
.get_elem = ripd_instance_state_routes_route_nexthops_nexthop_from_get_elem,
}
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/tag",
.cbs = {
.get_elem = ripd_instance_state_routes_route_nexthops_nexthop_tag_get_elem,
}
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/external-metric",
.cbs = {
.get_elem = ripd_instance_state_routes_route_nexthops_nexthop_external_metric_get_elem,
}
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/expire-time",
.cbs = {
.get_elem = ripd_instance_state_routes_route_nexthops_nexthop_expire_time_get_elem,
}
},
{
.xpath = "/frr-ripd:ripd/instance/state/routes/route/metric",
.cbs = {

View file

@ -89,6 +89,37 @@ struct yang_data *ripd_instance_state_routes_route_interface_get_elem(
struct nb_cb_get_elem_args *args);
struct yang_data *ripd_instance_state_routes_route_metric_get_elem(
struct nb_cb_get_elem_args *args);
const void *ripd_instance_state_routes_route_nexthops_nexthop_get_next(
struct nb_cb_get_next_args *args);
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_nh_type_get_elem(
struct nb_cb_get_elem_args *args);
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_protocol_get_elem(
struct nb_cb_get_elem_args *args);
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_rip_type_get_elem(
struct nb_cb_get_elem_args *args);
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_gateway_get_elem(
struct nb_cb_get_elem_args *args);
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_interface_get_elem(
struct nb_cb_get_elem_args *args);
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_from_get_elem(
struct nb_cb_get_elem_args *args);
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_tag_get_elem(
struct nb_cb_get_elem_args *args);
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_external_metric_get_elem(
struct nb_cb_get_elem_args *args);
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_expire_time_get_elem(
struct nb_cb_get_elem_args *args);
struct yang_data *ripd_instance_state_routes_route_metric_get_elem(
struct nb_cb_get_elem_args *args);
int clear_rip_route_rpc(struct nb_cb_rpc_args *args);
int lib_interface_rip_split_horizon_modify(struct nb_cb_modify_args *args);
int lib_interface_rip_v2_broadcast_modify(struct nb_cb_modify_args *args);

View file

@ -210,6 +210,117 @@ struct yang_data *ripd_instance_state_routes_route_prefix_get_elem(
return yang_data_new_ipv4p(args->xpath, &rinfo->rp->p);
}
/*
* XPath: /frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop
*/
const void *ripd_instance_state_routes_route_nexthops_nexthop_get_next(
struct nb_cb_get_next_args *args)
{
/* TODO: implement me. */
return NULL;
}
/*
* XPath: /frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/nh-type
*/
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_nh_type_get_elem(
struct nb_cb_get_elem_args *args)
{
/* TODO: implement me. */
return NULL;
}
/*
* XPath: /frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/protocol
*/
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_protocol_get_elem(
struct nb_cb_get_elem_args *args)
{
/* TODO: implement me. */
return NULL;
}
/*
* XPath: /frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/rip-type
*/
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_rip_type_get_elem(
struct nb_cb_get_elem_args *args)
{
/* TODO: implement me. */
return NULL;
}
/*
* XPath: /frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/gateway
*/
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_gateway_get_elem(
struct nb_cb_get_elem_args *args)
{
/* TODO: implement me. */
return NULL;
}
/*
* XPath: /frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/interface
*/
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_interface_get_elem(
struct nb_cb_get_elem_args *args)
{
/* TODO: implement me. */
return NULL;
}
/*
* XPath: /frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/from
*/
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_from_get_elem(
struct nb_cb_get_elem_args *args)
{
/* TODO: implement me. */
return NULL;
}
/*
* XPath: /frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/tag
*/
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_tag_get_elem(
struct nb_cb_get_elem_args *args)
{
/* TODO: implement me. */
return NULL;
}
/*
* XPath:
* /frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/external-metric
*/
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_external_metric_get_elem(
struct nb_cb_get_elem_args *args)
{
/* TODO: implement me. */
return NULL;
}
/*
* XPath:
* /frr-ripd:ripd/instance/state/routes/route/nexthops/nexthop/expire-time
*/
struct yang_data *
ripd_instance_state_routes_route_nexthops_nexthop_expire_time_get_elem(
struct nb_cb_get_elem_args *args)
{
/* TODO: implement me. */
return NULL;
}
/*
* XPath: /frr-ripd:ripd/instance/state/routes/route/next-hop
*/

View file

@ -13,6 +13,9 @@ module frr-ripd {
import frr-interface {
prefix frr-interface;
}
import frr-nexthop {
prefix frr-nexthop;
}
import frr-vrf {
prefix frr-vrf;
}
@ -70,6 +73,33 @@ module frr-ripd {
RFC 2453: RIP Version 2.";
}
typedef rip-route-type {
type enumeration {
enum normal {
value 0;
description "Normal RIP route type.";
}
enum static {
value 1;
description "Static RIP route type.";
}
enum default {
value 2;
description "Default RIP route type.";
}
enum redistribute {
value 3;
description "Redistribute RIP route type.";
}
enum interface {
value 4;
description "Interface RIP route type.";
}
}
description
"Types of RIP routes.";
}
container ripd {
description "rip routing instance data";
list instance {
@ -399,15 +429,58 @@ module frr-ripd {
separated by the slash (/) character. The range of
values for the prefix-length is 0 to 32.";
}
leaf next-hop {
type inet:ipv4-address;
description
"Next hop IPv4 address.";
}
leaf interface {
type frr-interface:interface-ref;
description
"The interface that the route uses.";
container nexthops {
description "container of nexthops";
list nexthop {
description "A list of nexthop objects.";
leaf nh-type {
type frr-nexthop:nexthop-type;
mandatory true;
description
"The nexthop type.";
}
leaf protocol {
type frr-route-types:frr-route-types-v4;
description
"The protocol originating this route.";
}
leaf rip-type {
type rip-route-type;
description
"The RIP type of route.";
}
leaf gateway {
type inet:ipv4-address;
description
"The nexthop gateway address.";
}
leaf interface {
type frr-interface:interface-ref;
description
"The nexthop egress interface.";
}
leaf from {
type inet:ipv4-address;
description
"The nexthop gateway address.";
}
leaf tag {
type uint32;
default "0";
description
"Route tag";
}
leaf external-metric {
type uint32;
description
"External metric if learned from external protocol.";
}
leaf expire-time {
type uint32;
description
"Seconds before route expires.";
}
}
}
leaf metric {
type uint8 {
@ -416,6 +489,21 @@ module frr-ripd {
description
"Route metric.";
}
/*
* Replaced by container `nexthops` above.
*/
leaf next-hop {
type inet:ipv4-address;
status deprecated;
description
"Next hop IPv4 address.";
}
leaf interface {
type frr-interface:interface-ref;
status deprecated;
description
"The interface that the route uses.";
}
}
}
}