mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 17:18:56 +00:00
ripd: adapt to new YANG NB if_rmap conversion
- uses YANG grouping and calls if_rmap library code to implement. Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
parent
efa2ca6ef0
commit
14ef7be7ca
@ -165,6 +165,27 @@ const struct frr_yang_module_info frr_ripd_info = {
|
|||||||
.modify = ripd_instance_redistribute_metric_modify,
|
.modify = ripd_instance_redistribute_metric_modify,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.xpath = "/frr-ripd:ripd/instance/if-route-maps/if-route-map",
|
||||||
|
.cbs = {
|
||||||
|
.create = ripd_instance_if_route_maps_if_route_map_create,
|
||||||
|
.destroy = ripd_instance_if_route_maps_if_route_map_destroy,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.xpath = "/frr-ripd:ripd/instance/if-route-maps/if-route-map/in-route-map",
|
||||||
|
.cbs = {
|
||||||
|
.modify = ripd_instance_if_route_maps_if_route_map_in_route_map_modify,
|
||||||
|
.destroy = ripd_instance_if_route_maps_if_route_map_in_route_map_destroy,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.xpath = "/frr-ripd:ripd/instance/if-route-maps/if-route-map/out-route-map",
|
||||||
|
.cbs = {
|
||||||
|
.modify = ripd_instance_if_route_maps_if_route_map_out_route_map_modify,
|
||||||
|
.destroy = ripd_instance_if_route_maps_if_route_map_out_route_map_destroy,
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.xpath = "/frr-ripd:ripd/instance/static-route",
|
.xpath = "/frr-ripd:ripd/instance/static-route",
|
||||||
.cbs = {
|
.cbs = {
|
||||||
|
@ -52,6 +52,18 @@ int ripd_instance_redistribute_route_map_destroy(
|
|||||||
struct nb_cb_destroy_args *args);
|
struct nb_cb_destroy_args *args);
|
||||||
int ripd_instance_redistribute_metric_modify(struct nb_cb_modify_args *args);
|
int ripd_instance_redistribute_metric_modify(struct nb_cb_modify_args *args);
|
||||||
int ripd_instance_redistribute_metric_destroy(struct nb_cb_destroy_args *args);
|
int ripd_instance_redistribute_metric_destroy(struct nb_cb_destroy_args *args);
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_create(
|
||||||
|
struct nb_cb_create_args *args);
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_destroy(
|
||||||
|
struct nb_cb_destroy_args *args);
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_in_route_map_modify(
|
||||||
|
struct nb_cb_modify_args *args);
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_in_route_map_destroy(
|
||||||
|
struct nb_cb_destroy_args *args);
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_out_route_map_modify(
|
||||||
|
struct nb_cb_modify_args *args);
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_out_route_map_destroy(
|
||||||
|
struct nb_cb_destroy_args *args);
|
||||||
int ripd_instance_static_route_create(struct nb_cb_create_args *args);
|
int ripd_instance_static_route_create(struct nb_cb_create_args *args);
|
||||||
int ripd_instance_static_route_destroy(struct nb_cb_destroy_args *args);
|
int ripd_instance_static_route_destroy(struct nb_cb_destroy_args *args);
|
||||||
int ripd_instance_timers_flush_interval_modify(struct nb_cb_modify_args *args);
|
int ripd_instance_timers_flush_interval_modify(struct nb_cb_modify_args *args);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro <kunihiro@zebra.org>
|
* Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro <kunihiro@zebra.org>
|
||||||
* Copyright (C) 2018 NetDEF, Inc.
|
* Copyright (C) 2018 NetDEF, Inc.
|
||||||
* Renato Westphal
|
* Renato Westphal
|
||||||
|
* Copyright (C) 2023 LabN Consulting, L.L.C.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <zebra.h>
|
#include <zebra.h>
|
||||||
@ -13,6 +14,7 @@
|
|||||||
#include "prefix.h"
|
#include "prefix.h"
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
#include "if_rmap.h"
|
||||||
#include "routemap.h"
|
#include "routemap.h"
|
||||||
#include "northbound.h"
|
#include "northbound.h"
|
||||||
#include "libfrr.h"
|
#include "libfrr.h"
|
||||||
@ -680,6 +682,94 @@ int ripd_instance_redistribute_metric_destroy(struct nb_cb_destroy_args *args)
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPath: /frr-ripd:ripd/instance/if-route-maps/if-route-map
|
||||||
|
*/
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_create(
|
||||||
|
struct nb_cb_create_args *args)
|
||||||
|
{
|
||||||
|
/* if_rmap is created when first routemap is added */
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_destroy(
|
||||||
|
struct nb_cb_destroy_args *args)
|
||||||
|
{
|
||||||
|
struct rip *rip;
|
||||||
|
|
||||||
|
if (args->event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* YANG will prune edit deletes up to the most general deleted node so
|
||||||
|
* we need to handle deleting any existing state underneath and not
|
||||||
|
* count on those more specific callbacks being called individually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
rip = nb_running_get_entry(args->dnode, NULL, true);
|
||||||
|
if_rmap_yang_destroy_cb(rip->if_rmap_ctx, args->dnode);
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void if_route_map_modify(const struct lyd_node *dnode,
|
||||||
|
enum if_rmap_type type, bool delete)
|
||||||
|
{
|
||||||
|
struct rip *rip = nb_running_get_entry(dnode, NULL, true);
|
||||||
|
|
||||||
|
if_rmap_yang_modify_cb(rip->if_rmap_ctx, dnode, type, delete);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPath: /frr-ripd:ripd/instance/if-route-maps/if-route-map/in-route-map
|
||||||
|
*/
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_in_route_map_modify(
|
||||||
|
struct nb_cb_modify_args *args)
|
||||||
|
{
|
||||||
|
if (args->event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
if_route_map_modify(args->dnode, IF_RMAP_IN, false);
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_in_route_map_destroy(
|
||||||
|
struct nb_cb_destroy_args *args)
|
||||||
|
{
|
||||||
|
if (args->event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
if_route_map_modify(args->dnode, IF_RMAP_IN, true);
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPath: /frr-ripd:ripd/instance/if-route-maps/if-route-map/out-route-map
|
||||||
|
*/
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_out_route_map_modify(
|
||||||
|
struct nb_cb_modify_args *args)
|
||||||
|
{
|
||||||
|
if (args->event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
if_route_map_modify(args->dnode, IF_RMAP_OUT, false);
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ripd_instance_if_route_maps_if_route_map_out_route_map_destroy(
|
||||||
|
struct nb_cb_destroy_args *args)
|
||||||
|
{
|
||||||
|
if (args->event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
if_route_map_modify(args->dnode, IF_RMAP_OUT, true);
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath: /frr-ripd:ripd/instance/static-route
|
* XPath: /frr-ripd:ripd/instance/static-route
|
||||||
*/
|
*/
|
||||||
|
@ -10,6 +10,9 @@ module frr-ripd {
|
|||||||
import ietf-yang-types {
|
import ietf-yang-types {
|
||||||
prefix yang;
|
prefix yang;
|
||||||
}
|
}
|
||||||
|
import frr-if-rmap {
|
||||||
|
prefix frr-if-rmap;
|
||||||
|
}
|
||||||
import frr-interface {
|
import frr-interface {
|
||||||
prefix frr-interface;
|
prefix frr-interface;
|
||||||
}
|
}
|
||||||
@ -282,6 +285,9 @@ module frr-ripd {
|
|||||||
is 0.";
|
is 0.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uses frr-if-rmap:if-route-maps-group;
|
||||||
|
|
||||||
leaf-list static-route {
|
leaf-list static-route {
|
||||||
type inet:ipv4-prefix;
|
type inet:ipv4-prefix;
|
||||||
description
|
description
|
||||||
|
Loading…
Reference in New Issue
Block a user