From: Chirag Shah Date: Sat, 2 Jun 2018 00:52:14 +0000 (-0700) Subject: bgpd: accept vni rd_rt command for default vrf X-Git-Tag: frr-6.1-dev~343^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=a2a8153f4ea30c4f98afc41cb0233c40db3e39d0;p=matthieu%2Ffrr.git bgpd: accept vni rd_rt command for default vrf L2VNI route-distinguisher and route-target configuartions should only applied under DEFAULT VRF bgpd instance. Add newline to each vni display. router bgp 65006 address-family l2vpn evpn vni 1000101 route-target import 1:1000101 do not allow under router bgp 65006 vrf RED Ticket:CM-20204 Reviewed By: Testing Done: Signed-off-by: Chirag Shah --- diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index a1b9e6e6a6..8556a325bb 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -604,7 +604,7 @@ static void show_esi_routes(struct bgp *bgp, json_object_int_add(json, "numPaths", path_cnt); } else { if (prefix_cnt == 0) - vty_out(vty, "No EVPN prefixes exist for this ESI"); + vty_out(vty, "No EVPN prefixes exist for this ESI\n"); else vty_out(vty, "\nDisplayed %u prefixes (%u paths)\n", prefix_cnt, path_cnt); @@ -4231,6 +4231,12 @@ DEFUN (bgp_evpn_vni_rd, if (!bgp || !vpn) return CMD_WARNING; + if (bgp->vrf_id != VRF_DEFAULT) { + vty_out(vty, + "This command is only supported under Default VRF\n"); + return CMD_WARNING; + } + ret = str2prefix_rd(argv[1]->arg, &prd); if (!ret) { vty_out(vty, "%% Malformed Route Distinguisher\n"); @@ -4261,6 +4267,12 @@ DEFUN (no_bgp_evpn_vni_rd, if (!bgp || !vpn) return CMD_WARNING; + if (bgp->vrf_id != VRF_DEFAULT) { + vty_out(vty, + "This command is only supported under Default VRF\n"); + return CMD_WARNING; + } + ret = str2prefix_rd(argv[2]->arg, &prd); if (!ret) { vty_out(vty, "%% Malformed Route Distinguisher\n"); @@ -4295,6 +4307,12 @@ DEFUN (no_bgp_evpn_vni_rd_without_val, if (!bgp || !vpn) return CMD_WARNING; + if (bgp->vrf_id != VRF_DEFAULT) { + vty_out(vty, + "This command is only supported under Default VRF\n"); + return CMD_WARNING; + } + /* Check if we should disallow. */ if (!is_rd_configured(vpn)) { vty_out(vty, "%% RD is not configured for this VNI\n"); @@ -4618,6 +4636,12 @@ DEFUN (bgp_evpn_vni_rt, if (!bgp || !vpn) return CMD_WARNING; + if (bgp->vrf_id != VRF_DEFAULT) { + vty_out(vty, + "This command is only supported under Default VRF\n"); + return CMD_WARNING; + } + if (!strcmp(argv[1]->text, "import")) rt_type = RT_TYPE_IMPORT; else if (!strcmp(argv[1]->text, "export")) @@ -4680,6 +4704,12 @@ DEFUN (no_bgp_evpn_vni_rt, if (!bgp || !vpn) return CMD_WARNING; + if (bgp->vrf_id != VRF_DEFAULT) { + vty_out(vty, + "This command is only supported under Default VRF\n"); + return CMD_WARNING; + } + if (!strcmp(argv[2]->text, "import")) rt_type = RT_TYPE_IMPORT; else if (!strcmp(argv[2]->text, "export")) @@ -4773,6 +4803,12 @@ DEFUN (no_bgp_evpn_vni_rt_without_val, if (!bgp || !vpn) return CMD_WARNING; + if (bgp->vrf_id != VRF_DEFAULT) { + vty_out(vty, + "This command is only supported under Default VRF\n"); + return CMD_WARNING; + } + if (!strcmp(argv[2]->text, "import")) { rt_type = RT_TYPE_IMPORT; } else if (!strcmp(argv[2]->text, "export")) {