This commit includes changes related to introduce new subnode under bgp called vrf <>. This node permits configuring route distinguishers and route target under the subnode, by using vtysh command tool.
Signed-off-by: Philippe Guibert <philippe.guib...@6wind.com> --- vtysh/extract.pl.in | 2 ++ vtysh/vtysh.c | 42 ++++++++++++++++++++++++++++++++++++++++++ vtysh/vtysh_config.c | 6 +++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 924cffe2cb86..54c6f969b690 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -53,7 +53,9 @@ $ignore{'"address-family ipv4 vrf NAME"'} = "ignore"; $ignore{'"address-family encap"'} = "ignore"; $ignore{'"address-family encapv4"'} = "ignore"; $ignore{'"address-family encapv6"'} = "ignore"; +$ignore{'"vrf WORD"'} = "ignore"; $ignore{'"exit-address-family"'} = "ignore"; +$ignore{'"exit-bgp-vrf"'} = "ignore"; $ignore{'"key chain WORD"'} = "ignore"; $ignore{'"key <0-2147483647>"'} = "ignore"; $ignore{'"route-map WORD (deny|permit) <1-65535>"'} = "ignore"; diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 2e2203da61d7..e73eb867f3cf 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -302,6 +302,10 @@ vtysh_execute_func (const char *line, int pager) { vtysh_execute("exit-address-family"); } + else if ((saved_node == BGP_VRF_NODE) && (tried == 1)) + { + vtysh_execute("exit-bgp-vrf"); + } else if ((saved_node == KEYCHAIN_KEY_NODE) && (tried == 1)) { vtysh_execute("exit"); @@ -741,6 +745,13 @@ static struct cmd_node bgp_ipv6m_node = "%s(config-router-af)# " }; +/* VRF node. */ +static struct cmd_node bgp_vrf_node = +{ + BGP_VRF_NODE, + "%s(bgp-vrf)# " +}; + static struct cmd_node ospf_node = { OSPF_NODE, @@ -972,6 +983,18 @@ DEFUNSH (VTYSH_BGPD, return CMD_SUCCESS; } +DEFUNSH (VTYSH_BGPD, + bgp_vrf, + bgp_vrf_cmd, + "vrf WORD", + "BGP VRF\n" + "VRF Name\n" +) +{ + vty->node = BGP_VRF_NODE; + return CMD_SUCCESS; +} + DEFUNSH (VTYSH_RIPD, key_chain, key_chain_cmd, @@ -1145,6 +1168,7 @@ vtysh_exit (struct vty *vty) case BGP_IPV4M_NODE: case BGP_IPV6_NODE: case BGP_IPV6M_NODE: + case BGP_VRF_NODE: vty->node = BGP_NODE; break; case KEYCHAIN_KEY_NODE: @@ -1191,6 +1215,17 @@ DEFUNSH (VTYSH_BGPD, return CMD_SUCCESS; } +DEFUNSH (VTYSH_BGPD, + exit_bgp_vrf, + exit_bgp_vrf_cmd, + "exit-bgp-vrf", + "Exit from BGP vrf configuration mode\n") +{ + if (vty->node == BGP_VRF_NODE) + vty->node = BGP_NODE; + return CMD_SUCCESS; +} + DEFUNSH (VTYSH_ZEBRA, vtysh_exit_zebra, vtysh_exit_zebra_cmd, @@ -2428,6 +2463,7 @@ vtysh_init_vty (void) install_node (&bgp_ipv6_node, NULL); install_node (&bgp_ipv6m_node, NULL); /* #endif */ + install_node (&bgp_vrf_node, NULL); install_node (&ospf_node, NULL); /* #ifdef HAVE_IPV6 */ install_node (&ripng_node, NULL); @@ -2456,6 +2492,7 @@ vtysh_init_vty (void) vtysh_install_default (BGP_IPV4M_NODE); vtysh_install_default (BGP_IPV6_NODE); vtysh_install_default (BGP_IPV6M_NODE); + vtysh_install_default (BGP_VRF_NODE); vtysh_install_default (OSPF_NODE); vtysh_install_default (RIPNG_NODE); vtysh_install_default (OSPF6_NODE); @@ -2502,6 +2539,8 @@ vtysh_init_vty (void) install_element (BGP_IPV6_NODE, &vtysh_quit_bgpd_cmd); install_element (BGP_IPV6M_NODE, &vtysh_exit_bgpd_cmd); install_element (BGP_IPV6M_NODE, &vtysh_quit_bgpd_cmd); + install_element (BGP_VRF_NODE, &vtysh_exit_bgpd_cmd); + install_element (BGP_VRF_NODE, &vtysh_quit_bgpd_cmd); install_element (ISIS_NODE, &vtysh_exit_isisd_cmd); install_element (ISIS_NODE, &vtysh_quit_isisd_cmd); install_element (KEYCHAIN_NODE, &vtysh_exit_ripd_cmd); @@ -2530,6 +2569,7 @@ vtysh_init_vty (void) install_element (BGP_ENCAPV6_NODE, &vtysh_end_all_cmd); install_element (BGP_IPV6_NODE, &vtysh_end_all_cmd); install_element (BGP_IPV6M_NODE, &vtysh_end_all_cmd); + install_element (BGP_VRF_NODE, &vtysh_end_all_cmd); install_element (ISIS_NODE, &vtysh_end_all_cmd); install_element (KEYCHAIN_NODE, &vtysh_end_all_cmd); install_element (KEYCHAIN_KEY_NODE, &vtysh_end_all_cmd); @@ -2567,6 +2607,7 @@ vtysh_init_vty (void) install_element (BGP_NODE, &address_family_ipv6_unicast_cmd); install_element (BGP_NODE, &address_family_ipv6_multicast_cmd); #endif + install_element (BGP_NODE, &bgp_vrf_cmd); install_element (BGP_VPNV4_NODE, &exit_address_family_cmd); install_element (BGP_VPNV6_NODE, &exit_address_family_cmd); install_element (BGP_ENCAP_NODE, &exit_address_family_cmd); @@ -2575,6 +2616,7 @@ vtysh_init_vty (void) install_element (BGP_IPV4M_NODE, &exit_address_family_cmd); install_element (BGP_IPV6_NODE, &exit_address_family_cmd); install_element (BGP_IPV6M_NODE, &exit_address_family_cmd); + install_element (BGP_VRF_NODE, &exit_bgp_vrf_cmd); install_element (CONFIG_NODE, &key_chain_cmd); install_element (CONFIG_NODE, &route_map_cmd); install_element (CONFIG_NODE, &vtysh_line_vty_cmd); diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c index c80c42a4fb2f..74ae61640174 100644 --- a/vtysh/vtysh_config.c +++ b/vtysh/vtysh_config.c @@ -187,7 +187,11 @@ vtysh_config_parse_line (const char *line) else if (config->index == RMAP_NODE || config->index == VTY_NODE) config_add_line_uniq (config->line, line); - else + else if (config->index == BGP_VRF_NODE) + { + config = config_get (BGP_VRF_NODE, line); + } + else config_add_line (config->line, line); } else -- 2.1.4 _______________________________________________ Quagga-dev mailing list Quagga-dev@lists.quagga.net https://lists.quagga.net/mailman/listinfo/quagga-dev