mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 22:14:55 +00:00
bgpd: move router bgp nb callback
move `router bgp` nb callback at `bgp` node level to have access to bgp context at neighbor and peer-group level and align create/destroy callbacks call during no router bgp. Earlier `no router bgp` is performed first global destroy callback is called which essentially removes `bgp context` then it calls to remove (parallel nodes) neighbor and peer-group which does not have access to bgp context. Moving router bgp at bgp solves this destroy callback ordering issue. Signed-off-by: Chirag Shah <chirag@nvidia.com>
This commit is contained in:
parent
87ce25646b
commit
5e42cb2fb0
@ -27,11 +27,11 @@ const struct frr_yang_module_info frr_bgp_info = {
|
|||||||
.name = "frr-bgp",
|
.name = "frr-bgp",
|
||||||
.nodes = {
|
.nodes = {
|
||||||
{
|
{
|
||||||
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/global",
|
.xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp",
|
||||||
.cbs = {
|
.cbs = {
|
||||||
.cli_show = cli_show_router_bgp,
|
.cli_show = cli_show_router_bgp,
|
||||||
.create = bgp_global_create,
|
.create = bgp_create,
|
||||||
.destroy = bgp_global_destroy,
|
.destroy = bgp_destroy,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
extern const struct frr_yang_module_info frr_bgp_info;
|
extern const struct frr_yang_module_info frr_bgp_info;
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
int bgp_global_create(struct nb_cb_create_args *args);
|
int bgp_create(struct nb_cb_create_args *args);
|
||||||
int bgp_global_destroy(struct nb_cb_destroy_args *args);
|
int bgp_destroy(struct nb_cb_destroy_args *args);
|
||||||
int bgp_global_local_as_modify(struct nb_cb_modify_args *args);
|
int bgp_global_local_as_modify(struct nb_cb_modify_args *args);
|
||||||
int bgp_global_router_id_modify(struct nb_cb_modify_args *args);
|
int bgp_global_router_id_modify(struct nb_cb_modify_args *args);
|
||||||
int bgp_global_router_id_destroy(struct nb_cb_destroy_args *args);
|
int bgp_global_router_id_destroy(struct nb_cb_destroy_args *args);
|
||||||
|
@ -60,13 +60,11 @@ int routing_control_plane_protocols_name_validate(
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath:
|
* XPath:
|
||||||
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/global
|
* /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp
|
||||||
*/
|
*/
|
||||||
int bgp_global_create(struct nb_cb_create_args *args)
|
int bgp_create(struct nb_cb_create_args *args)
|
||||||
{
|
{
|
||||||
|
|
||||||
const struct lyd_node *vrf_dnode;
|
const struct lyd_node *vrf_dnode;
|
||||||
const struct lyd_node *bgp_dnode;
|
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
struct vrf *vrf;
|
struct vrf *vrf;
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
@ -95,10 +93,10 @@ int bgp_global_create(struct nb_cb_create_args *args)
|
|||||||
inst_type = BGP_INSTANCE_TYPE_VRF;
|
inst_type = BGP_INSTANCE_TYPE_VRF;
|
||||||
}
|
}
|
||||||
|
|
||||||
as = yang_dnode_get_uint32(args->dnode, "./local-as");
|
as = yang_dnode_get_uint32(args->dnode, "./global/local-as");
|
||||||
|
|
||||||
is_view_inst = yang_dnode_get_bool(args->dnode,
|
is_view_inst = yang_dnode_get_bool(
|
||||||
"./instance-type-view");
|
args->dnode, "./global/instance-type-view");
|
||||||
if (is_view_inst)
|
if (is_view_inst)
|
||||||
inst_type = BGP_INSTANCE_TYPE_VIEW;
|
inst_type = BGP_INSTANCE_TYPE_VIEW;
|
||||||
|
|
||||||
@ -127,18 +125,16 @@ int bgp_global_create(struct nb_cb_create_args *args)
|
|||||||
|
|
||||||
UNSET_FLAG(bgp->vrf_flags, BGP_VRF_AUTO);
|
UNSET_FLAG(bgp->vrf_flags, BGP_VRF_AUTO);
|
||||||
|
|
||||||
bgp_dnode = yang_dnode_get_parent(args->dnode, "bgp");
|
nb_running_set_entry(args->dnode, bgp);
|
||||||
nb_running_set_entry(bgp_dnode, bgp);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bgp_global_destroy(struct nb_cb_destroy_args *args)
|
int bgp_destroy(struct nb_cb_destroy_args *args)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
const struct lyd_node *bgp_dnode;
|
|
||||||
|
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
@ -171,8 +167,7 @@ int bgp_global_destroy(struct nb_cb_destroy_args *args)
|
|||||||
case NB_EV_ABORT:
|
case NB_EV_ABORT:
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
case NB_EV_APPLY:
|
case NB_EV_APPLY:
|
||||||
bgp_dnode = yang_dnode_get_parent(args->dnode, "bgp");
|
bgp = nb_running_unset_entry(args->dnode);
|
||||||
bgp = nb_running_unset_entry(bgp_dnode);
|
|
||||||
|
|
||||||
bgp_vpn_leak_unimport(bgp);
|
bgp_vpn_leak_unimport(bgp);
|
||||||
bgp_delete(bgp);
|
bgp_delete(bgp);
|
||||||
|
@ -1384,7 +1384,7 @@ void cli_show_router_bgp(struct vty *vty, struct lyd_node *dnode,
|
|||||||
|
|
||||||
vrf_dnode = yang_dnode_get_parent(dnode, "control-plane-protocol");
|
vrf_dnode = yang_dnode_get_parent(dnode, "control-plane-protocol");
|
||||||
vrf_name = yang_dnode_get_string(vrf_dnode, "./vrf");
|
vrf_name = yang_dnode_get_string(vrf_dnode, "./vrf");
|
||||||
as = yang_dnode_get_uint32(dnode, "./local-as");
|
as = yang_dnode_get_uint32(dnode, "./global/local-as");
|
||||||
|
|
||||||
vty_out(vty, "!\n");
|
vty_out(vty, "!\n");
|
||||||
vty_out(vty, "router bgp %u", as);
|
vty_out(vty, "router bgp %u", as);
|
||||||
|
@ -90,10 +90,10 @@ module frr-bgp {
|
|||||||
"BGP protocol augmentation of ietf-routing module
|
"BGP protocol augmentation of ietf-routing module
|
||||||
control-plane-protocol.";
|
control-plane-protocol.";
|
||||||
}
|
}
|
||||||
|
presence "Enables configuration of BGP";
|
||||||
description
|
description
|
||||||
"Top-level configuration for the BGP router.";
|
"Top-level configuration for the BGP router.";
|
||||||
container global {
|
container global {
|
||||||
presence "Enables global configuration of BGP";
|
|
||||||
description
|
description
|
||||||
"Global configuration for the BGP router.";
|
"Global configuration for the BGP router.";
|
||||||
leaf local-as {
|
leaf local-as {
|
||||||
|
Loading…
Reference in New Issue
Block a user