mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
lib: convert if_rmap config output to northbound
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
4150fc5399
commit
1d1f77b60d
|
@ -240,6 +240,18 @@ DEFPY_YANG(no_if_ipv6_route_map, no_if_ipv6_route_map_cmd,
|
||||||
route_map);
|
route_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cli_show_if_route_map(struct vty *vty, const struct lyd_node *dnode,
|
||||||
|
bool show_defaults)
|
||||||
|
{
|
||||||
|
if (yang_dnode_exists(dnode, "./in-route-map"))
|
||||||
|
vty_out(vty, " route-map %s in %s\n",
|
||||||
|
yang_dnode_get_string(dnode, "./in-route-map"),
|
||||||
|
yang_dnode_get_string(dnode, "./interface"));
|
||||||
|
if (yang_dnode_exists(dnode, "./out-route-map"))
|
||||||
|
vty_out(vty, " route-map %s out %s\n",
|
||||||
|
yang_dnode_get_string(dnode, "./out-route-map"),
|
||||||
|
yang_dnode_get_string(dnode, "./interface"));
|
||||||
|
}
|
||||||
|
|
||||||
void if_rmap_yang_modify_cb(struct if_rmap_ctx *ctx,
|
void if_rmap_yang_modify_cb(struct if_rmap_ctx *ctx,
|
||||||
const struct lyd_node *dnode,
|
const struct lyd_node *dnode,
|
||||||
|
@ -263,38 +275,6 @@ void if_rmap_yang_destroy_cb(struct if_rmap_ctx *ctx,
|
||||||
if_rmap_unset(ctx, ifname, IF_RMAP_OUT);
|
if_rmap_unset(ctx, ifname, IF_RMAP_OUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Configuration write function. */
|
|
||||||
int config_write_if_rmap(struct vty *vty, struct if_rmap_ctx *ctx)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
struct hash_bucket *mp;
|
|
||||||
int write = 0;
|
|
||||||
struct hash *ifrmaphash = ctx->ifrmaphash;
|
|
||||||
|
|
||||||
for (i = 0; i < ifrmaphash->size; i++)
|
|
||||||
for (mp = ifrmaphash->index[i]; mp; mp = mp->next) {
|
|
||||||
struct if_rmap *if_rmap;
|
|
||||||
|
|
||||||
if_rmap = mp->data;
|
|
||||||
|
|
||||||
if (if_rmap->routemap[IF_RMAP_IN]) {
|
|
||||||
vty_out(vty, " route-map %s in %s\n",
|
|
||||||
if_rmap->routemap[IF_RMAP_IN],
|
|
||||||
if_rmap->ifname);
|
|
||||||
write++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (if_rmap->routemap[IF_RMAP_OUT]) {
|
|
||||||
vty_out(vty, " route-map %s out %s\n",
|
|
||||||
if_rmap->routemap[IF_RMAP_OUT],
|
|
||||||
if_rmap->ifname);
|
|
||||||
write++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return write;
|
|
||||||
}
|
|
||||||
|
|
||||||
void if_rmap_ctx_delete(struct if_rmap_ctx *ctx)
|
void if_rmap_ctx_delete(struct if_rmap_ctx *ctx)
|
||||||
{
|
{
|
||||||
hash_clean_and_free(&ctx->ifrmaphash, (void (*)(void *))if_rmap_free);
|
hash_clean_and_free(&ctx->ifrmaphash, (void (*)(void *))if_rmap_free);
|
||||||
|
|
|
@ -56,6 +56,8 @@ extern void if_rmap_yang_modify_cb(struct if_rmap_ctx *ctx,
|
||||||
extern void if_rmap_yang_destroy_cb(struct if_rmap_ctx *ctx,
|
extern void if_rmap_yang_destroy_cb(struct if_rmap_ctx *ctx,
|
||||||
const struct lyd_node *dnode);
|
const struct lyd_node *dnode);
|
||||||
extern int config_write_if_rmap(struct vty *, struct if_rmap_ctx *ctx);
|
extern int config_write_if_rmap(struct vty *, struct if_rmap_ctx *ctx);
|
||||||
|
void cli_show_if_route_map(struct vty *vty, const struct lyd_node *dnode,
|
||||||
|
bool show_defaults);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "libfrr.h"
|
#include "libfrr.h"
|
||||||
|
|
||||||
#include "ripd/rip_nb.h"
|
#include "ripd/rip_nb.h"
|
||||||
|
#include "lib/if_rmap.h"
|
||||||
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
const struct frr_yang_module_info frr_ripd_info = {
|
const struct frr_yang_module_info frr_ripd_info = {
|
||||||
|
@ -170,6 +171,7 @@ const struct frr_yang_module_info frr_ripd_info = {
|
||||||
.cbs = {
|
.cbs = {
|
||||||
.create = ripd_instance_if_route_maps_if_route_map_create,
|
.create = ripd_instance_if_route_maps_if_route_map_create,
|
||||||
.destroy = ripd_instance_if_route_maps_if_route_map_destroy,
|
.destroy = ripd_instance_if_route_maps_if_route_map_destroy,
|
||||||
|
.cli_show = cli_show_if_route_map,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -3204,9 +3204,6 @@ static int config_write_rip(struct vty *vty)
|
||||||
/* Distribute configuration. */
|
/* Distribute configuration. */
|
||||||
config_write_distribute(vty, rip->distribute_ctx);
|
config_write_distribute(vty, rip->distribute_ctx);
|
||||||
|
|
||||||
/* Interface routemap configuration */
|
|
||||||
config_write_if_rmap(vty, rip->if_rmap_ctx);
|
|
||||||
|
|
||||||
vty_out(vty, "exit\n");
|
vty_out(vty, "exit\n");
|
||||||
|
|
||||||
write = 1;
|
write = 1;
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "libfrr.h"
|
#include "libfrr.h"
|
||||||
|
|
||||||
#include "ripngd/ripng_nb.h"
|
#include "ripngd/ripng_nb.h"
|
||||||
|
#include "lib/if_rmap.h"
|
||||||
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
const struct frr_yang_module_info frr_ripngd_info = {
|
const struct frr_yang_module_info frr_ripngd_info = {
|
||||||
|
@ -119,6 +120,7 @@ const struct frr_yang_module_info frr_ripngd_info = {
|
||||||
.cbs = {
|
.cbs = {
|
||||||
.create = ripngd_instance_if_route_maps_if_route_map_create,
|
.create = ripngd_instance_if_route_maps_if_route_map_create,
|
||||||
.destroy = ripngd_instance_if_route_maps_if_route_map_destroy,
|
.destroy = ripngd_instance_if_route_maps_if_route_map_destroy,
|
||||||
|
.cli_show = cli_show_if_route_map,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -2231,7 +2231,6 @@ static int ripng_config_write(struct vty *vty)
|
||||||
nb_cli_show_dnode_cmds(vty, dnode, false);
|
nb_cli_show_dnode_cmds(vty, dnode, false);
|
||||||
|
|
||||||
config_write_distribute(vty, ripng->distribute_ctx);
|
config_write_distribute(vty, ripng->distribute_ctx);
|
||||||
config_write_if_rmap(vty, ripng->if_rmap_ctx);
|
|
||||||
|
|
||||||
vty_out(vty, "exit\n");
|
vty_out(vty, "exit\n");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue