*/
DEFPY (clear_ipv6_rip,
clear_ipv6_rip_cmd,
- "clear ipv6 ripng",
+ "clear ipv6 ripng [vrf WORD]",
CLEAR_STR
IPV6_STR
- "Clear IPv6 RIP database\n")
+ "Clear IPv6 RIP database\n"
+ VRF_CMD_HELP_STR)
{
- return nb_cli_rpc("/frr-ripngd:clear-ripng-route", NULL, NULL);
+ struct list *input;
+
+ input = list_new();
+ if (vrf) {
+ struct yang_data *yang_vrf;
+
+ yang_vrf = yang_data_new(
+ "/frr-ripngd:clear-ripng-route/input/vrf", vrf);
+ listnode_add(input, yang_vrf);
+ }
+
+ return nb_cli_rpc("/frr-ripngd:clear-ripng-route", input, NULL);
}
void ripng_cli_init(void)
#include "libfrr.h"
#include "ripngd/ripngd.h"
+#include "ripngd/ripng_debug.h"
#include "ripngd/ripng_route.h"
#include "ripngd/ripng_cli.h"
/*
* XPath: /frr-ripngd:clear-ripng-route
*/
-static int clear_ripng_route_rpc(const char *xpath, const struct list *input,
- struct list *output)
+static void clear_ripng_route(struct ripng *ripng)
{
- struct ripng *ripng;
struct agg_node *rp;
- struct ripng_info *rinfo;
- struct list *list;
- struct listnode *listnode;
- ripng = ripng_lookup_by_vrf_id(VRF_DEFAULT);
- if (!ripng)
- return NB_OK;
+ if (IS_RIPNG_DEBUG_EVENT)
+ zlog_debug("Clearing all RIPng routes (VRF %s)",
+ ripng->vrf_name);
/* Clear received RIPng routes */
for (rp = agg_route_top(ripng->table); rp; rp = agg_route_next(rp)) {
+ struct list *list;
+ struct listnode *listnode;
+ struct ripng_info *rinfo;
+
list = rp->info;
if (list == NULL)
continue;
agg_unlock_node(rp);
}
}
+}
+
+static int clear_ripng_route_rpc(const char *xpath, const struct list *input,
+ struct list *output)
+{
+ struct ripng *ripng;
+ struct yang_data *yang_vrf;
+
+ yang_vrf = yang_data_list_find(input, "%s/%s", xpath, "input/vrf");
+ if (yang_vrf) {
+ ripng = ripng_lookup_by_vrf_name(yang_vrf->value);
+ if (ripng)
+ clear_ripng_route(ripng);
+ } else {
+ struct vrf *vrf;
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ ripng = vrf->info;
+ if (!ripng)
+ continue;
+
+ clear_ripng_route(ripng);
+ }
+ }
return NB_OK;
}
description
"Clears RIPng routes from the IPv6 routing table and routes
redistributed into the RIPng protocol.";
+
+ input {
+ leaf vrf {
+ type string;
+ description
+ "VRF name identifying a specific RIPng instance.
+ This leaf is optional for the rpc.
+ If it is specified, the rpc will clear all routes in the
+ specified RIPng instance;
+ if it is not specified, the rpc will clear all routes in
+ all RIPng instances.";
+ }
+ }
}
}