summaryrefslogtreecommitdiffstats
path: root/ripd/rip_cli.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-04-05 01:24:14 +0200
committerGitHub <noreply@github.com>2019-04-05 01:24:14 +0200
commitf61f266a0e484d3ba78a644f36a3a4f7113cfc74 (patch)
tree728ed9d219c276bbe6e01200c58594b392555c13 /ripd/rip_cli.c
parentMerge pull request #3899 from ton31337/fix/remove_private_as_with_local_as (diff)
parentlib, ripd, ripngd: rename remaining delete northbound callbacks (diff)
downloadfrr-f61f266a0e484d3ba78a644f36a3a4f7113cfc74.tar.xz
frr-f61f266a0e484d3ba78a644f36a3a4f7113cfc74.zip
Merge pull request #3548 from opensourcerouting/rip-vrf
rip(ng)d: add VRF support
Diffstat (limited to 'ripd/rip_cli.c')
-rw-r--r--ripd/rip_cli.c62
1 files changed, 48 insertions, 14 deletions
diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c
index 62aaad5d9..346e93b8e 100644
--- a/ripd/rip_cli.c
+++ b/ripd/rip_cli.c
@@ -39,31 +39,46 @@
*/
DEFPY_NOSH (router_rip,
router_rip_cmd,
- "router rip",
+ "router rip [vrf NAME]",
"Enable a routing process\n"
- "Routing Information Protocol (RIP)\n")
+ "Routing Information Protocol (RIP)\n"
+ VRF_CMD_HELP_STR)
{
+ char xpath[XPATH_MAXLEN];
int ret;
- nb_cli_enqueue_change(vty, "/frr-ripd:ripd/instance", NB_OP_CREATE,
- NULL);
+ /* Build RIP instance XPath. */
+ if (!vrf)
+ vrf = VRF_DEFAULT_NAME;
+ snprintf(xpath, sizeof(xpath), "/frr-ripd:ripd/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(RIP_NODE, "/frr-ripd:ripd/instance");
+ VTY_PUSH_XPATH(RIP_NODE, xpath);
return ret;
}
DEFPY (no_router_rip,
no_router_rip_cmd,
- "no router rip",
+ "no router rip [vrf NAME]",
NO_STR
"Enable a routing process\n"
- "Routing Information Protocol (RIP)\n")
+ "Routing Information Protocol (RIP)\n"
+ VRF_CMD_HELP_STR)
{
- nb_cli_enqueue_change(vty, "/frr-ripd:ripd/instance", NB_OP_DESTROY,
- NULL);
+ char xpath[XPATH_MAXLEN];
+
+ /* Build RIP instance XPath. */
+ if (!vrf)
+ vrf = VRF_DEFAULT_NAME;
+ snprintf(xpath, sizeof(xpath), "/frr-ripd:ripd/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_rip,
void cli_show_router_rip(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 rip\n");
+ vty_out(vty, "router rip");
+ if (!strmatch(vrf_name, VRF_DEFAULT_NAME))
+ vty_out(vty, " vrf %s", vrf_name);
+ vty_out(vty, "\n");
}
/*
@@ -902,7 +924,7 @@ DEFPY (no_ip_rip_authentication_string,
"Authentication string\n"
"Authentication string\n")
{
- nb_cli_enqueue_change(vty, "./authentication-password", NB_OP_MODIFY,
+ nb_cli_enqueue_change(vty, "./authentication-password", NB_OP_DESTROY,
NULL);
return nb_cli_apply_changes(vty, "./frr-ripd:rip");
@@ -970,12 +992,24 @@ void cli_show_ip_rip_authentication_key_chain(struct vty *vty,
*/
DEFPY (clear_ip_rip,
clear_ip_rip_cmd,
- "clear ip rip",
+ "clear ip rip [vrf WORD]",
CLEAR_STR
IP_STR
- "Clear IP RIP database\n")
+ "Clear IP RIP database\n"
+ VRF_CMD_HELP_STR)
{
- return nb_cli_rpc("/frr-ripd:clear-rip-route", NULL, NULL);
+ struct list *input;
+
+ input = list_new();
+ if (vrf) {
+ struct yang_data *yang_vrf;
+
+ yang_vrf = yang_data_new("/frr-ripd:clear-rip-route/input/vrf",
+ vrf);
+ listnode_add(input, yang_vrf);
+ }
+
+ return nb_cli_rpc("/frr-ripd:clear-rip-route", input, NULL);
}
void rip_cli_init(void)