diff options
author | Chirag Shah <chirag@nvidia.com> | 2020-09-16 19:28:11 +0200 |
---|---|---|
committer | Chirag Shah <chirag@nvidia.com> | 2020-10-03 20:25:38 +0200 |
commit | 87ce25646be36bb9a27e75d177615e3d19a07df0 (patch) | |
tree | ccedf7d4f9580ec493930af58d932752ea31c963 /bgpd/bgp_nb_config.c | |
parent | bgpd: shorten northbound callback names (diff) | |
download | frr-87ce25646be36bb9a27e75d177615e3d19a07df0.tar.xz frr-87ce25646be36bb9a27e75d177615e3d19a07df0.zip |
bgpd: correct bgp global context
Move bgp (router bgp) context at "bgp" node
level from (instead of) "global" level.
This change allows access of bgp context at neighbor
and peer-group node levels.
+--rw bgp <--- (store `struct bgp` at bgp node xpath)
+--rw global!
| ...
| +--rw afi-safis
| ...
+--rw neighbors
| +--rw neighbor* [remote-address]
| ...
| | +--rw afi-safis
| ...
| +--rw unnumbered-neighbor* [interface]
| ...
+--rw peer-groups
+--rw peer-group* [peer-group-name]
...
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Diffstat (limited to 'bgpd/bgp_nb_config.c')
-rw-r--r-- | bgpd/bgp_nb_config.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bgpd/bgp_nb_config.c b/bgpd/bgp_nb_config.c index cb82c1bc2..87962febd 100644 --- a/bgpd/bgp_nb_config.c +++ b/bgpd/bgp_nb_config.c @@ -66,6 +66,7 @@ int bgp_global_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; @@ -126,8 +127,8 @@ int bgp_global_create(struct nb_cb_create_args *args) UNSET_FLAG(bgp->vrf_flags, BGP_VRF_AUTO); - nb_running_set_entry(args->dnode, bgp); - + bgp_dnode = yang_dnode_get_parent(args->dnode, "bgp"); + nb_running_set_entry(bgp_dnode, bgp); break; } @@ -137,6 +138,7 @@ int bgp_global_create(struct nb_cb_create_args *args) int bgp_global_destroy(struct nb_cb_destroy_args *args) { struct bgp *bgp; + const struct lyd_node *bgp_dnode; switch (args->event) { case NB_EV_VALIDATE: @@ -169,7 +171,8 @@ int bgp_global_destroy(struct nb_cb_destroy_args *args) case NB_EV_ABORT: return NB_OK; case NB_EV_APPLY: - bgp = nb_running_unset_entry(args->dnode); + bgp_dnode = yang_dnode_get_parent(args->dnode, "bgp"); + bgp = nb_running_unset_entry(bgp_dnode); bgp_vpn_leak_unimport(bgp); bgp_delete(bgp); |