bgpd: disable deleting default instance if vrf instances exist

Problem reported with deleting the default BGP instance where there
are vrf instances that depend on it (like l2vpn evpn vrfs).  Since
importing for vrf route-leaking also requires the existence of the
default instance, disallowing deleting the BGP default instance if
anyt vrf instance is also defined.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
This commit is contained in:
Don Slice 2019-04-22 15:12:38 -04:00
parent 528628cb2e
commit dd5868c2cc

View File

@ -1129,10 +1129,25 @@ DEFUN (no_router_bgp,
}
if (bgp->l3vni) {
vty_out(vty, "%% Please unconfigure l3vni %u",
vty_out(vty, "%% Please unconfigure l3vni %u\n",
bgp->l3vni);
return CMD_WARNING_CONFIG_FAILED;
}
/* Cannot delete default instance if vrf instances exist */
if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
struct listnode *node;
struct bgp *tmp_bgp;
for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, tmp_bgp)) {
if (tmp_bgp->inst_type
== BGP_INSTANCE_TYPE_VRF) {
vty_out(vty,
"%% Cannot delete default BGP instance. Dependent VRF instances exist\n");
return CMD_WARNING_CONFIG_FAILED;
}
}
}
}
bgp_delete(bgp);