]> git.puffer.fish Git - mirror/frr.git/commitdiff
Revert "bgpd: move router bgp nb callback"
authorIgor Ryzhov <iryzhov@nfware.com>
Thu, 13 May 2021 23:13:20 +0000 (02:13 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Tue, 3 Aug 2021 20:36:31 +0000 (23:36 +0300)
This reverts commit 5e42cb2fb088a28202e60ec57a4116f3d1f0afd5.

bgpd/bgp_nb.c
bgpd/bgp_nb.h
bgpd/bgp_nb_config.c
bgpd/bgp_vty.c

index 004e74d7edbb012419def2eb72897a3e1b1f41a4..83f59f1a4b5628c0b620bffba766c0ac1c53ef54 100644 (file)
@@ -29,11 +29,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",
+                       .xpath = "/frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/global",
                        .cbs = {
                                .cli_show = cli_show_router_bgp,
-                               .create = bgp_create,
-                               .destroy = bgp_destroy,
+                               .create = bgp_global_create,
+                               .destroy = bgp_global_destroy,
                        }
                },
                {
index 530d5888112f5019981860d35d712da80407ab73..a452251a9931bfc40f71d99aecb11e353fb90680 100644 (file)
@@ -26,8 +26,8 @@
 extern const struct frr_yang_module_info frr_bgp_info;
 
 /* prototypes */
-int bgp_create(struct nb_cb_create_args *args);
-int bgp_destroy(struct nb_cb_destroy_args *args);
+int bgp_global_create(struct nb_cb_create_args *args);
+int bgp_global_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);
index 137eb2f6af4d0f39b2549fd866e1b67eaafe3b56..6d5935abedc089a569ad1860c7a0d49fb8d52d5c 100644 (file)
@@ -64,11 +64,13 @@ int routing_control_plane_protocols_name_validate(
 
 /*
  * XPath:
- * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp
+ * /frr-routing:routing/control-plane-protocols/control-plane-protocol/frr-bgp:bgp/global
  */
-int bgp_create(struct nb_cb_create_args *args)
+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;
@@ -97,10 +99,10 @@ int bgp_create(struct nb_cb_create_args *args)
                        inst_type = BGP_INSTANCE_TYPE_VRF;
                }
 
-               as = yang_dnode_get_uint32(args->dnode, "./global/local-as");
+               as = yang_dnode_get_uint32(args->dnode, "./local-as");
 
-               is_view_inst = yang_dnode_get_bool(
-                       args->dnode, "./global/instance-type-view");
+               is_view_inst = yang_dnode_get_bool(args->dnode,
+                                                  "./instance-type-view");
                if (is_view_inst)
                        inst_type = BGP_INSTANCE_TYPE_VIEW;
 
@@ -129,16 +131,18 @@ int bgp_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;
        }
 
        return NB_OK;
 }
 
-int bgp_destroy(struct nb_cb_destroy_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:
@@ -171,7 +175,8 @@ int bgp_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_delete(bgp);
 
index e31c04434c9eed5a815e4cdf9f8e852b9d21676f..559a9d50457021802cd7591d43f748f46c027aa9 100644 (file)
@@ -1502,7 +1502,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, "./global/local-as");
+       as = yang_dnode_get_uint32(dnode, "./local-as");
 
        vty_out(vty, "!\n");
        vty_out(vty, "router bgp %u", as);