]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: accept vni rd_rt command for default vrf
authorChirag Shah <chirag@cumulusnetworks.com>
Sat, 2 Jun 2018 00:52:14 +0000 (17:52 -0700)
committerChirag Shah <chirag@cumulusnetworks.com>
Sun, 10 Jun 2018 00:35:37 +0000 (17:35 -0700)
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 <chirag@cumulusnetworks.com>
bgpd/bgp_evpn_vty.c

index a1b9e6e6a62ba0624c197403bbb9d76f76055ba0..8556a325bb1bd953e81cf79273c34dec66a7814c 100644 (file)
@@ -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")) {