]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_vty.c
build, vtysh: extract vtysh commands from .xref
[mirror_frr.git] / bgpd / bgp_vty.c
index 82c9d9667cbe25aebea1767e25009a1a9a12c4fd..9c1159968ab7f0b76058f1fe9fc16e955d5b972f 100644 (file)
@@ -78,6 +78,8 @@
 #ifdef ENABLE_BGP_VNC
 #include "bgpd/rfapi/bgp_rfapi_cfg.h"
 #endif
+#include "bgpd/bgp_orr.h"
+
 
 FRR_CFG_DEFAULT_BOOL(BGP_IMPORT_CHECK,
        {
@@ -295,10 +297,9 @@ static int bgp_srv6_locator_unset(struct bgp *bgp)
 {
        int ret;
        struct listnode *node, *nnode;
-       struct srv6_locator_chunk *chunk;
+       struct srv6_locator_chunk *chunk, *tovpn_sid_locator;
        struct bgp_srv6_function *func;
        struct bgp *bgp_vrf;
-       struct in6_addr *tovpn_sid;
 
        /* release chunk notification via ZAPI */
        ret = bgp_zebra_srv6_manager_release_locator_chunk(
@@ -324,16 +325,15 @@ static int bgp_srv6_locator_unset(struct bgp *bgp)
                        continue;
 
                /* refresh vpnv4 tovpn_sid */
-               tovpn_sid = bgp_vrf->vpn_policy[AFI_IP].tovpn_sid;
-               if (tovpn_sid)
-                       XFREE(MTYPE_BGP_SRV6_SID,
-                             bgp_vrf->vpn_policy[AFI_IP].tovpn_sid);
+               XFREE(MTYPE_BGP_SRV6_SID,
+                     bgp_vrf->vpn_policy[AFI_IP].tovpn_sid);
 
                /* refresh vpnv6 tovpn_sid */
-               tovpn_sid = bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid;
-               if (tovpn_sid)
-                       XFREE(MTYPE_BGP_SRV6_SID,
-                             bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid);
+               XFREE(MTYPE_BGP_SRV6_SID,
+                     bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid);
+
+               /* refresh per-vrf tovpn_sid */
+               XFREE(MTYPE_BGP_SRV6_SID, bgp_vrf->tovpn_sid);
        }
 
        /* update vpn bgp processes */
@@ -345,12 +345,23 @@ static int bgp_srv6_locator_unset(struct bgp *bgp)
                        continue;
 
                /* refresh vpnv4 tovpn_sid_locator */
-               XFREE(MTYPE_BGP_SRV6_SID,
-                     bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator);
+               tovpn_sid_locator =
+                       bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator;
+               if (tovpn_sid_locator) {
+                       srv6_locator_chunk_free(tovpn_sid_locator);
+                       bgp_vrf->vpn_policy[AFI_IP].tovpn_sid_locator = NULL;
+               }
 
                /* refresh vpnv6 tovpn_sid_locator */
-               XFREE(MTYPE_BGP_SRV6_SID,
-                     bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid_locator);
+               tovpn_sid_locator =
+                       bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid_locator;
+               if (tovpn_sid_locator) {
+                       srv6_locator_chunk_free(tovpn_sid_locator);
+                       bgp_vrf->vpn_policy[AFI_IP6].tovpn_sid_locator = NULL;
+               }
+
+               /* refresh per-vrf tovpn_sid_locator */
+               srv6_locator_chunk_free(bgp_vrf->tovpn_sid_locator);
        }
 
        /* clear locator name */
@@ -873,9 +884,6 @@ int bgp_vty_return(struct vty *vty, enum bgp_create_error_code ret)
        case BGP_ERR_REMOVE_PRIVATE_AS:
                str = "remove-private-AS cannot be configured for IBGP peers";
                break;
-       case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
-               str = "Local-AS allowed only for EBGP peers";
-               break;
        case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
                str = "Cannot have local-as same as BGP AS number";
                break;
@@ -936,9 +944,6 @@ int bgp_vty_return(struct vty *vty, enum bgp_create_error_code ret)
        case BGP_ERR_AF_UNCONFIGURED:
                str = "AFI/SAFI specified is not currently configured.";
                break;
-       case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS_REMOTE_AS:
-               str = "AS specified for local as is the same as the remote as and this is not allowed.";
-               break;
        case BGP_ERR_INVALID_AS:
                str = "Confederation AS specified is the same AS as our AS.";
                break;
@@ -948,6 +953,9 @@ int bgp_vty_return(struct vty *vty, enum bgp_create_error_code ret)
        case BGP_ERR_INVALID_INTERNAL_ROLE:
                str = "External roles can be set only on eBGP session";
                break;
+       case BGP_ERR_PEER_ORR_CONFIGURED:
+               str = "Deconfigure optimal-route-reflection on this peer first";
+               break;
        }
        if (str) {
                vty_out(vty, "%% %s\n", str);
@@ -1308,9 +1316,7 @@ void bgp_clear_soft_in(struct bgp *bgp, afi_t afi, safi_t safi)
        bgp_clear(NULL, bgp, afi, safi, clear_all, BGP_CLEAR_SOFT_IN, NULL);
 }
 
-#ifndef VTYSH_EXTRACT_PL
 #include "bgpd/bgp_vty_clippy.c"
-#endif
 
 DEFUN_HIDDEN (bgp_local_mac,
               bgp_local_mac_cmd,
@@ -2354,6 +2360,15 @@ void bgp_config_write_coalesce_time(struct vty *vty, struct bgp *bgp)
                vty_out(vty, " coalesce-time %u\n", bgp->coalesce_time);
 }
 
+/* BGP TCP keepalive */
+static void bgp_config_tcp_keepalive(struct vty *vty, struct bgp *bgp)
+{
+       if (bgp->tcp_keepalive_idle) {
+               vty_out(vty, " bgp tcp-keepalive %u %u %u\n",
+                       bgp->tcp_keepalive_idle, bgp->tcp_keepalive_intvl,
+                       bgp->tcp_keepalive_probes);
+       }
+}
 
 DEFUN (bgp_coalesce_time,
        bgp_coalesce_time_cmd,
@@ -2577,6 +2592,38 @@ DEFUN(no_bgp_minimum_holdtime, no_bgp_minimum_holdtime_cmd,
        return CMD_SUCCESS;
 }
 
+DEFPY(bgp_tcp_keepalive, bgp_tcp_keepalive_cmd,
+      "bgp tcp-keepalive (1-65535)$idle (1-65535)$intvl (1-30)$probes",
+      BGP_STR
+      "TCP keepalive parameters\n"
+      "TCP keepalive idle time (seconds)\n"
+      "TCP keepalive interval (seconds)\n"
+      "TCP keepalive maximum probes\n")
+{
+       VTY_DECLVAR_CONTEXT(bgp, bgp);
+
+       bgp_tcp_keepalive_set(bgp, (uint16_t)idle, (uint16_t)intvl,
+                             (uint16_t)probes);
+
+       return CMD_SUCCESS;
+}
+
+DEFPY(no_bgp_tcp_keepalive, no_bgp_tcp_keepalive_cmd,
+      "no bgp tcp-keepalive [(1-65535) (1-65535) (1-30)]",
+      NO_STR
+      BGP_STR
+      "TCP keepalive parameters\n"
+      "TCP keepalive idle time (seconds)\n"
+      "TCP keepalive interval (seconds)\n"
+      "TCP keepalive maximum probes\n")
+{
+       VTY_DECLVAR_CONTEXT(bgp, bgp);
+
+       bgp_tcp_keepalive_unset(bgp);
+
+       return CMD_SUCCESS;
+}
+
 DEFUN (bgp_client_to_client_reflection,
        bgp_client_to_client_reflection_cmd,
        "bgp client-to-client reflection",
@@ -5773,7 +5820,7 @@ ALIAS_HIDDEN(neighbor_remove_private_as_all,
             "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
             NEIGHBOR_STR NEIGHBOR_ADDR_STR2
             "Remove private ASNs in outbound updates\n"
-            "Apply to all AS numbers")
+            "Apply to all AS numbers\n")
 
 DEFUN (neighbor_remove_private_as_replace_as,
        neighbor_remove_private_as_replace_as_cmd,
@@ -6163,6 +6210,43 @@ ALIAS_HIDDEN(no_neighbor_route_reflector_client,
             NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
             "Configure a neighbor as Route Reflector client\n")
 
+/* optimal-route-reflection Root Routers configuration */
+DEFPY (optimal_route_reflection,
+       optimal_route_reflection_cmd,
+       "[no$no] optimal-route-reflection WORD$orr_group [<A.B.C.D|X:X::X:X>$primary [<A.B.C.D|X:X::X:X>$secondary [<A.B.C.D|X:X::X:X>$tertiary]]]",
+       NO_STR
+       "Create ORR group and assign root router(s)\n"
+       "ORR Group name\n"
+       "Primary Root address\n"
+       "Primary Root IPv6 address\n"
+       "Secondary Root address\n"
+       "Secondary Root IPv6 address\n"
+       "Tertiary Root address\n"
+       "Tertiary Root IPv6 address\n")
+{
+       if (!no && !primary) {
+               vty_out(vty, "%% Specify Primary Root address\n");
+               return CMD_WARNING_CONFIG_FAILED;
+       }
+       return bgp_afi_safi_orr_group_set_vty(
+               vty, bgp_node_afi(vty), bgp_node_safi(vty), orr_group,
+               primary_str, secondary_str, tertiary_str, !!no);
+}
+
+/* neighbor optimal-route-reflection group*/
+DEFPY (neighbor_optimal_route_reflection,
+       neighbor_optimal_route_reflection_cmd,
+       "[no$no] neighbor <A.B.C.D|X:X::X:X|WORD>$neighbor optimal-route-reflection WORD$orr_group",
+       NO_STR
+       NEIGHBOR_STR
+       NEIGHBOR_ADDR_STR2
+       "Apply ORR group configuration to the neighbor\n"
+       "ORR group name\n")
+{
+       return peer_orr_group_set_vty(vty, neighbor, bgp_node_afi(vty),
+                                     bgp_node_safi(vty), orr_group, !!no);
+}
+
 /* neighbor route-server-client. */
 DEFUN (neighbor_route_server_client,
        neighbor_route_server_client_cmd,
@@ -8247,6 +8331,32 @@ ALIAS_HIDDEN(
        "Only give warning message when limit is exceeded\n"
        "Force checking all received routes not only accepted\n")
 
+/* "neighbor accept-own" */
+DEFPY (neighbor_accept_own,
+       neighbor_accept_own_cmd,
+       "[no$no] neighbor <A.B.C.D|X:X::X:X|WORD>$neighbor accept-own",
+       NO_STR
+       NEIGHBOR_STR
+       NEIGHBOR_ADDR_STR2
+       "Enable handling of self-originated VPN routes containing ACCEPT_OWN community\n")
+{
+       struct peer *peer;
+       afi_t afi = bgp_node_afi(vty);
+       safi_t safi = bgp_node_safi(vty);
+       int ret;
+
+       peer = peer_and_group_lookup_vty(vty, neighbor);
+       if (!peer)
+               return CMD_WARNING_CONFIG_FAILED;
+
+       if (no)
+               ret = peer_af_flag_unset(peer, afi, safi, PEER_FLAG_ACCEPT_OWN);
+       else
+               ret = peer_af_flag_set(peer, afi, safi, PEER_FLAG_ACCEPT_OWN);
+
+       return bgp_vty_return(vty, ret);
+}
+
 /* "neighbor soo" */
 DEFPY (neighbor_soo,
        neighbor_soo_cmd,
@@ -8860,7 +8970,7 @@ DEFPY (af_label_vpn_export,
 
 DEFPY (af_sid_vpn_export,
        af_sid_vpn_export_cmd,
-       "[no] sid vpn export <(1-255)$sid_idx|auto$sid_auto>",
+       "[no] sid vpn export <(1-1048575)$sid_idx|auto$sid_auto>",
        NO_STR
        "sid value for VRF\n"
        "Between current address-family and vpn\n"
@@ -8889,6 +8999,14 @@ DEFPY (af_sid_vpn_export,
                return CMD_WARNING_CONFIG_FAILED;
        }
 
+       if (bgp->tovpn_sid_index != 0 ||
+           CHECK_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO)) {
+               vty_out(vty,
+                       "per-vrf sid and per-af sid are mutually exclusive\n"
+                       "Failed: per-vrf sid is configured. Remove per-vrf sid before configuring per-af sid\n");
+               return CMD_WARNING_CONFIG_FAILED;
+       }
+
        /* skip when it's already configured */
        if ((sid_idx != 0 && bgp->vpn_policy[afi].tovpn_sid_index != 0)
            || (sid_auto && CHECK_FLAG(bgp->vpn_policy[afi].flags,
@@ -8930,6 +9048,92 @@ DEFPY (af_sid_vpn_export,
        return CMD_SUCCESS;
 }
 
+DEFPY (bgp_sid_vpn_export,
+       bgp_sid_vpn_export_cmd,
+       "[no] sid vpn per-vrf export <(1-255)$sid_idx|auto$sid_auto>",
+       NO_STR
+       "sid value for VRF\n"
+       "Between current vrf and vpn\n"
+       "sid per-VRF (both IPv4 and IPv6 address families)\n"
+       "For routes leaked from current vrf to vpn\n"
+       "Sid allocation index\n"
+       "Automatically assign a label\n")
+{
+       VTY_DECLVAR_CONTEXT(bgp, bgp);
+       int debug;
+
+       debug = (BGP_DEBUG(vpn, VPN_LEAK_TO_VRF) |
+                BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF));
+
+       if (no) {
+               /* when per-VRF SID is not set, do nothing */
+               if (bgp->tovpn_sid_index == 0 &&
+                   !CHECK_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO))
+                       return CMD_SUCCESS;
+
+               sid_idx = 0;
+               sid_auto = false;
+               bgp->tovpn_sid_index = 0;
+               UNSET_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO);
+       }
+
+       if (bgp->vpn_policy[AFI_IP].tovpn_sid_index != 0 ||
+           CHECK_FLAG(bgp->vpn_policy[AFI_IP].flags,
+                      BGP_VPN_POLICY_TOVPN_SID_AUTO) ||
+           bgp->vpn_policy[AFI_IP6].tovpn_sid_index != 0 ||
+           CHECK_FLAG(bgp->vpn_policy[AFI_IP6].flags,
+                      BGP_VPN_POLICY_TOVPN_SID_AUTO)) {
+               vty_out(vty,
+                       "per-vrf sid and per-af sid are mutually exclusive\n"
+                       "Failed: per-af sid is configured. Remove per-af sid before configuring per-vrf sid\n");
+               return CMD_WARNING_CONFIG_FAILED;
+       }
+
+       /* skip when it's already configured */
+       if ((sid_idx != 0 && bgp->tovpn_sid_index != 0) ||
+           (sid_auto && CHECK_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO)))
+               return CMD_SUCCESS;
+
+       /*
+        * mode change between sid_idx and sid_auto isn't supported.
+        * user must negate sid vpn export when they want to change the mode
+        */
+       if ((sid_auto && bgp->tovpn_sid_index != 0) ||
+           (sid_idx != 0 &&
+            CHECK_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO))) {
+               vty_out(vty, "it's already configured as %s.\n",
+                       sid_auto ? "auto-mode" : "idx-mode");
+               return CMD_WARNING_CONFIG_FAILED;
+       }
+
+       /* pre-change */
+       vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP, bgp_get_default(),
+                          bgp);
+       vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP6, bgp_get_default(),
+                          bgp);
+
+       if (sid_auto) {
+               /* SID allocation auto-mode */
+               if (debug)
+                       zlog_debug("%s: auto per-vrf sid alloc.", __func__);
+               SET_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO);
+       } else if (sid_idx != 0) {
+               /* SID allocation index-mode */
+               if (debug)
+                       zlog_debug("%s: idx %ld per-vrf sid alloc.", __func__,
+                                  sid_idx);
+               bgp->tovpn_sid_index = sid_idx;
+       }
+
+       /* post-change */
+       vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP, bgp_get_default(),
+                           bgp);
+       vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN, AFI_IP6,
+                           bgp_get_default(), bgp);
+
+       return CMD_SUCCESS;
+}
+
 ALIAS (af_label_vpn_export,
        af_no_label_vpn_export_cmd,
        "no label vpn export",
@@ -8938,6 +9142,15 @@ ALIAS (af_label_vpn_export,
        "Between current address-family and vpn\n"
        "For routes leaked from current address-family to vpn\n")
 
+ALIAS (bgp_sid_vpn_export,
+       no_bgp_sid_vpn_export_cmd,
+       "no$no sid vpn per-vrf export",
+       NO_STR
+       "sid value for VRF\n"
+       "Between current vrf and vpn\n"
+       "sid per-VRF (both IPv4 and IPv6 address families)\n"
+       "For routes leaked from current vrf to vpn\n")
+
 DEFPY (af_nexthop_vpn_export,
        af_nexthop_vpn_export_cmd,
        "[no] nexthop vpn export [<A.B.C.D|X:X::X:X>$nexthop_su]",
@@ -9637,11 +9850,7 @@ DEFPY (show_bgp_srv6,
        struct listnode *node;
        struct srv6_locator_chunk *chunk;
        struct bgp_srv6_function *func;
-       struct in6_addr *tovpn4_sid;
-       struct in6_addr *tovpn6_sid;
        char buf[256];
-       char buf_tovpn4_sid[256];
-       char buf_tovpn6_sid[256];
 
        bgp = bgp_get_default();
        if (!bgp)
@@ -9649,8 +9858,14 @@ DEFPY (show_bgp_srv6,
 
        vty_out(vty, "locator_name: %s\n", bgp->srv6_locator_name);
        vty_out(vty, "locator_chunks:\n");
-       for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, chunk))
+       for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, chunk)) {
                vty_out(vty, "- %pFX\n", &chunk->prefix);
+               vty_out(vty, "  block-length: %d\n", chunk->block_bits_length);
+               vty_out(vty, "  node-length: %d\n", chunk->node_bits_length);
+               vty_out(vty, "  func-length: %d\n",
+                       chunk->function_bits_length);
+               vty_out(vty, "  arg-length: %d\n", chunk->argument_bits_length);
+       }
 
        vty_out(vty, "functions:\n");
        for (ALL_LIST_ELEMENTS_RO(bgp->srv6_functions, node, func)) {
@@ -9664,19 +9879,11 @@ DEFPY (show_bgp_srv6,
                vty_out(vty, "- name: %s\n",
                        bgp->name ? bgp->name : "default");
 
-               tovpn4_sid = bgp->vpn_policy[AFI_IP].tovpn_sid;
-               tovpn6_sid = bgp->vpn_policy[AFI_IP6].tovpn_sid;
-               if (tovpn4_sid)
-                       inet_ntop(AF_INET6, tovpn4_sid, buf_tovpn4_sid,
-                                 sizeof(buf_tovpn4_sid));
-               if (tovpn6_sid)
-                       inet_ntop(AF_INET6, tovpn6_sid, buf_tovpn6_sid,
-                                 sizeof(buf_tovpn6_sid));
-
-               vty_out(vty, "  vpn_policy[AFI_IP].tovpn_sid: %s\n",
-                       tovpn4_sid ? buf_tovpn4_sid : "none");
-               vty_out(vty, "  vpn_policy[AFI_IP6].tovpn_sid: %s\n",
-                       tovpn6_sid ? buf_tovpn6_sid : "none");
+               vty_out(vty, "  vpn_policy[AFI_IP].tovpn_sid: %pI6\n",
+                       bgp->vpn_policy[AFI_IP].tovpn_sid);
+               vty_out(vty, "  vpn_policy[AFI_IP6].tovpn_sid: %pI6\n",
+                       bgp->vpn_policy[AFI_IP6].tovpn_sid);
+               vty_out(vty, "  per-vrf tovpn_sid: %pI6\n", bgp->tovpn_sid);
        }
 
        return CMD_SUCCESS;
@@ -12363,6 +12570,11 @@ static void bgp_show_peer_afi(struct vty *vty, struct peer *p, afi_t afi,
                if (CHECK_FLAG(p->af_flags[afi][safi],
                               PEER_FLAG_RSERVER_CLIENT))
                        vty_out(vty, "  Route-Server Client\n");
+
+               if (peer_af_flag_check(p, afi, safi, PEER_FLAG_ORR_GROUP))
+                       vty_out(vty, "  ORR group (configured) : %s\n",
+                               p->orr_group_name[afi][safi]);
+
                if (CHECK_FLAG(p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
                        vty_out(vty,
                                "  Inbound soft reconfiguration allowed\n");
@@ -14735,7 +14947,7 @@ static int bgp_show_neighbor_vty(struct vty *vty, const char *name,
 
 
 /* "show [ip] bgp neighbors graceful-restart" commands.  */
-DEFUN (show_ip_bgp_neighbors_gracrful_restart,
+DEFUN (show_ip_bgp_neighbors_graceful_restart,
        show_ip_bgp_neighbors_graceful_restart_cmd,
        "show bgp [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] graceful-restart [json]",
        SHOW_STR
@@ -17290,6 +17502,10 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
                }
        }
 
+       /* accept-own */
+       if (peergroup_af_flag_check(peer, afi, safi, PEER_FLAG_ACCEPT_OWN))
+               vty_out(vty, "  neighbor %s accept-own\n", addr);
+
        /* soo */
        if (peergroup_af_flag_check(peer, afi, safi, PEER_FLAG_SOO)) {
                char *soo_str = ecommunity_ecom2str(
@@ -17339,6 +17555,10 @@ static void bgp_config_write_peer_af(struct vty *vty, struct bgp *bgp,
                                        : "");
                }
        }
+
+       if (peer_af_flag_check(peer, afi, safi, PEER_FLAG_ORR_GROUP))
+               vty_out(vty, "  neighbor %s optimal-route-reflection %s\n",
+                       addr, peer->orr_group_name[afi][safi]);
 }
 
 static void bgp_vpn_config_write(struct vty *vty, struct bgp *bgp, afi_t afi,
@@ -17445,6 +17665,9 @@ static void bgp_config_write_family(struct vty *vty, struct bgp *bgp, afi_t afi,
                }
        }
 
+       /* Optimal Route Reflection */
+       bgp_config_write_orr(vty, bgp, afi, safi);
+
        vty_endframe(vty, " exit-address-family\n");
 }
 
@@ -17457,6 +17680,7 @@ int bgp_config_write(struct vty *vty)
        struct listnode *mnode, *mnnode;
        afi_t afi;
        safi_t safi;
+       uint32_t tovpn_sid_index = 0;
 
        if (bm->rmap_update_timer != RMAP_DEFAULT_UPDATE_TIMER)
                vty_out(vty, "bgp route-map delay-timer %u\n",
@@ -17717,6 +17941,9 @@ int bgp_config_write(struct vty *vty)
                        vty_out(vty,
                                " bgp graceful-restart preserve-fw-state\n");
 
+               /* BGP TCP keepalive */
+               bgp_config_tcp_keepalive(vty, bgp);
+
                /* Stale timer for RIB */
                if (bgp->rib_stale_time != BGP_DEFAULT_RIB_STALE_TIME)
                        vty_out(vty,
@@ -17838,6 +18065,13 @@ int bgp_config_write(struct vty *vty)
                        vty_endframe(vty, " exit\n");
                }
 
+               tovpn_sid_index = bgp->tovpn_sid_index;
+               if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_TOVPN_SID_AUTO)) {
+                       vty_out(vty, " sid vpn per-vrf export auto\n");
+               } else if (tovpn_sid_index != 0) {
+                       vty_out(vty, " sid vpn per-vrf export %d\n",
+                               tovpn_sid_index);
+               }
 
                /* IPv4 unicast configuration.  */
                bgp_config_write_family(vty, bgp, AFI_IP, SAFI_UNICAST);
@@ -18951,6 +19185,34 @@ void bgp_vty_init(void)
        install_element(BGP_EVPN_NODE, &neighbor_route_reflector_client_cmd);
        install_element(BGP_EVPN_NODE, &no_neighbor_route_reflector_client_cmd);
 
+       /* "optimal-route-reflection" commands */
+       install_element(BGP_IPV4_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_IPV4M_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_IPV4L_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_IPV6_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_IPV6M_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_IPV6L_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_VPNV4_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_VPNV6_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_FLOWSPECV4_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_FLOWSPECV6_NODE, &optimal_route_reflection_cmd);
+       install_element(BGP_EVPN_NODE, &optimal_route_reflection_cmd);
+
+       /* "neighbor optimal-route-reflection" commands */
+       install_element(BGP_IPV4_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_IPV4M_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_IPV4L_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_IPV6_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_IPV6M_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_IPV6L_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_VPNV4_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_VPNV6_NODE, &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_FLOWSPECV4_NODE,
+                       &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_FLOWSPECV6_NODE,
+                       &neighbor_optimal_route_reflection_cmd);
+       install_element(BGP_EVPN_NODE, &neighbor_optimal_route_reflection_cmd);
+
        /* "neighbor route-server" commands.*/
        install_element(BGP_NODE, &neighbor_route_server_client_hidden_cmd);
        install_element(BGP_NODE, &no_neighbor_route_server_client_hidden_cmd);
@@ -19461,6 +19723,10 @@ void bgp_vty_init(void)
        install_element(BGP_EVPN_NODE, &neighbor_allowas_in_cmd);
        install_element(BGP_EVPN_NODE, &no_neighbor_allowas_in_cmd);
 
+       /* neighbor accept-own */
+       install_element(BGP_VPNV4_NODE, &neighbor_accept_own_cmd);
+       install_element(BGP_VPNV6_NODE, &neighbor_accept_own_cmd);
+
        /* "neighbor soo" */
        install_element(BGP_IPV4_NODE, &neighbor_soo_cmd);
        install_element(BGP_IPV4_NODE, &no_neighbor_soo_cmd);
@@ -19596,6 +19862,10 @@ void bgp_vty_init(void)
        install_element(BGP_NODE, &neighbor_ttl_security_cmd);
        install_element(BGP_NODE, &no_neighbor_ttl_security_cmd);
 
+       /* "bgp tcp-keepalive" commands */
+       install_element(BGP_NODE, &bgp_tcp_keepalive_cmd);
+       install_element(BGP_NODE, &no_bgp_tcp_keepalive_cmd);
+
        /* "show [ip] bgp memory" commands. */
        install_element(VIEW_NODE, &show_bgp_memory_cmd);
 
@@ -19655,6 +19925,8 @@ void bgp_vty_init(void)
        install_element(BGP_SRV6_NODE, &no_bgp_srv6_locator_cmd);
        install_element(BGP_IPV4_NODE, &af_sid_vpn_export_cmd);
        install_element(BGP_IPV6_NODE, &af_sid_vpn_export_cmd);
+       install_element(BGP_NODE, &bgp_sid_vpn_export_cmd);
+       install_element(BGP_NODE, &no_bgp_sid_vpn_export_cmd);
 
        bgp_vty_if_init();
 }