.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,
}
},
{
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);
/*
* 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;
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;
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:
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);
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);