mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 08:32:45 +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",
|
||||
.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 = {
|
||||
.cli_show = cli_show_router_bgp,
|
||||
.create = bgp_global_create,
|
||||
.destroy = bgp_global_destroy,
|
||||
.create = bgp_create,
|
||||
.destroy = bgp_destroy,
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -26,8 +26,8 @@
|
||||
extern const struct frr_yang_module_info frr_bgp_info;
|
||||
|
||||
/* prototypes */
|
||||
int bgp_global_create(struct nb_cb_create_args *args);
|
||||
int bgp_global_destroy(struct nb_cb_destroy_args *args);
|
||||
int bgp_create(struct nb_cb_create_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_router_id_modify(struct nb_cb_modify_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:
|
||||
* /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 *bgp_dnode;
|
||||
struct bgp *bgp;
|
||||
struct vrf *vrf;
|
||||
const char *name = NULL;
|
||||
@ -95,10 +93,10 @@ int bgp_global_create(struct nb_cb_create_args *args)
|
||||
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,
|
||||
"./instance-type-view");
|
||||
is_view_inst = yang_dnode_get_bool(
|
||||
args->dnode, "./global/instance-type-view");
|
||||
if (is_view_inst)
|
||||
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);
|
||||
|
||||
bgp_dnode = yang_dnode_get_parent(args->dnode, "bgp");
|
||||
nb_running_set_entry(bgp_dnode, bgp);
|
||||
nb_running_set_entry(args->dnode, bgp);
|
||||
break;
|
||||
}
|
||||
|
||||
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;
|
||||
const struct lyd_node *bgp_dnode;
|
||||
|
||||
switch (args->event) {
|
||||
case NB_EV_VALIDATE:
|
||||
@ -171,8 +167,7 @@ int bgp_global_destroy(struct nb_cb_destroy_args *args)
|
||||
case NB_EV_ABORT:
|
||||
return NB_OK;
|
||||
case NB_EV_APPLY:
|
||||
bgp_dnode = yang_dnode_get_parent(args->dnode, "bgp");
|
||||
bgp = nb_running_unset_entry(bgp_dnode);
|
||||
bgp = nb_running_unset_entry(args->dnode);
|
||||
|
||||
bgp_vpn_leak_unimport(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_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, "router bgp %u", as);
|
||||
|
@ -90,10 +90,10 @@ module frr-bgp {
|
||||
"BGP protocol augmentation of ietf-routing module
|
||||
control-plane-protocol.";
|
||||
}
|
||||
presence "Enables configuration of BGP";
|
||||
description
|
||||
"Top-level configuration for the BGP router.";
|
||||
container global {
|
||||
presence "Enables global configuration of BGP";
|
||||
description
|
||||
"Global configuration for the BGP router.";
|
||||
leaf local-as {
|
||||
|
Loading…
Reference in New Issue
Block a user