X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ripngd%2Fripng_cli.c;h=b3d92fb0d90337164d0ec56d89f6b37f13c4b122;hb=f94ed830df98218447f00b97f856de811bfcc4a2;hp=23a48031704a45b8b48801814116146222647b12;hpb=23ebff805c6704dd94c565c0676fb7a10747583f;p=mirror_frr.git diff --git a/ripngd/ripng_cli.c b/ripngd/ripng_cli.c index 23a480317..b3d92fb0d 100644 --- a/ripngd/ripng_cli.c +++ b/ripngd/ripng_cli.c @@ -29,7 +29,7 @@ #include "libfrr.h" #include "ripngd/ripngd.h" -#include "ripngd/ripng_cli.h" +#include "ripngd/ripng_nb.h" #ifndef VTYSH_EXTRACT_PL #include "ripngd/ripng_cli_clippy.c" #endif @@ -39,31 +39,46 @@ */ DEFPY_NOSH (router_ripng, router_ripng_cmd, - "router ripng", + "router ripng [vrf NAME]", "Enable a routing process\n" - "Make RIPng instance command\n") + "Make RIPng instance command\n" + VRF_CMD_HELP_STR) { + char xpath[XPATH_MAXLEN]; int ret; - nb_cli_enqueue_change(vty, "/frr-ripngd:ripngd/instance", NB_OP_CREATE, - NULL); + /* Build RIPng instance XPath. */ + if (!vrf) + vrf = VRF_DEFAULT_NAME; + snprintf(xpath, sizeof(xpath), "/frr-ripngd:ripngd/instance[vrf='%s']", + vrf); + + nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL); ret = nb_cli_apply_changes(vty, NULL); if (ret == CMD_SUCCESS) - VTY_PUSH_XPATH(RIPNG_NODE, "/frr-ripngd:ripngd/instance"); + VTY_PUSH_XPATH(RIPNG_NODE, xpath); return ret; } DEFPY (no_router_ripng, no_router_ripng_cmd, - "no router ripng", + "no router ripng [vrf NAME]", NO_STR "Enable a routing process\n" - "Make RIPng instance command\n") + "Make RIPng instance command\n" + VRF_CMD_HELP_STR) { - nb_cli_enqueue_change(vty, "/frr-ripngd:ripngd/instance", NB_OP_DESTROY, - NULL); + char xpath[XPATH_MAXLEN]; + + /* Build RIPng instance XPath. */ + if (!vrf) + vrf = VRF_DEFAULT_NAME; + snprintf(xpath, sizeof(xpath), "/frr-ripngd:ripngd/instance[vrf='%s']", + vrf); + + nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL); return nb_cli_apply_changes(vty, NULL); } @@ -71,8 +86,15 @@ DEFPY (no_router_ripng, void cli_show_router_ripng(struct vty *vty, struct lyd_node *dnode, bool show_defaults) { + const char *vrf_name; + + vrf_name = yang_dnode_get_string(dnode, "./vrf"); + vty_out(vty, "!\n"); - vty_out(vty, "router ripng\n"); + vty_out(vty, "router ripng"); + if (!strmatch(vrf_name, VRF_DEFAULT_NAME)) + vty_out(vty, " vrf %s", vrf_name); + vty_out(vty, "\n"); } /* @@ -456,12 +478,29 @@ void cli_show_ipv6_ripng_split_horizon(struct vty *vty, struct lyd_node *dnode, */ 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; + int ret; + + 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); + } + + ret = nb_cli_rpc("/frr-ripngd:clear-ripng-route", input, NULL); + + list_delete(&input); + + return ret; } void ripng_cli_init(void)