diff options
author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-05-15 20:24:59 +0200 |
---|---|---|
committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-05-20 15:39:34 +0200 |
commit | d40d6c2274b7d05b4facd70228aaa8a1866d7efa (patch) | |
tree | f67e2939849d2b4a6801f7fdd4d9cd3a359e1be7 | |
parent | yang: support BFD session profiles (diff) | |
download | frr-d40d6c2274b7d05b4facd70228aaa8a1866d7efa.tar.xz frr-d40d6c2274b7d05b4facd70228aaa8a1866d7efa.zip |
bfdd,lib,vtysh: new command node for BFD profiles
Add the necessary code to implement the BFD profile command node.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
-rw-r--r-- | bfdd/bfdd_cli.c | 34 | ||||
-rw-r--r-- | lib/command.c | 3 | ||||
-rw-r--r-- | lib/command.h | 3 | ||||
-rw-r--r-- | vtysh/vtysh.c | 21 |
4 files changed, 61 insertions, 0 deletions
diff --git a/bfdd/bfdd_cli.c b/bfdd/bfdd_cli.c index 3e44fcb22..eda8166e6 100644 --- a/bfdd/bfdd_cli.c +++ b/bfdd/bfdd_cli.c @@ -395,6 +395,33 @@ void bfd_cli_show_echo_interval(struct vty *vty, struct lyd_node *dnode, } } +/* + * Profile commands. + */ +DEFPY_NOSH(bfd_profile, bfd_profile_cmd, + "profile WORD$name", + BFD_PROFILE_STR + BFD_PROFILE_NAME_STR) +{ + return CMD_SUCCESS; +} + +DEFPY(no_bfd_profile, no_bfd_profile_cmd, + "no profile BFDPROF$name", + NO_STR + BFD_PROFILE_STR + BFD_PROFILE_NAME_STR) +{ + return CMD_SUCCESS; +} + +struct cmd_node bfd_profile_node = { + .name = "bfd profile", + .node = BFD_PROFILE_NODE, + .parent_node = BFD_NODE, + .prompt = "%s(config-bfd-profile)# ", +}; + void bfdd_cli_init(void) { @@ -410,4 +437,11 @@ bfdd_cli_init(void) install_element(BFD_PEER_NODE, &bfd_peer_tx_cmd); install_element(BFD_PEER_NODE, &bfd_peer_echo_cmd); install_element(BFD_PEER_NODE, &bfd_peer_echo_interval_cmd); + + /* Profile commands. */ + install_node(&bfd_profile_node); + install_default(BFD_PROFILE_NODE); + + install_element(BFD_NODE, &bfd_profile_cmd); + install_element(BFD_NODE, &no_bfd_profile_cmd); } diff --git a/lib/command.c b/lib/command.c index d8a2270bc..c9715965a 100644 --- a/lib/command.c +++ b/lib/command.c @@ -836,6 +836,9 @@ enum node_type node_parent(enum node_type node) case BFD_PEER_NODE: ret = BFD_NODE; break; + case BFD_PROFILE_NODE: + ret = BFD_NODE; + break; default: ret = CONFIG_NODE; break; diff --git a/lib/command.h b/lib/command.h index 725a20144..ed0ea18d6 100644 --- a/lib/command.h +++ b/lib/command.h @@ -155,6 +155,7 @@ enum node_type { BGP_FLOWSPECV6_NODE, /* BGP IPv6 FLOWSPEC Address-Family */ BFD_NODE, /* BFD protocol mode. */ BFD_PEER_NODE, /* BFD peer configuration mode. */ + BFD_PROFILE_NODE, /* BFD profile configuration mode. */ OPENFABRIC_NODE, /* OpenFabric router configuration node */ VRRP_NODE, /* VRRP node */ BMP_NODE, /* BMP config under router bgp */ @@ -403,6 +404,8 @@ struct cmd_node { #define WATCHFRR_STR "watchfrr information\n" #define ZEBRA_STR "Zebra information\n" #define FILTER_LOG_STR "Filter Logs\n" +#define BFD_PROFILE_STR "BFD profile.\n" +#define BFD_PROFILE_NAME_STR "BFD profile name.\n" #define CMD_VNI_RANGE "(1-16777215)" #define CONF_BACKUP_EXT ".sav" diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 15ec866fc..21280ec7a 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1492,6 +1492,13 @@ static struct cmd_node bfd_peer_node = { .parent_node = BFD_NODE, .prompt = "%s(config-bfd-peer)# ", }; + +static struct cmd_node bfd_profile_node = { + .name = "bfd profile", + .node = BFD_PROFILE_NODE, + .parent_node = BFD_NODE, + .prompt = "%s(config-bfd-profile)# ", +}; #endif /* HAVE_BFDD */ /* Defined in lib/vty.c */ @@ -1947,6 +1954,15 @@ DEFUNSH(VTYSH_BFDD, bfd_peer_enter, bfd_peer_enter_cmd, vty->node = BFD_PEER_NODE; return CMD_SUCCESS; } + +DEFUNSH(VTYSH_BFDD, bfd_profile_enter, bfd_profile_enter_cmd, + "profile WORD", + BFD_PROFILE_STR + BFD_PROFILE_NAME_STR) +{ + vty->node = BFD_PROFILE_NODE; + return CMD_SUCCESS; +} #endif /* HAVE_BFDD */ DEFSH(VTYSH_PBRD, vtysh_no_pbr_map_cmd, "no pbr-map PBRMAP [seq (1-700)]", @@ -3796,6 +3812,7 @@ void vtysh_init_vty(void) #if HAVE_BFDD > 0 install_node(&bfd_node); install_node(&bfd_peer_node); + install_node(&bfd_profile_node); #endif /* HAVE_BFDD */ struct cmd_node *node; @@ -3897,16 +3914,20 @@ void vtysh_init_vty(void) /* Enter node. */ install_element(CONFIG_NODE, &bfd_enter_cmd); install_element(BFD_NODE, &bfd_peer_enter_cmd); + install_element(BFD_NODE, &bfd_profile_enter_cmd); /* Exit/quit node. */ install_element(BFD_NODE, &vtysh_exit_bfdd_cmd); install_element(BFD_NODE, &vtysh_quit_bfdd_cmd); install_element(BFD_PEER_NODE, &vtysh_exit_bfdd_cmd); install_element(BFD_PEER_NODE, &vtysh_quit_bfdd_cmd); + install_element(BFD_PROFILE_NODE, &vtysh_exit_bfdd_cmd); + install_element(BFD_PROFILE_NODE, &vtysh_quit_bfdd_cmd); /* End/exit all. */ install_element(BFD_NODE, &vtysh_end_all_cmd); install_element(BFD_PEER_NODE, &vtysh_end_all_cmd); + install_element(BFD_PROFILE_NODE, &vtysh_end_all_cmd); #endif /* HAVE_BFDD */ install_element(VTY_NODE, &vtysh_exit_line_vty_cmd); install_element(VTY_NODE, &vtysh_quit_line_vty_cmd); |