]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: correct bgp global context
authorChirag Shah <chirag@nvidia.com>
Wed, 16 Sep 2020 17:28:11 +0000 (10:28 -0700)
committerChirag Shah <chirag@nvidia.com>
Sat, 3 Oct 2020 18:25:38 +0000 (11:25 -0700)
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>
bgpd/bgp_nb.h
bgpd/bgp_nb_config.c
bgpd/bgp_vty.c

index 771d4cad28362a8db7057561e2b8b51151797c3d..95803a460e1caf8dca43137cbf4b68b518361541 100644 (file)
@@ -3431,11 +3431,11 @@ void bgp_global_med_config_apply_finish(struct nb_cb_apply_finish_args *args);
 #define FRR_BGP_GLOBAL_XPATH                                                   \
        "/frr-routing:routing/control-plane-protocols/"                        \
        "control-plane-protocol[type='%s'][name='%s'][vrf='%s']/"              \
-       "frr-bgp:bgp/global"
+       "frr-bgp:bgp"
 
 #define FRR_BGP_GLOBAL_AS_XPATH                                                \
        "/frr-routing:routing/control-plane-protocols/"                        \
        "control-plane-protocol[type='%s'][name='%s'][vrf='%s']/"              \
-       "frr-bgp:bgp/local-as["
+       "frr-bgp:bgp/local-as"
 
 #endif
index cb82c1bc22fa5abf04de8d267f03b24ff08be078..87962febdfe126a0803d275e42faeb052b4234eb 100644 (file)
@@ -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);
index 8264519a8b01fc426660dca1d72c3857f6ead58b..8a83b0320727fad98fb66e81a05ffe325bcf56be 100644 (file)
@@ -1231,9 +1231,11 @@ DEFUN_YANG_NOSH(router_bgp,
 
                nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
                snprintf(as_str, 12, "%d", bgp->as);
-               nb_cli_enqueue_change(vty, "./local-as", NB_OP_MODIFY, as_str);
+               nb_cli_enqueue_change(vty, "./global/local-as", NB_OP_MODIFY,
+                                     as_str);
                if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) {
-                       nb_cli_enqueue_change(vty, "./instance-type-view",
+                       nb_cli_enqueue_change(vty,
+                                             "./global/instance-type-view",
                                              NB_OP_MODIFY, "true");
                }
 
@@ -1271,10 +1273,11 @@ DEFUN_YANG_NOSH(router_bgp,
                         "frr-bgp:bgp", "bgp", name ? name : VRF_DEFAULT_NAME);
 
                nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL);
-               nb_cli_enqueue_change(vty, "./local-as", NB_OP_MODIFY,
+               nb_cli_enqueue_change(vty, "./global/local-as", NB_OP_MODIFY,
                                      argv[idx_asn]->arg);
                if (inst_type == BGP_INSTANCE_TYPE_VIEW) {
-                       nb_cli_enqueue_change(vty, "./instance-type-view",
+                       nb_cli_enqueue_change(vty,
+                                             "./global/instance-type-view",
                                              NB_OP_MODIFY, "true");
                }
 
@@ -1397,7 +1400,8 @@ DEFPY_YANG(bgp_router_id, bgp_router_id_cmd, "bgp router-id A.B.C.D",
           "Override configured router identifier\n"
           "Manually configured router identifier\n")
 {
-       nb_cli_enqueue_change(vty, "./router-id", NB_OP_MODIFY, router_id_str);
+       nb_cli_enqueue_change(vty, "./global/router-id", NB_OP_MODIFY,
+                             router_id_str);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -1407,7 +1411,7 @@ DEFPY_YANG(no_bgp_router_id, no_bgp_router_id_cmd, "no bgp router-id [A.B.C.D]",
           "Override configured router identifier\n"
           "Manually configured router identifier\n")
 {
-       nb_cli_enqueue_change(vty, "./router-id", NB_OP_DESTROY,
+       nb_cli_enqueue_change(vty, "./global/router-id", NB_OP_DESTROY,
                              router_id_str ? router_id_str : NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -1430,9 +1434,9 @@ DEFUN_YANG(bgp_cluster_id,
 {
        int idx_ipv4 = 2;
 
-       nb_cli_enqueue_change(vty,
-                             "./route-reflector/route-reflector-cluster-id",
-                             NB_OP_MODIFY, argv[idx_ipv4]->arg);
+       nb_cli_enqueue_change(
+               vty, "./global/route-reflector/route-reflector-cluster-id",
+               NB_OP_MODIFY, argv[idx_ipv4]->arg);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -1445,9 +1449,9 @@ DEFUN_YANG(no_bgp_cluster_id,
           "Route-Reflector Cluster-id in IP address format\n"
           "Route-Reflector Cluster-id as 32 bit quantity\n")
 {
-       nb_cli_enqueue_change(vty,
-                             "./route-reflector/route-reflector-cluster-id",
-                             NB_OP_DESTROY, NULL);
+       nb_cli_enqueue_change(
+               vty, "./global/route-reflector/route-reflector-cluster-id",
+               NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -1497,8 +1501,8 @@ DEFUN_YANG(bgp_confederation_identifier,
 {
        int idx_number = 3;
 
-       nb_cli_enqueue_change(vty, "./confederation/identifier", NB_OP_MODIFY,
-                             argv[idx_number]->arg);
+       nb_cli_enqueue_change(vty, "./global/confederation/identifier",
+                             NB_OP_MODIFY, argv[idx_number]->arg);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -1512,8 +1516,8 @@ DEFUN_YANG(no_bgp_confederation_identifier,
           "AS number\n"
           "Set routing domain confederation AS\n")
 {
-       nb_cli_enqueue_change(vty, "./confederation/identifier", NB_OP_DESTROY,
-                             NULL);
+       nb_cli_enqueue_change(vty, "./global/confederation/identifier",
+                             NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -1537,7 +1541,7 @@ DEFUN_YANG(bgp_confederation_peers,
        int i;
 
        for (i = idx_asn; i < argc; i++)
-               nb_cli_enqueue_change(vty, "./confederation/member-as",
+               nb_cli_enqueue_change(vty, "./global/confederation/member-as",
                                      NB_OP_CREATE, argv[i]->arg);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -1555,7 +1559,7 @@ DEFUN_YANG(no_bgp_confederation_peers,
        int i;
 
        for (i = idx_asn; i < argc; i++)
-               nb_cli_enqueue_change(vty, "./confederation/member-as",
+               nb_cli_enqueue_change(vty, "./global/confederation/member-as",
                                      NB_OP_DESTROY, argv[i]->arg);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -1650,7 +1654,7 @@ DEFUN_YANG(bgp_maxmed_admin,
           "Advertise routes with max-med\n"
           "Administratively applied, for an indefinite period\n")
 {
-       nb_cli_enqueue_change(vty, "./med-config/enable-med-admin",
+       nb_cli_enqueue_change(vty, "./global/med-config/enable-med-admin",
                              NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -1666,11 +1670,11 @@ DEFUN_YANG(bgp_maxmed_admin_medv,
 {
        int idx_number = 3;
 
-       nb_cli_enqueue_change(vty, "./med-config/enable-med-admin",
+       nb_cli_enqueue_change(vty, "./global/med-config/enable-med-admin",
                              NB_OP_MODIFY, "true");
 
-       nb_cli_enqueue_change(vty, "./med-config/max-med-admin", NB_OP_MODIFY,
-                             argv[idx_number]->arg);
+       nb_cli_enqueue_change(vty, "./global/med-config/max-med-admin",
+                             NB_OP_MODIFY, argv[idx_number]->arg);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -1683,11 +1687,11 @@ DEFUN_YANG(no_bgp_maxmed_admin,
           "Administratively applied, for an indefinite period\n"
           "Max MED value to be used\n")
 {
-       nb_cli_enqueue_change(vty, "./med-config/enable-med-admin",
+       nb_cli_enqueue_change(vty, "./global/med-config/enable-med-admin",
                              NB_OP_MODIFY, "false");
 
-       nb_cli_enqueue_change(vty, "./med-config/max-med-admin", NB_OP_MODIFY,
-                             NULL);
+       nb_cli_enqueue_change(vty, "./global/med-config/max-med-admin",
+                             NB_OP_MODIFY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -1704,17 +1708,18 @@ DEFUN_YANG(bgp_maxmed_onstartup,
        int idx = 0;
 
        argv_find(argv, argc, "(5-86400)", &idx);
-       nb_cli_enqueue_change(vty, "./med-config/max-med-onstart-up-time",
+       nb_cli_enqueue_change(vty,
+                             "./global/med-config/max-med-onstart-up-time",
                              NB_OP_MODIFY, argv[idx]->arg);
 
        if (argv_find(argv, argc, "(0-4294967295)", &idx))
-               nb_cli_enqueue_change(vty,
-                                     "./med-config/max-med-onstart-up-value",
-                                     NB_OP_MODIFY, argv[idx]->arg);
+               nb_cli_enqueue_change(
+                       vty, "./global/med-config/max-med-onstart-up-value",
+                       NB_OP_MODIFY, argv[idx]->arg);
        else
-               nb_cli_enqueue_change(vty,
-                                     "./med-config/max-med-onstart-up-value",
-                                     NB_OP_MODIFY, NULL);
+               nb_cli_enqueue_change(
+                       vty, "./global/med-config/max-med-onstart-up-value",
+                       NB_OP_MODIFY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -1728,10 +1733,12 @@ DEFUN_YANG(no_bgp_maxmed_onstartup,
           "Time (seconds) period for max-med\n"
           "Max MED value to be used\n")
 {
-       nb_cli_enqueue_change(vty, "./med-config/max-med-onstart-up-time",
+       nb_cli_enqueue_change(vty,
+                             "./global/med-config/max-med-onstart-up-time",
                              NB_OP_DESTROY, NULL);
 
-       nb_cli_enqueue_change(vty, "./med-config/max-med-onstart-up-value",
+       nb_cli_enqueue_change(vty,
+                             "./global/med-config/max-med-onstart-up-value",
                              NB_OP_MODIFY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -1968,12 +1975,12 @@ DEFPY_YANG(bgp_wpkt_quanta,
        if (!no)
                nb_cli_enqueue_change(
                        vty,
-                       "./global-neighbor-config/packet-quanta-config/wpkt-quanta",
+                       "./global/global-neighbor-config/packet-quanta-config/wpkt-quanta",
                        NB_OP_MODIFY, quanta_str);
        else
                nb_cli_enqueue_change(
                        vty,
-                       "./global-neighbor-config/packet-quanta-config/wpkt-quanta",
+                       "./global/global-neighbor-config/packet-quanta-config/wpkt-quanta",
                        NB_OP_MODIFY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -1989,12 +1996,12 @@ DEFPY_YANG(bgp_rpkt_quanta,
        if (!no)
                nb_cli_enqueue_change(
                        vty,
-                       "./global-neighbor-config/packet-quanta-config/rpkt-quanta",
+                       "./global/global-neighbor-config/packet-quanta-config/rpkt-quanta",
                        NB_OP_MODIFY, quanta_str);
        else
                nb_cli_enqueue_change(
                        vty,
-                       "./global-neighbor-config/packet-quanta-config/rpkt-quanta",
+                       "./global/global-neighbor-config/packet-quanta-config/rpkt-quanta",
                        NB_OP_MODIFY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -2022,8 +2029,9 @@ DEFUN_YANG(bgp_coalesce_time,
        int idx = 0;
 
        argv_find(argv, argc, "(0-4294967295)", &idx);
-       nb_cli_enqueue_change(vty, "./global-update-group-config/coalesce-time",
-                             NB_OP_MODIFY, argv[idx]->arg);
+       nb_cli_enqueue_change(
+               vty, "./global/global-update-group-config/coalesce-time",
+               NB_OP_MODIFY, argv[idx]->arg);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -2035,8 +2043,9 @@ DEFUN_YANG(no_bgp_coalesce_time,
           "Subgroup coalesce timer\n"
           "Subgroup coalesce timer value (in ms)\n")
 {
-       nb_cli_enqueue_change(vty, "./global-update-group-config/coalesce-time",
-                             NB_OP_MODIFY, NULL);
+       nb_cli_enqueue_change(
+               vty, "./global/global-update-group-config/coalesce-time",
+               NB_OP_MODIFY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -2165,9 +2174,9 @@ DEFUN_YANG(bgp_timers,
        int idx_number = 2;
        int idx_number_2 = 3;
 
-       nb_cli_enqueue_change(vty, "./global-config-timers/keepalive",
+       nb_cli_enqueue_change(vty, "./global/global-config-timers/keepalive",
                              NB_OP_MODIFY, argv[idx_number]->arg);
-       nb_cli_enqueue_change(vty, "./global-config-timers/hold-time",
+       nb_cli_enqueue_change(vty, "./global/global-config-timers/hold-time",
                              NB_OP_MODIFY, argv[idx_number_2]->arg);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -2182,9 +2191,9 @@ DEFUN_YANG(no_bgp_timers,
           "Keepalive interval\n"
           "Holdtime\n")
 {
-       nb_cli_enqueue_change(vty, "./global-config-timers/keepalive",
+       nb_cli_enqueue_change(vty, "./global/global-config-timers/keepalive",
                              NB_OP_DESTROY, NULL);
-       nb_cli_enqueue_change(vty, "./global-config-timers/hold-time",
+       nb_cli_enqueue_change(vty, "./global/global-config-timers/hold-time",
                              NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -2213,7 +2222,7 @@ DEFUN_YANG(bgp_client_to_client_reflection,
           "Configure client to client route reflection\n"
           "reflection of routes allowed\n")
 {
-       nb_cli_enqueue_change(vty, "./route-reflector/no-client-reflect",
+       nb_cli_enqueue_change(vty, "./global/route-reflector/no-client-reflect",
                              NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -2227,7 +2236,7 @@ DEFUN_YANG(no_bgp_client_to_client_reflection,
           "Configure client to client route reflection\n"
           "reflection of routes allowed\n")
 {
-       nb_cli_enqueue_change(vty, "./route-reflector/no-client-reflect",
+       nb_cli_enqueue_change(vty, "./global/route-reflector/no-client-reflect",
                              NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -2279,9 +2288,9 @@ DEFUN_YANG(bgp_always_compare_med,
           "BGP specific commands\n"
           "Allow comparing MED from different neighbors\n")
 {
-       nb_cli_enqueue_change(vty,
-                             "./route-selection-options/always-compare-med",
-                             NB_OP_MODIFY, "true");
+       nb_cli_enqueue_change(
+               vty, "./global/route-selection-options/always-compare-med",
+               NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -2293,9 +2302,9 @@ DEFUN_YANG(no_bgp_always_compare_med,
           "BGP specific commands\n"
           "Allow comparing MED from different neighbors\n")
 {
-       nb_cli_enqueue_change(vty,
-                             "./route-selection-options/always-compare-med",
-                             NB_OP_MODIFY, "false");
+       nb_cli_enqueue_change(
+               vty, "./global/route-selection-options/always-compare-med",
+               NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -2306,8 +2315,8 @@ DEFUN_YANG(bgp_ebgp_requires_policy,
           "BGP specific commands\n"
           "Require in and out policy for eBGP peers (RFC8212)\n")
 {
-       nb_cli_enqueue_change(vty, "./ebgp-requires-policy", NB_OP_MODIFY,
-                             "true");
+       nb_cli_enqueue_change(vty, "./global/ebgp-requires-policy",
+                             NB_OP_MODIFY, "true");
        return nb_cli_apply_changes(vty, NULL);
 }
 
@@ -2318,8 +2327,8 @@ DEFUN_YANG(no_bgp_ebgp_requires_policy,
           "BGP specific commands\n"
           "Require in and out policy for eBGP peers (RFC8212)\n")
 {
-       nb_cli_enqueue_change(vty, "./ebgp-requires-policy", NB_OP_MODIFY,
-                             "false");
+       nb_cli_enqueue_change(vty, "./global/ebgp-requires-policy",
+                             NB_OP_MODIFY, "false");
        return nb_cli_apply_changes(vty, NULL);
 }
 
@@ -2389,9 +2398,9 @@ DEFUN_YANG (bgp_deterministic_med,
        "BGP specific commands\n"
        "Pick the best-MED path among paths advertised from the neighboring AS\n")
 {
-       nb_cli_enqueue_change(vty,
-                             "./route-selection-options/deterministic-med",
-                             NB_OP_MODIFY, "true");
+       nb_cli_enqueue_change(
+               vty, "./global/route-selection-options/deterministic-med",
+               NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -2403,9 +2412,9 @@ DEFUN_YANG (no_bgp_deterministic_med,
        "BGP specific commands\n"
        "Pick the best-MED path among paths advertised from the neighboring AS\n")
 {
-       nb_cli_enqueue_change(vty,
-                             "./route-selection-options/deterministic-med",
-                             NB_OP_MODIFY, "false");
+       nb_cli_enqueue_change(
+               vty, "./global/route-selection-options/deterministic-med",
+               NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3032,8 +3041,8 @@ DEFUN (bgp_graceful_shutdown,
        if (vty->node == CONFIG_NODE)
                return bgp_global_graceful_shutdown_config_vty(vty);
 
-       nb_cli_enqueue_change(vty, "./graceful-shutdown/enable", NB_OP_MODIFY,
-                             "true");
+       nb_cli_enqueue_change(vty, "./global/graceful-shutdown/enable",
+                             NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3048,8 +3057,8 @@ DEFUN_YANG (no_bgp_graceful_shutdown,
        if (vty->node == CONFIG_NODE)
                return bgp_global_graceful_shutdown_deconfig_vty(vty);
 
-       nb_cli_enqueue_change(vty, "./graceful-shutdown/enable", NB_OP_MODIFY,
-                             "false");
+       nb_cli_enqueue_change(vty, "./global/graceful-shutdown/enable",
+                             NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3069,8 +3078,8 @@ DEFUN_YANG (bgp_fast_external_failover,
        BGP_STR
        "Immediately reset session if a link to a directly connected external peer goes down\n")
 {
-       nb_cli_enqueue_change(vty, "./fast-external-failover", NB_OP_MODIFY,
-                             "false");
+       nb_cli_enqueue_change(vty, "./global/fast-external-failover",
+                             NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3082,8 +3091,8 @@ DEFUN_YANG (no_bgp_fast_external_failover,
        BGP_STR
        "Immediately reset session if a link to a directly connected external peer goes down\n")
 {
-       nb_cli_enqueue_change(vty, "./fast-external-failover", NB_OP_MODIFY,
-                             "true");
+       nb_cli_enqueue_change(vty, "./global/fast-external-failover",
+                             NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3105,7 +3114,8 @@ DEFUN_YANG(bgp_bestpath_compare_router_id,
           "Compare router-id for identical EBGP paths\n")
 {
        nb_cli_enqueue_change(
-               vty, "./route-selection-options/external-compare-router-id",
+               vty,
+               "./global/route-selection-options/external-compare-router-id",
                NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3120,7 +3130,8 @@ DEFUN_YANG(no_bgp_bestpath_compare_router_id,
           "Compare router-id for identical EBGP paths\n")
 {
        nb_cli_enqueue_change(
-               vty, "./route-selection-options/external-compare-router-id",
+               vty,
+               "./global/route-selection-options/external-compare-router-id",
                NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3135,9 +3146,9 @@ DEFUN_YANG(bgp_bestpath_aspath_ignore,
           "AS-path attribute\n"
           "Ignore as-path length in selecting a route\n")
 {
-       nb_cli_enqueue_change(vty,
-                             "./route-selection-options/ignore-as-path-length",
-                             NB_OP_MODIFY, "true");
+       nb_cli_enqueue_change(
+               vty, "./global/route-selection-options/ignore-as-path-length",
+               NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3151,9 +3162,9 @@ DEFUN_YANG(no_bgp_bestpath_aspath_ignore,
           "AS-path attribute\n"
           "Ignore as-path length in selecting a route\n")
 {
-       nb_cli_enqueue_change(vty,
-                             "./route-selection-options/ignore-as-path-length",
-                             NB_OP_MODIFY, "false");
+       nb_cli_enqueue_change(
+               vty, "./global/route-selection-options/ignore-as-path-length",
+               NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3167,7 +3178,8 @@ DEFUN_YANG (bgp_bestpath_aspath_confed,
        "AS-path attribute\n"
        "Compare path lengths including confederation sets & sequences in selecting a route\n")
 {
-       nb_cli_enqueue_change(vty, "./route-selection-options/aspath-confed",
+       nb_cli_enqueue_change(vty,
+                             "./global/route-selection-options/aspath-confed",
                              NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3182,7 +3194,8 @@ DEFUN_YANG (no_bgp_bestpath_aspath_confed,
        "AS-path attribute\n"
        "Compare path lengths including confederation sets & sequences in selecting a route\n")
 {
-       nb_cli_enqueue_change(vty, "./route-selection-options/aspath-confed",
+       nb_cli_enqueue_change(vty,
+                             "./global/route-selection-options/aspath-confed",
                              NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3201,16 +3214,18 @@ DEFUN_YANG (bgp_bestpath_aspath_multipath_relax,
 {
        int idx = 0;
 
-       nb_cli_enqueue_change(vty,
-                             "./route-selection-options/allow-multiple-as",
-                             NB_OP_MODIFY, "true");
+       nb_cli_enqueue_change(
+               vty, "./global/route-selection-options/allow-multiple-as",
+               NB_OP_MODIFY, "true");
        if (argv_find(argv, argc, "as-set", &idx))
                nb_cli_enqueue_change(
-                       vty, "./route-selection-options/multi-path-as-set",
+                       vty,
+                       "./global/route-selection-options/multi-path-as-set",
                        NB_OP_MODIFY, "true");
        else
                nb_cli_enqueue_change(
-                       vty, "./route-selection-options/multi-path-as-set",
+                       vty,
+                       "./global/route-selection-options/multi-path-as-set",
                        NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3227,12 +3242,12 @@ DEFUN_YANG (no_bgp_bestpath_aspath_multipath_relax,
        "Generate an AS_SET\n"
        "Do not generate an AS_SET\n")
 {
-       nb_cli_enqueue_change(vty,
-                             "./route-selection-options/allow-multiple-as",
-                             NB_OP_MODIFY, "false");
-       nb_cli_enqueue_change(vty,
-                             "./route-selection-options/multi-path-as-set",
-                             NB_OP_MODIFY, "false");
+       nb_cli_enqueue_change(
+               vty, "./global/route-selection-options/allow-multiple-as",
+               NB_OP_MODIFY, "false");
+       nb_cli_enqueue_change(
+               vty, "./global/route-selection-options/multi-path-as-set",
+               NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3244,9 +3259,9 @@ DEFUN_YANG(bgp_log_neighbor_changes,
           "BGP specific commands\n"
           "Log neighbor up/down and reset reason\n")
 {
-       nb_cli_enqueue_change(vty,
-                             "./global-neighbor-config/log-neighbor-changes",
-                             NB_OP_MODIFY, "true");
+       nb_cli_enqueue_change(
+               vty, "./global/global-neighbor-config/log-neighbor-changes",
+               NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3258,9 +3273,9 @@ DEFUN_YANG(no_bgp_log_neighbor_changes,
           "BGP specific commands\n"
           "Log neighbor up/down and reset reason\n")
 {
-       nb_cli_enqueue_change(vty,
-                             "./global-neighbor-config/log-neighbor-changes",
-                             NB_OP_MODIFY, "false");
+       nb_cli_enqueue_change(
+               vty, "./global/global-neighbor-config/log-neighbor-changes",
+               NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3285,16 +3300,17 @@ DEFUN_YANG (bgp_bestpath_med,
        if (argv_find(argv, argc, "confed", &idx))
                confed = true;
 
-       nb_cli_enqueue_change(vty, "./route-selection-options/confed-med",
+       nb_cli_enqueue_change(vty,
+                             "./global/route-selection-options/confed-med",
                              NB_OP_MODIFY, confed ? "true" : "false");
 
        idx = 0;
        if (argv_find(argv, argc, "missing-as-worst", &idx))
                worst_med = true;
 
-       nb_cli_enqueue_change(vty,
-                             "./route-selection-options/missing-as-worst-med",
-                             NB_OP_MODIFY, worst_med ? "true" : "false");
+       nb_cli_enqueue_change(
+               vty, "./global/route-selection-options/missing-as-worst-med",
+               NB_OP_MODIFY, worst_med ? "true" : "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3314,14 +3330,15 @@ DEFUN_YANG (no_bgp_bestpath_med,
        int idx = 0;
 
        if (argv_find(argv, argc, "confed", &idx))
-               nb_cli_enqueue_change(vty,
-                                     "./route-selection-options/confed-med",
-                                     NB_OP_MODIFY, "false");
+               nb_cli_enqueue_change(
+                       vty, "./global/route-selection-options/confed-med",
+                       NB_OP_MODIFY, "false");
 
        idx = 0;
        if (argv_find(argv, argc, "missing-as-worst", &idx))
                nb_cli_enqueue_change(
-                       vty, "./route-selection-options/missing-as-worst-med",
+                       vty,
+                       "./global/route-selection-options/missing-as-worst-med",
                        NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3425,7 +3442,8 @@ DEFUN_YANG (bgp_default_show_hostname,
        "Configure BGP defaults\n"
        "Show hostname in certain command outputs\n")
 {
-       nb_cli_enqueue_change(vty, "./show-hostname", NB_OP_MODIFY, "true");
+       nb_cli_enqueue_change(vty, "./global/show-hostname", NB_OP_MODIFY,
+                             "true");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3438,7 +3456,8 @@ DEFUN_YANG(no_bgp_default_show_hostname,
           "Configure BGP defaults\n"
           "Show hostname in certain command outputs\n")
 {
-       nb_cli_enqueue_change(vty, "./show-hostname", NB_OP_MODIFY, "false");
+       nb_cli_enqueue_change(vty, "./global/show-hostname", NB_OP_MODIFY,
+                             "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3458,8 +3477,8 @@ DEFUN (bgp_default_show_nexthop_hostname,
        "Configure BGP defaults\n"
        "Show hostname for nexthop in certain command outputs\n")
 {
-       nb_cli_enqueue_change(vty, "./show-nexthop-hostname", NB_OP_MODIFY,
-                             "true");
+       nb_cli_enqueue_change(vty, "./global/show-nexthop-hostname",
+                             NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3472,8 +3491,8 @@ DEFUN (no_bgp_default_show_nexthop_hostname,
        "Configure BGP defaults\n"
        "Show hostname for nexthop in certain command outputs\n")
 {
-       nb_cli_enqueue_change(vty, "./show-nexthop-hostname", NB_OP_MODIFY,
-                             "false");
+       nb_cli_enqueue_change(vty, "./global/show-nexthop-hostname",
+                             NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3494,7 +3513,8 @@ DEFUN_YANG(bgp_network_import_check,
           "BGP network command\n"
           "Check BGP network route exists in IGP\n")
 {
-       nb_cli_enqueue_change(vty, "./import-check", NB_OP_MODIFY, "true");
+       nb_cli_enqueue_change(vty, "./global/import-check", NB_OP_MODIFY,
+                             "true");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3514,7 +3534,8 @@ DEFUN_YANG(no_bgp_network_import_check,
           "BGP network command\n"
           "Check BGP network route exists in IGP\n")
 {
-       nb_cli_enqueue_change(vty, "./import-check", NB_OP_MODIFY, "false");
+       nb_cli_enqueue_change(vty, "./global/import-check", NB_OP_MODIFY,
+                             "false");
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3536,7 +3557,7 @@ DEFUN_YANG(bgp_default_local_preference,
 {
        int idx_number = 3;
 
-       nb_cli_enqueue_change(vty, "./local-pref", NB_OP_MODIFY,
+       nb_cli_enqueue_change(vty, "./global/local-pref", NB_OP_MODIFY,
                              argv[idx_number]->arg);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3551,7 +3572,7 @@ DEFUN_YANG(no_bgp_default_local_preference,
           "local preference (higher=more preferred)\n"
           "Configure default local preference value\n")
 {
-       nb_cli_enqueue_change(vty, "./local-pref", NB_OP_MODIFY, NULL);
+       nb_cli_enqueue_change(vty, "./global/local-pref", NB_OP_MODIFY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
 }
@@ -3575,7 +3596,8 @@ DEFUN_YANG(bgp_default_subgroup_pkt_queue_max,
        int idx_number = 3;
 
        nb_cli_enqueue_change(
-               vty, "./global-update-group-config/subgroup-pkt-queue-size",
+               vty,
+               "./global/global-update-group-config/subgroup-pkt-queue-size",
                NB_OP_MODIFY, argv[idx_number]->arg);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3591,7 +3613,8 @@ DEFUN_YANG(no_bgp_default_subgroup_pkt_queue_max,
           "Configure subgroup packet queue max\n")
 {
        nb_cli_enqueue_change(
-               vty, "./global-update-group-config/subgroup-pkt-queue-size",
+               vty,
+               "./global/global-update-group-config/subgroup-pkt-queue-size",
                NB_OP_MODIFY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3611,7 +3634,8 @@ DEFUN_YANG(bgp_rr_allow_outbound_policy,
           "Allow modifications made by out route-map\n"
           "on ibgp neighbors\n")
 {
-       nb_cli_enqueue_change(vty, "./route-reflector/allow-outbound-policy",
+       nb_cli_enqueue_change(vty,
+                             "./global/route-reflector/allow-outbound-policy",
                              NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3625,7 +3649,8 @@ DEFUN_YANG(no_bgp_rr_allow_outbound_policy,
           "Allow modifications made by out route-map\n"
           "on ibgp neighbors\n")
 {
-       nb_cli_enqueue_change(vty, "./route-reflector/allow-outbound-policy",
+       nb_cli_enqueue_change(vty,
+                             "./global/route-reflector/allow-outbound-policy",
                              NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3670,7 +3695,7 @@ DEFUN_YANG(bgp_listen_limit,
        int idx_number = 3;
 
        nb_cli_enqueue_change(
-               vty, "./global-neighbor-config/dynamic-neighbors-limit",
+               vty, "./global/global-neighbor-config/dynamic-neighbors-limit",
                NB_OP_MODIFY, argv[idx_number]->arg);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3686,7 +3711,7 @@ DEFUN_YANG(no_bgp_listen_limit,
           "Configure Dynamic Neighbors listen limit value\n")
 {
        nb_cli_enqueue_change(
-               vty, "./global-neighbor-config/dynamic-neighbors-limit",
+               vty, "./global/global-neighbor-config/dynamic-neighbors-limit",
                NB_OP_DESTROY, NULL);
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3877,7 +3902,8 @@ DEFUN_YANG(bgp_disable_connected_route_check,
           "BGP specific commands\n"
           "Disable checking if nexthop is connected on ebgp sessions\n")
 {
-       nb_cli_enqueue_change(vty, "./ebgp-multihop-connected-route-check",
+       nb_cli_enqueue_change(vty,
+                             "./global/ebgp-multihop-connected-route-check",
                              NB_OP_MODIFY, "true");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3890,7 +3916,8 @@ DEFUN_YANG(no_bgp_disable_connected_route_check,
           "BGP specific commands\n"
           "Disable checking if nexthop is connected on ebgp sessions\n")
 {
-       nb_cli_enqueue_change(vty, "./ebgp-multihop-connected-route-check",
+       nb_cli_enqueue_change(vty,
+                             "./global/ebgp-multihop-connected-route-check",
                              NB_OP_MODIFY, "false");
 
        return nb_cli_apply_changes(vty, NULL);
@@ -3974,7 +4001,7 @@ DEFUN_YANG(bgp_default_shutdown,
           "Configure BGP defaults\n"
           "Apply administrative shutdown to newly configured peers\n")
 {
-       nb_cli_enqueue_change(vty, "./default-shutdown", NB_OP_MODIFY,
+       nb_cli_enqueue_change(vty, "./global/default-shutdown", NB_OP_MODIFY,
                              strmatch(argv[0]->text, "no") ? "false" : "true");
 
        return nb_cli_apply_changes(vty, NULL);