diff options
author | G. Paul Ziemba <paulz@labn.net> | 2018-02-12 04:50:02 +0100 |
---|---|---|
committer | Lou Berger <lberger@labn.net> | 2018-03-09 22:42:40 +0100 |
commit | fd9b55a2b77c187730600d429b3f290ab58fa035 (patch) | |
tree | 33281c5330085f4e716a123614e7a1fc31c7f60f /vtysh | |
parent | bgpd: vpn-vrf route leaking (diff) | |
download | frr-fd9b55a2b77c187730600d429b3f290ab58fa035.tar.xz frr-fd9b55a2b77c187730600d429b3f290ab58fa035.zip |
vtysh: add bgpd vpn-policy nodes
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
Diffstat (limited to 'vtysh')
-rw-r--r-- | vtysh/vtysh.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 7dfe7753c..8384902c9 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -360,7 +360,9 @@ static int vtysh_execute_func(const char *line, int pager) } else if ((saved_node == KEYCHAIN_KEY_NODE || saved_node == LDP_PSEUDOWIRE_NODE || saved_node == LDP_IPV4_IFACE_NODE - || saved_node == LDP_IPV6_IFACE_NODE) + || saved_node == LDP_IPV6_IFACE_NODE + || saved_node == BGP_VPNPOLICY_IPV4_NODE + || saved_node == BGP_VPNPOLICY_IPV6_NODE) && (tried == 1)) { vtysh_execute("exit"); } else if (tried) { @@ -632,7 +634,9 @@ int vtysh_mark_file(const char *filename) } else if ((prev_node == BGP_EVPN_VNI_NODE) && (tried == 1)) { fprintf(outputfile, "exit-vni\n"); - } else if ((prev_node == KEYCHAIN_KEY_NODE) + } else if ((prev_node == KEYCHAIN_KEY_NODE + || prev_node == BGP_VPNPOLICY_IPV4_NODE + || prev_node == BGP_VPNPOLICY_IPV6_NODE) && (tried == 1)) { fprintf(outputfile, "exit\n"); } else if (tried) { @@ -1013,6 +1017,12 @@ static struct cmd_node bgp_evpn_node = {BGP_EVPN_NODE, static struct cmd_node bgp_evpn_vni_node = {BGP_EVPN_VNI_NODE, "%s(config-router-af-vni)# "}; +static struct cmd_node bgp_vpn_policy_ipv4_node = { + BGP_VPNPOLICY_IPV4_NODE, "%s(config-router-vpn-policy-ipv4)# ", 1}; + +static struct cmd_node bgp_vpn_policy_ipv6_node = { + BGP_VPNPOLICY_IPV6_NODE, "%s(config-router-vpn-policy-ipv6)# ", 1}; + static struct cmd_node bgp_ipv6l_node = {BGP_IPV6L_NODE, "%s(config-router-af)# "}; @@ -1255,6 +1265,20 @@ DEFUNSH(VTYSH_BGPD, bgp_evpn_vni, bgp_evpn_vni_cmd, "vni (1-16777215)", return CMD_SUCCESS; } +DEFUNSH(VTYSH_BGPD, vpn_policy_afi, vpn_policy_afi_cmd, "vpn-policy <ipv4|ipv6>", + "Configure a VPN policy\n" + BGP_AFI_HELP_STR) +{ + int idx = 1; + + if (argv_find(argv, argc, "ipv4", &idx)) + vty->node = BGP_VPNPOLICY_IPV4_NODE; + else + vty->node = BGP_VPNPOLICY_IPV6_NODE; + return CMD_SUCCESS; +} + + #if defined(ENABLE_BGP_VNC) DEFUNSH(VTYSH_BGPD, vnc_defaults, vnc_defaults_cmd, "vnc defaults", "VNC/RFP related configuration\n" @@ -1528,6 +1552,8 @@ static int vtysh_exit(struct vty *vty) case BGP_IPV6M_NODE: case BGP_IPV6L_NODE: case BGP_VRF_POLICY_NODE: + case BGP_VPNPOLICY_IPV4_NODE: + case BGP_VPNPOLICY_IPV6_NODE: case BGP_EVPN_NODE: case BGP_VNC_DEFAULTS_NODE: case BGP_VNC_NVE_GROUP_NODE: @@ -2121,7 +2147,6 @@ DEFUNSH(VTYSH_ALL, vtysh_log_facility, vtysh_log_facility_cmd, "log facility <kern|user|mail|daemon|auth|syslog|lpr|news|uucp|cron|local0|local1|local2|local3|local4|local5|local6|local7>", "Logging control\n" "Facility parameter for syslog messages\n" LOG_FACILITY_DESC) - { return CMD_SUCCESS; } @@ -2131,7 +2156,6 @@ DEFUNSH(VTYSH_ALL, no_vtysh_log_facility, no_vtysh_log_facility_cmd, "Logging control\n" "Reset syslog facility to default (daemon)\n" "Syslog facility\n") - { return CMD_SUCCESS; } @@ -2141,7 +2165,6 @@ DEFUNSH_DEPRECATED( "log trap <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>", "Logging control\n" "(Deprecated) Set logging level and default for all destinations\n" LOG_LEVEL_DESC) - { return CMD_SUCCESS; } @@ -3077,6 +3100,8 @@ void vtysh_init_vty(void) install_node(&bgp_vrf_policy_node, NULL); install_node(&bgp_evpn_node, NULL); install_node(&bgp_evpn_vni_node, NULL); + install_node(&bgp_vpn_policy_ipv4_node, NULL); + install_node(&bgp_vpn_policy_ipv6_node, NULL); install_node(&bgp_vnc_defaults_node, NULL); install_node(&bgp_vnc_nve_group_node, NULL); install_node(&bgp_vnc_l2_group_node, NULL); @@ -3169,6 +3194,10 @@ void vtysh_init_vty(void) install_element(BGP_EVPN_VNI_NODE, &vtysh_quit_bgpd_cmd); install_element(BGP_IPV6L_NODE, &vtysh_exit_bgpd_cmd); install_element(BGP_IPV6L_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_VPNPOLICY_IPV4_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_VPNPOLICY_IPV4_NODE, &vtysh_quit_bgpd_cmd); + install_element(BGP_VPNPOLICY_IPV6_NODE, &vtysh_exit_bgpd_cmd); + install_element(BGP_VPNPOLICY_IPV6_NODE, &vtysh_quit_bgpd_cmd); #if defined(ENABLE_BGP_VNC) install_element(BGP_VRF_POLICY_NODE, &vtysh_exit_bgpd_cmd); install_element(BGP_VRF_POLICY_NODE, &vtysh_quit_bgpd_cmd); @@ -3221,6 +3250,8 @@ void vtysh_init_vty(void) install_element(BGP_VNC_DEFAULTS_NODE, &vtysh_end_all_cmd); install_element(BGP_VNC_NVE_GROUP_NODE, &vtysh_end_all_cmd); install_element(BGP_VNC_L2_GROUP_NODE, &vtysh_end_all_cmd); + install_element(BGP_VPNPOLICY_IPV4_NODE, &vtysh_end_all_cmd); + install_element(BGP_VPNPOLICY_IPV6_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); @@ -3270,6 +3301,7 @@ void vtysh_init_vty(void) install_element(CONFIG_NODE, &router_bgp_cmd); install_element(BGP_NODE, &address_family_vpnv4_cmd); install_element(BGP_NODE, &address_family_vpnv6_cmd); + install_element(BGP_NODE, &vpn_policy_afi_cmd); #if defined(ENABLE_BGP_VNC) install_element(BGP_NODE, &vnc_vrf_policy_cmd); install_element(BGP_NODE, &vnc_defaults_cmd); |