mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 12:49:18 +00:00
Merge pull request #6904 from chiragshah6/yang_nb6
lib, bgpd: Convert global configurations to transactional cli
This commit is contained in:
commit
002bac8b5b
@ -60,6 +60,8 @@
|
|||||||
#include "bgpd/bgp_keepalives.h"
|
#include "bgpd/bgp_keepalives.h"
|
||||||
#include "bgpd/bgp_network.h"
|
#include "bgpd/bgp_network.h"
|
||||||
#include "bgpd/bgp_errors.h"
|
#include "bgpd/bgp_errors.h"
|
||||||
|
#include "lib/routing_nb.h"
|
||||||
|
#include "bgpd/bgp_nb.h"
|
||||||
|
|
||||||
#ifdef ENABLE_BGP_VNC
|
#ifdef ENABLE_BGP_VNC
|
||||||
#include "bgpd/rfapi/rfapi_backend.h"
|
#include "bgpd/rfapi/rfapi_backend.h"
|
||||||
@ -370,9 +372,11 @@ static void bgp_vrf_terminate(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct frr_yang_module_info *const bgpd_yang_modules[] = {
|
static const struct frr_yang_module_info *const bgpd_yang_modules[] = {
|
||||||
|
&frr_bgp_info,
|
||||||
&frr_filter_info,
|
&frr_filter_info,
|
||||||
&frr_interface_info,
|
&frr_interface_info,
|
||||||
&frr_route_map_info,
|
&frr_route_map_info,
|
||||||
|
&frr_routing_info,
|
||||||
&frr_vrf_info,
|
&frr_vrf_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -497,6 +501,10 @@ int main(int argc, char **argv)
|
|||||||
/* Initializations. */
|
/* Initializations. */
|
||||||
bgp_vrf_init();
|
bgp_vrf_init();
|
||||||
|
|
||||||
|
hook_register(routing_conf_event,
|
||||||
|
routing_control_plane_protocols_name_validate);
|
||||||
|
|
||||||
|
|
||||||
/* BGP related initialization. */
|
/* BGP related initialization. */
|
||||||
bgp_init((unsigned short)instance);
|
bgp_init((unsigned short)instance);
|
||||||
|
|
||||||
|
@ -2581,7 +2581,7 @@ void vpn_leak_postchange_all(void)
|
|||||||
* also VRF Y should unimport its routes from VRF X table.
|
* also VRF Y should unimport its routes from VRF X table.
|
||||||
* This will ensure VPN table is cleaned up appropriately.
|
* This will ensure VPN table is cleaned up appropriately.
|
||||||
*/
|
*/
|
||||||
int bgp_vpn_leak_unimport(struct bgp *from_bgp, struct vty *vty)
|
void bgp_vpn_leak_unimport(struct bgp *from_bgp)
|
||||||
{
|
{
|
||||||
struct bgp *to_bgp;
|
struct bgp *to_bgp;
|
||||||
const char *tmp_name;
|
const char *tmp_name;
|
||||||
@ -2593,7 +2593,7 @@ int bgp_vpn_leak_unimport(struct bgp *from_bgp, struct vty *vty)
|
|||||||
int debug;
|
int debug;
|
||||||
|
|
||||||
if (from_bgp->inst_type != BGP_INSTANCE_TYPE_VRF)
|
if (from_bgp->inst_type != BGP_INSTANCE_TYPE_VRF)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
debug = (BGP_DEBUG(vpn, VPN_LEAK_TO_VRF) |
|
debug = (BGP_DEBUG(vpn, VPN_LEAK_TO_VRF) |
|
||||||
BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF));
|
BGP_DEBUG(vpn, VPN_LEAK_FROM_VRF));
|
||||||
@ -2662,7 +2662,7 @@ int bgp_vpn_leak_unimport(struct bgp *from_bgp, struct vty *vty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When a router bgp is configured, there could be a bgp vrf
|
/* When a router bgp is configured, there could be a bgp vrf
|
||||||
|
@ -266,7 +266,7 @@ extern vrf_id_t get_first_vrf_for_redirect_with_rt(struct ecommunity *eckey);
|
|||||||
extern void vpn_leak_postchange_all(void);
|
extern void vpn_leak_postchange_all(void);
|
||||||
extern void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw,
|
extern void vpn_handle_router_id_update(struct bgp *bgp, bool withdraw,
|
||||||
bool is_config);
|
bool is_config);
|
||||||
extern int bgp_vpn_leak_unimport(struct bgp *from_bgp, struct vty *vty);
|
extern void bgp_vpn_leak_unimport(struct bgp *from_bgp);
|
||||||
extern void bgp_vpn_leak_export(struct bgp *from_bgp);
|
extern void bgp_vpn_leak_export(struct bgp *from_bgp);
|
||||||
|
|
||||||
#endif /* _QUAGGA_BGP_MPLSVPN_H */
|
#endif /* _QUAGGA_BGP_MPLSVPN_H */
|
||||||
|
7524
bgpd/bgp_nb.c
Normal file
7524
bgpd/bgp_nb.c
Normal file
File diff suppressed because it is too large
Load Diff
3441
bgpd/bgp_nb.h
Normal file
3441
bgpd/bgp_nb.h
Normal file
File diff suppressed because it is too large
Load Diff
30489
bgpd/bgp_nb_config.c
Normal file
30489
bgpd/bgp_nb_config.c
Normal file
File diff suppressed because it is too large
Load Diff
1300
bgpd/bgp_vty.c
1300
bgpd/bgp_vty.c
File diff suppressed because it is too large
Load Diff
@ -180,5 +180,12 @@ int bgp_vty_find_and_parse_bgp(struct vty *vty, struct cmd_token **argv,
|
|||||||
extern int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
|
extern int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi,
|
||||||
safi_t safi, bool show_failed,
|
safi_t safi, bool show_failed,
|
||||||
bool show_established, bool use_json);
|
bool show_established, bool use_json);
|
||||||
|
extern int bgp_clear_star_soft_in(const char *name, char *errmsg,
|
||||||
|
size_t errmsg_len);
|
||||||
|
extern int bgp_clear_star_soft_out(const char *name, char *errmsg,
|
||||||
|
size_t errmsg_len);
|
||||||
|
int bgp_wpkt_quanta_config_vty(struct bgp *bgp, uint32_t quanta, bool set);
|
||||||
|
int bgp_rpkt_quanta_config_vty(struct bgp *bgp, uint32_t quanta, bool set);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _QUAGGA_BGP_VTY_H */
|
#endif /* _QUAGGA_BGP_VTY_H */
|
||||||
|
10
bgpd/bgpd.c
10
bgpd/bgpd.c
@ -397,10 +397,6 @@ int bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id)
|
|||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
|
|
||||||
if (bgp_config_check(bgp, BGP_CONFIG_CLUSTER_ID)
|
|
||||||
&& IPV4_ADDR_SAME(&bgp->cluster_id, cluster_id))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
IPV4_ADDR_COPY(&bgp->cluster_id, cluster_id);
|
IPV4_ADDR_COPY(&bgp->cluster_id, cluster_id);
|
||||||
bgp_config_set(bgp, BGP_CONFIG_CLUSTER_ID);
|
bgp_config_set(bgp, BGP_CONFIG_CLUSTER_ID);
|
||||||
|
|
||||||
@ -473,14 +469,14 @@ void bgp_timers_unset(struct bgp *bgp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* BGP confederation configuration. */
|
/* BGP confederation configuration. */
|
||||||
int bgp_confederation_id_set(struct bgp *bgp, as_t as)
|
void bgp_confederation_id_set(struct bgp *bgp, as_t as)
|
||||||
{
|
{
|
||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
struct listnode *node, *nnode;
|
struct listnode *node, *nnode;
|
||||||
int already_confed;
|
int already_confed;
|
||||||
|
|
||||||
if (as == 0)
|
if (as == 0)
|
||||||
return BGP_ERR_INVALID_AS;
|
return;
|
||||||
|
|
||||||
/* Remember - were we doing confederation before? */
|
/* Remember - were we doing confederation before? */
|
||||||
already_confed = bgp_config_check(bgp, BGP_CONFIG_CONFEDERATION);
|
already_confed = bgp_config_check(bgp, BGP_CONFIG_CONFEDERATION);
|
||||||
@ -528,7 +524,7 @@ int bgp_confederation_id_set(struct bgp *bgp, as_t as)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bgp_confederation_id_unset(struct bgp *bgp)
|
int bgp_confederation_id_unset(struct bgp *bgp)
|
||||||
|
@ -391,8 +391,9 @@ struct bgp {
|
|||||||
*t_maxmed_onstartup; /* non-null when max-med onstartup is on */
|
*t_maxmed_onstartup; /* non-null when max-med onstartup is on */
|
||||||
uint8_t maxmed_onstartup_over; /* Flag to make it effective only once */
|
uint8_t maxmed_onstartup_over; /* Flag to make it effective only once */
|
||||||
|
|
||||||
uint8_t v_maxmed_admin; /* 1/0 if max-med administrative is on/off */
|
bool v_maxmed_admin; /* true/false if max-med administrative is on/off
|
||||||
#define BGP_MAXMED_ADMIN_UNCONFIGURED 0 /* Off by default */
|
*/
|
||||||
|
#define BGP_MAXMED_ADMIN_UNCONFIGURED false /* Off by default */
|
||||||
uint32_t maxmed_admin_value; /* Max-med value when administrative in on
|
uint32_t maxmed_admin_value; /* Max-med value when administrative in on
|
||||||
*/
|
*/
|
||||||
#define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */
|
#define BGP_MAXMED_VALUE_DEFAULT 4294967294 /* Maximum by default */
|
||||||
@ -1827,7 +1828,7 @@ extern void bgp_router_id_static_set(struct bgp *, struct in_addr);
|
|||||||
extern int bgp_cluster_id_set(struct bgp *, struct in_addr *);
|
extern int bgp_cluster_id_set(struct bgp *, struct in_addr *);
|
||||||
extern int bgp_cluster_id_unset(struct bgp *);
|
extern int bgp_cluster_id_unset(struct bgp *);
|
||||||
|
|
||||||
extern int bgp_confederation_id_set(struct bgp *, as_t);
|
extern void bgp_confederation_id_set(struct bgp *, as_t);
|
||||||
extern int bgp_confederation_id_unset(struct bgp *);
|
extern int bgp_confederation_id_unset(struct bgp *);
|
||||||
extern bool bgp_confederation_peers_check(struct bgp *, as_t);
|
extern bool bgp_confederation_peers_check(struct bgp *, as_t);
|
||||||
|
|
||||||
|
@ -102,6 +102,8 @@ bgpd_libbgp_a_SOURCES = \
|
|||||||
bgpd/bgp_vty.c \
|
bgpd/bgp_vty.c \
|
||||||
bgpd/bgp_zebra.c \
|
bgpd/bgp_zebra.c \
|
||||||
bgpd/bgpd.c \
|
bgpd/bgpd.c \
|
||||||
|
bgpd/bgp_nb.c \
|
||||||
|
bgpd/bgp_nb_config.c \
|
||||||
# end
|
# end
|
||||||
|
|
||||||
if ENABLE_BGP_VNC
|
if ENABLE_BGP_VNC
|
||||||
@ -175,6 +177,7 @@ noinst_HEADERS += \
|
|||||||
bgpd/bgp_vty.h \
|
bgpd/bgp_vty.h \
|
||||||
bgpd/bgp_zebra.h \
|
bgpd/bgp_zebra.h \
|
||||||
bgpd/bgpd.h \
|
bgpd/bgpd.h \
|
||||||
|
bgpd/bgp_nb.h \
|
||||||
\
|
\
|
||||||
bgpd/rfapi/bgp_rfapi_cfg.h \
|
bgpd/rfapi/bgp_rfapi_cfg.h \
|
||||||
bgpd/rfapi/rfapi_import.h \
|
bgpd/rfapi/rfapi_import.h \
|
||||||
@ -231,3 +234,16 @@ clippy_scan += \
|
|||||||
bgpd/bgp_rpki.c \
|
bgpd/bgp_rpki.c \
|
||||||
bgpd/bgp_vty.c \
|
bgpd/bgp_vty.c \
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
nodist_bgpd_bgpd_SOURCES = \
|
||||||
|
yang/frr-bgp-types.yang.c \
|
||||||
|
yang/frr-bgp.yang.c \
|
||||||
|
yang/frr-bgp-common-structure.yang.c \
|
||||||
|
yang/frr-bgp-common.yang.c \
|
||||||
|
yang/frr-bgp-common-multiprotocol.yang.c \
|
||||||
|
yang/frr-bgp-neighbor.yang.c \
|
||||||
|
yang/frr-bgp-peer-group.yang.c \
|
||||||
|
yang/frr-bgp-bmp.yang.c \
|
||||||
|
yang/frr-bgp-rpki.yang.c \
|
||||||
|
yang/frr-deviations-bgp-datacenter.yang.c \
|
||||||
|
# end
|
||||||
|
@ -546,7 +546,7 @@ struct nb_node {
|
|||||||
* from working properly on shared libraries. For those compilers, use a fixed
|
* from working properly on shared libraries. For those compilers, use a fixed
|
||||||
* size array to work around the problem.
|
* size array to work around the problem.
|
||||||
*/
|
*/
|
||||||
#define YANG_MODULE_MAX_NODES 1024
|
#define YANG_MODULE_MAX_NODES 1400
|
||||||
|
|
||||||
struct frr_yang_module_info {
|
struct frr_yang_module_info {
|
||||||
/* YANG module name. */
|
/* YANG module name. */
|
||||||
|
@ -123,6 +123,7 @@ nodist_lib_libfrr_la_SOURCES = \
|
|||||||
yang/frr-nexthop.yang.c \
|
yang/frr-nexthop.yang.c \
|
||||||
yang/ietf/ietf-routing-types.yang.c \
|
yang/ietf/ietf-routing-types.yang.c \
|
||||||
yang/ietf/ietf-interfaces.yang.c \
|
yang/ietf/ietf-interfaces.yang.c \
|
||||||
|
yang/ietf/ietf-bgp-types.yang.c \
|
||||||
yang/frr-module-translator.yang.c \
|
yang/frr-module-translator.yang.c \
|
||||||
yang/frr-nexthop.yang.c \
|
yang/frr-nexthop.yang.c \
|
||||||
# end
|
# end
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include "bgpd/bgp_vty.h"
|
#include "bgpd/bgp_vty.h"
|
||||||
#include "bgpd/bgp_zebra.h"
|
#include "bgpd/bgp_zebra.h"
|
||||||
#include "bgpd/bgp_network.h"
|
#include "bgpd/bgp_network.h"
|
||||||
|
#include "lib/routing_nb.h"
|
||||||
|
#include "bgpd/bgp_nb.h"
|
||||||
|
|
||||||
#ifdef ENABLE_BGP_VNC
|
#ifdef ENABLE_BGP_VNC
|
||||||
#include "bgpd/rfapi/rfapi_backend.h"
|
#include "bgpd/rfapi/rfapi_backend.h"
|
||||||
@ -932,7 +934,7 @@ static struct test *test_new(const char *desc, bool use_ibgp,
|
|||||||
|
|
||||||
test->vty = vty_new();
|
test->vty = vty_new();
|
||||||
test->vty->type = VTY_TERM;
|
test->vty->type = VTY_TERM;
|
||||||
test->vty->node = CONFIG_NODE;
|
vty_config_enter(test->vty, true, false);
|
||||||
|
|
||||||
test_initialize(test);
|
test_initialize(test);
|
||||||
|
|
||||||
@ -1378,6 +1380,15 @@ static void test_peer_attr(struct test *test, struct test_peer_attr *pa)
|
|||||||
test_process(test, pa, p, g->conf, true, false);
|
test_process(test, pa, p, g->conf, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct frr_yang_module_info *const bgpd_yang_modules[] = {
|
||||||
|
&frr_bgp_info,
|
||||||
|
&frr_filter_info,
|
||||||
|
&frr_interface_info,
|
||||||
|
&frr_route_map_info,
|
||||||
|
&frr_routing_info,
|
||||||
|
&frr_vrf_info,
|
||||||
|
};
|
||||||
|
|
||||||
static void bgp_startup(void)
|
static void bgp_startup(void)
|
||||||
{
|
{
|
||||||
cmd_init(1);
|
cmd_init(1);
|
||||||
@ -1387,7 +1398,7 @@ static void bgp_startup(void)
|
|||||||
|
|
||||||
master = thread_master_create(NULL);
|
master = thread_master_create(NULL);
|
||||||
yang_init(true);
|
yang_init(true);
|
||||||
nb_init(master, NULL, 0, false);
|
nb_init(master, bgpd_yang_modules, array_size(bgpd_yang_modules), false);
|
||||||
bgp_master_init(master, BGP_SOCKET_SNDBUF_SIZE);
|
bgp_master_init(master, BGP_SOCKET_SNDBUF_SIZE);
|
||||||
bgp_option_set(BGP_OPT_NO_LISTEN);
|
bgp_option_set(BGP_OPT_NO_LISTEN);
|
||||||
vrf_init(NULL, NULL, NULL, NULL, NULL);
|
vrf_init(NULL, NULL, NULL, NULL, NULL);
|
||||||
|
@ -168,6 +168,19 @@ tests_bgpd_test_peer_attr_CFLAGS = $(TESTS_CFLAGS)
|
|||||||
tests_bgpd_test_peer_attr_CPPFLAGS = $(TESTS_CPPFLAGS)
|
tests_bgpd_test_peer_attr_CPPFLAGS = $(TESTS_CPPFLAGS)
|
||||||
tests_bgpd_test_peer_attr_LDADD = $(BGP_TEST_LDADD)
|
tests_bgpd_test_peer_attr_LDADD = $(BGP_TEST_LDADD)
|
||||||
tests_bgpd_test_peer_attr_SOURCES = tests/bgpd/test_peer_attr.c
|
tests_bgpd_test_peer_attr_SOURCES = tests/bgpd/test_peer_attr.c
|
||||||
|
nodist_tests_bgpd_test_peer_attr_SOURCES = \
|
||||||
|
yang/frr-bgp-types.yang.c \
|
||||||
|
yang/frr-bgp.yang.c \
|
||||||
|
yang/frr-bgp-common-structure.yang.c \
|
||||||
|
yang/frr-bgp-common.yang.c \
|
||||||
|
yang/frr-bgp-common-multiprotocol.yang.c \
|
||||||
|
yang/frr-bgp-neighbor.yang.c \
|
||||||
|
yang/frr-bgp-peer-group.yang.c \
|
||||||
|
yang/frr-bgp-bmp.yang.c \
|
||||||
|
yang/frr-bgp-rpki.yang.c \
|
||||||
|
yang/frr-deviations-bgp-datacenter.yang.c \
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
tests_isisd_test_fuzz_isis_tlv_CFLAGS = $(TESTS_CFLAGS) -I$(top_builddir)/tests/isisd
|
tests_isisd_test_fuzz_isis_tlv_CFLAGS = $(TESTS_CFLAGS) -I$(top_builddir)/tests/isisd
|
||||||
tests_isisd_test_fuzz_isis_tlv_CPPFLAGS = $(TESTS_CPPFLAGS) -I$(top_builddir)/tests/isisd
|
tests_isisd_test_fuzz_isis_tlv_CPPFLAGS = $(TESTS_CPPFLAGS) -I$(top_builddir)/tests/isisd
|
||||||
|
@ -195,7 +195,7 @@ submodule frr-bgp-common {
|
|||||||
|
|
||||||
leaf external-compare-router-id {
|
leaf external-compare-router-id {
|
||||||
type boolean;
|
type boolean;
|
||||||
default "true";
|
default "false";
|
||||||
description
|
description
|
||||||
"When comparing similar routes received from external BGP
|
"When comparing similar routes received from external BGP
|
||||||
peers, use the router-id as a criterion to select the
|
peers, use the router-id as a criterion to select the
|
||||||
|
@ -90,10 +90,10 @@ module frr-bgp {
|
|||||||
"BGP protocol augmentation of ietf-routing module
|
"BGP protocol augmentation of ietf-routing module
|
||||||
control-plane-protocol.";
|
control-plane-protocol.";
|
||||||
}
|
}
|
||||||
|
presence "Enables configuration of BGP";
|
||||||
description
|
description
|
||||||
"Top-level configuration for the BGP router.";
|
"Top-level configuration for the BGP router.";
|
||||||
container global {
|
container global {
|
||||||
presence "Enables global configuration of BGP";
|
|
||||||
description
|
description
|
||||||
"Global configuration for the BGP router.";
|
"Global configuration for the BGP router.";
|
||||||
leaf local-as {
|
leaf local-as {
|
||||||
|
@ -30,6 +30,7 @@ dist_yangmodels_DATA += yang/frr-route-types.yang
|
|||||||
dist_yangmodels_DATA += yang/frr-routing.yang
|
dist_yangmodels_DATA += yang/frr-routing.yang
|
||||||
dist_yangmodels_DATA += yang/ietf/ietf-routing-types.yang
|
dist_yangmodels_DATA += yang/ietf/ietf-routing-types.yang
|
||||||
dist_yangmodels_DATA += yang/ietf/ietf-interfaces.yang
|
dist_yangmodels_DATA += yang/ietf/ietf-interfaces.yang
|
||||||
|
dist_yangmodels_DATA += yang/ietf/ietf-bgp-types.yang
|
||||||
|
|
||||||
if BFDD
|
if BFDD
|
||||||
dist_yangmodels_DATA += yang/frr-bfdd.yang
|
dist_yangmodels_DATA += yang/frr-bfdd.yang
|
||||||
@ -68,3 +69,16 @@ dist_yangmodels_DATA += yang/frr-igmp.yang
|
|||||||
dist_yangmodels_DATA += yang/frr-pim.yang
|
dist_yangmodels_DATA += yang/frr-pim.yang
|
||||||
dist_yangmodels_DATA += yang/frr-pim-rp.yang
|
dist_yangmodels_DATA += yang/frr-pim-rp.yang
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if BGPD
|
||||||
|
dist_yangmodels_DATA += yang/frr-bgp-common-structure.yang
|
||||||
|
dist_yangmodels_DATA += yang/frr-bgp-common.yang
|
||||||
|
dist_yangmodels_DATA += yang/frr-bgp-common-multiprotocol.yang
|
||||||
|
dist_yangmodels_DATA += yang/frr-bgp-neighbor.yang
|
||||||
|
dist_yangmodels_DATA += yang/frr-bgp-peer-group.yang
|
||||||
|
dist_yangmodels_DATA += yang/frr-deviations-bgp-datacenter.yang
|
||||||
|
dist_yangmodels_DATA += yang/frr-bgp-rpki.yang
|
||||||
|
dist_yangmodels_DATA += yang/frr-bgp-bmp.yang
|
||||||
|
dist_yangmodels_DATA += yang/frr-bgp-types.yang
|
||||||
|
dist_yangmodels_DATA += yang/frr-bgp.yang
|
||||||
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user