bgpd: prevent from configuring vrf-policy when in BGP VRF instance

Under a BGP VRF instance, prevent from entering in vrf-policy mode. This
mode is reserved for non VRF instances that want to handle several VRF
at the same time.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
Philippe Guibert 2018-02-16 11:00:01 +01:00
parent 58120f6fd8
commit e2063df358

View File

@ -2977,6 +2977,11 @@ DEFUN_NOSH (vnc_vrf_policy,
struct rfapi_nve_group_cfg *rfg;
VTY_DECLVAR_CONTEXT(bgp, bgp);
if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) {
vty_out(vty, "Can't configure vrf-policy within a BGP VRF instance\n");
return CMD_WARNING_CONFIG_FAILED;
}
/* Search for name */
rfg = bgp_rfapi_cfg_match_byname(bgp, argv[1]->arg,
RFAPI_GROUP_CFG_VRF);
@ -3007,6 +3012,10 @@ DEFUN (vnc_no_vrf_policy,
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
/* silently return */
if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF)
return CMD_SUCCESS;
return bgp_rfapi_delete_named_nve_group(vty, bgp, argv[2]->arg,
RFAPI_GROUP_CFG_VRF);
}