summaryrefslogtreecommitdiffstats
path: root/lib/if_rmap.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2023-04-12 16:17:03 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2023-04-12 16:17:03 +0200
commit1d1f77b60d0c804af23f9b813fb6b26a303e8c05 (patch)
tree6cf0c1a31933995c85c13b0b9cb1e06305a2527f /lib/if_rmap.c
parentMerge pull request #13242 from LabNConsulting/chopps/no_rip_in_lib (diff)
downloadfrr-1d1f77b60d0c804af23f9b813fb6b26a303e8c05.tar.xz
frr-1d1f77b60d0c804af23f9b813fb6b26a303e8c05.zip
lib: convert if_rmap config output to northbound
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/if_rmap.c')
-rw-r--r--lib/if_rmap.c44
1 files changed, 12 insertions, 32 deletions
diff --git a/lib/if_rmap.c b/lib/if_rmap.c
index 5895924a5..42e162072 100644
--- a/lib/if_rmap.c
+++ b/lib/if_rmap.c
@@ -240,6 +240,18 @@ DEFPY_YANG(no_if_ipv6_route_map, no_if_ipv6_route_map_cmd,
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,
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);
}
-
-/* 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)
{
hash_clean_and_free(&ctx->ifrmaphash, (void (*)(void *))if_rmap_free);