diff options
Diffstat (limited to 'tests')
122 files changed, 526 insertions, 233 deletions
diff --git a/tests/bgpd/test_peer_attr.c b/tests/bgpd/test_peer_attr.c index 490b0ee73b..f6a892df42 100644 --- a/tests/bgpd/test_peer_attr.c +++ b/tests/bgpd/test_peer_attr.c @@ -1381,8 +1381,7 @@ static void test_peer_attr(struct test *test, struct test_peer_attr *pa) static void bgp_startup(void) { cmd_init(1); - openzlog("testbgpd", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID, - LOG_DAEMON); + zlog_aux_init("NONE: ", LOG_DEBUG); zprivs_preinit(&bgpd_privs); zprivs_init(&bgpd_privs); @@ -1438,7 +1437,6 @@ static void bgp_shutdown(void) zprivs_terminate(&bgpd_privs); thread_master_free(master); master = NULL; - closezlog(); } int main(void) diff --git a/tests/lib/cli/common_cli.c b/tests/lib/cli/common_cli.c index bd81656ca9..3cade4a2c9 100644 --- a/tests/lib/cli/common_cli.c +++ b/tests/lib/cli/common_cli.c @@ -53,7 +53,6 @@ static void vty_do_exit(int isexit) nb_terminate(); yang_terminate(); thread_master_free(master); - closezlog(); log_memstats(stderr, "testcli"); if (!isexit) @@ -71,11 +70,7 @@ int main(int argc, char **argv) /* master init. */ master = thread_master_create(NULL); - openzlog("common-cli", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID, - LOG_DAEMON); - zlog_set_level(ZLOG_DEST_SYSLOG, ZLOG_DISABLED); - zlog_set_level(ZLOG_DEST_STDOUT, ZLOG_DISABLED); - zlog_set_level(ZLOG_DEST_MONITOR, LOG_DEBUG); + zlog_aux_init("NONE: ", ZLOG_DISABLED); /* Library inits. */ cmd_init(1); diff --git a/tests/lib/cli/test_commands.c b/tests/lib/cli/test_commands.c index 779a7539e9..2b345c91e8 100644 --- a/tests/lib/cli/test_commands.c +++ b/tests/lib/cli/test_commands.c @@ -49,50 +49,116 @@ static vector test_cmds; static char test_buf[32768]; static struct cmd_node bgp_node = { - BGP_NODE, "%s(config-router)# ", + .name = "bgp", + .node = BGP_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-router)# ", }; static struct cmd_node rip_node = { - RIP_NODE, "%s(config-router)# ", + .name = "rip", + .node = RIP_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-router)# ", }; static struct cmd_node isis_node = { - ISIS_NODE, "%s(config-router)# ", + .name = "isis", + .node = ISIS_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-router)# ", }; static struct cmd_node interface_node = { - INTERFACE_NODE, "%s(config-if)# ", + .name = "interface", + .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-if)# ", }; -static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "}; +static struct cmd_node rmap_node = { + .name = "routemap", + .node = RMAP_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-route-map)# ", +}; -static struct cmd_node zebra_node = {ZEBRA_NODE, "%s(config-router)# "}; +static struct cmd_node zebra_node = { + .name = "zebra", + .node = ZEBRA_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-router)# ", +}; -static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE, - "%s(config-router-af)# "}; +static struct cmd_node bgp_vpnv4_node = { + .name = "bgp vpnv4", + .node = BGP_VPNV4_NODE, + .parent_node = BGP_NODE, + .prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv4_node = {BGP_IPV4_NODE, - "%s(config-router-af)# "}; +static struct cmd_node bgp_ipv4_node = { + .name = "bgp ipv4 unicast", + .node = BGP_IPV4_NODE, + .parent_node = BGP_NODE, + .prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv4m_node = {BGP_IPV4M_NODE, - "%s(config-router-af)# "}; +static struct cmd_node bgp_ipv4m_node = { + .name = "bgp ipv4 multicast", + .node = BGP_IPV4M_NODE, + .parent_node = BGP_NODE, + .prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv6_node = {BGP_IPV6_NODE, - "%s(config-router-af)# "}; +static struct cmd_node bgp_ipv6_node = { + .name = "bgp ipv6", + .node = BGP_IPV6_NODE, + .parent_node = BGP_NODE, + .prompt = "%s(config-router-af)# ", +}; -static struct cmd_node bgp_ipv6m_node = {BGP_IPV6M_NODE, - "%s(config-router-af)# "}; +static struct cmd_node bgp_ipv6m_node = { + .name = "bgp ipv6 multicast", + .node = BGP_IPV6M_NODE, + .parent_node = BGP_NODE, + .prompt = "%s(config-router-af)# ", +}; -static struct cmd_node ospf_node = {OSPF_NODE, "%s(config-router)# "}; +static struct cmd_node ospf_node = { + .name = "ospf", + .node = OSPF_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-router)# ", +}; -static struct cmd_node ripng_node = {RIPNG_NODE, "%s(config-router)# "}; +static struct cmd_node ripng_node = { + .name = "ripng", + .node = RIPNG_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-router)# ", +}; -static struct cmd_node ospf6_node = {OSPF6_NODE, "%s(config-ospf6)# "}; +static struct cmd_node ospf6_node = { + .name = "ospf6", + .node = OSPF6_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-ospf6)# ", +}; -static struct cmd_node keychain_node = {KEYCHAIN_NODE, "%s(config-keychain)# "}; +static struct cmd_node keychain_node = { + .name = "keychain", + .node = KEYCHAIN_NODE, + .parent_node = CONFIG_NODE, + .prompt = "%s(config-keychain)# ", +}; -static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE, - "%s(config-keychain-key)# "}; +static struct cmd_node keychain_key_node = { + .name = "keychain key", + .node = KEYCHAIN_KEY_NODE, + .parent_node = KEYCHAIN_NODE, + .prompt = "%s(config-keychain-key)# ", +}; static int test_callback(const struct cmd_element *cmd, struct vty *vty, int argc, struct cmd_token *argv[]) @@ -145,23 +211,23 @@ static void test_init(void) yang_init(true); nb_init(master, NULL, 0); - install_node(&bgp_node, NULL); - install_node(&rip_node, NULL); - install_node(&interface_node, NULL); - install_node(&rmap_node, NULL); - install_node(&zebra_node, NULL); - install_node(&bgp_vpnv4_node, NULL); - install_node(&bgp_ipv4_node, NULL); - install_node(&bgp_ipv4m_node, NULL); - install_node(&bgp_ipv6_node, NULL); - install_node(&bgp_ipv6m_node, NULL); - install_node(&ospf_node, NULL); - install_node(&ripng_node, NULL); - install_node(&ospf6_node, NULL); - install_node(&keychain_node, NULL); - install_node(&keychain_key_node, NULL); - install_node(&isis_node, NULL); - install_node(&vty_node, NULL); + install_node(&bgp_node); + install_node(&rip_node); + install_node(&interface_node); + install_node(&rmap_node); + install_node(&zebra_node); + install_node(&bgp_vpnv4_node); + install_node(&bgp_ipv4_node); + install_node(&bgp_ipv4m_node); + install_node(&bgp_ipv6_node); + install_node(&bgp_ipv6m_node); + install_node(&ospf_node); + install_node(&ripng_node); + install_node(&ospf6_node); + install_node(&keychain_node); + install_node(&keychain_key_node); + install_node(&isis_node); + install_node(&vty_node); test_init_cmd(); diff --git a/tests/lib/northbound/test_oper_data.c b/tests/lib/northbound/test_oper_data.c index 786fce33f9..202a321e1a 100644 --- a/tests/lib/northbound/test_oper_data.c +++ b/tests/lib/northbound/test_oper_data.c @@ -49,41 +49,38 @@ static struct list *vrfs; * XPath: /frr-test-module:frr-test-module/vrfs/vrf */ static const void * -frr_test_module_vrfs_vrf_get_next(const void *parent_list_entry, - const void *list_entry) +frr_test_module_vrfs_vrf_get_next(struct nb_cb_get_next_args *args) { struct listnode *node; - if (list_entry == NULL) + if (args->list_entry == NULL) node = listhead(vrfs); else - node = listnextnode((struct listnode *)list_entry); + node = listnextnode((struct listnode *)args->list_entry); return node; } -static int frr_test_module_vrfs_vrf_get_keys(const void *list_entry, - struct yang_list_keys *keys) +static int frr_test_module_vrfs_vrf_get_keys(struct nb_cb_get_keys_args *args) { const struct tvrf *vrf; - vrf = listgetdata((struct listnode *)list_entry); + vrf = listgetdata((struct listnode *)args->list_entry); - keys->num = 1; - strlcpy(keys->key[0], vrf->name, sizeof(keys->key[0])); + args->keys->num = 1; + strlcpy(args->keys->key[0], vrf->name, sizeof(args->keys->key[0])); return NB_OK; } static const void * -frr_test_module_vrfs_vrf_lookup_entry(const void *parent_list_entry, - const struct yang_list_keys *keys) +frr_test_module_vrfs_vrf_lookup_entry(struct nb_cb_lookup_entry_args *args) { struct listnode *node; struct tvrf *vrf; const char *vrfname; - vrfname = keys->key[0]; + vrfname = args->keys->key[0]; for (ALL_LIST_ELEMENTS_RO(vrfs, node, vrf)) { if (strmatch(vrf->name, vrfname)) @@ -97,39 +94,37 @@ frr_test_module_vrfs_vrf_lookup_entry(const void *parent_list_entry, * XPath: /frr-test-module:frr-test-module/vrfs/vrf/name */ static struct yang_data * -frr_test_module_vrfs_vrf_name_get_elem(const char *xpath, - const void *list_entry) +frr_test_module_vrfs_vrf_name_get_elem(struct nb_cb_get_elem_args *args) { const struct tvrf *vrf; - vrf = listgetdata((struct listnode *)list_entry); - return yang_data_new_string(xpath, vrf->name); + vrf = listgetdata((struct listnode *)args->list_entry); + return yang_data_new_string(args->xpath, vrf->name); } /* * XPath: /frr-test-module:frr-test-module/vrfs/vrf/interfaces/interface */ -static struct yang_data * -frr_test_module_vrfs_vrf_interfaces_interface_get_elem(const char *xpath, - const void *list_entry) +static struct yang_data *frr_test_module_vrfs_vrf_interfaces_interface_get_elem( + struct nb_cb_get_elem_args *args) { const char *interface; - interface = listgetdata((struct listnode *)list_entry); - return yang_data_new_string(xpath, interface); + interface = listgetdata((struct listnode *)args->list_entry); + return yang_data_new_string(args->xpath, interface); } static const void *frr_test_module_vrfs_vrf_interfaces_interface_get_next( - const void *parent_list_entry, const void *list_entry) + struct nb_cb_get_next_args *args) { const struct tvrf *vrf; struct listnode *node; - vrf = listgetdata((struct listnode *)parent_list_entry); - if (list_entry == NULL) + vrf = listgetdata((struct listnode *)args->parent_list_entry); + if (args->list_entry == NULL) node = listhead(vrf->interfaces); else - node = listnextnode((struct listnode *)list_entry); + node = listnextnode((struct listnode *)args->list_entry); return node; } @@ -138,17 +133,16 @@ static const void *frr_test_module_vrfs_vrf_interfaces_interface_get_next( * XPath: /frr-test-module:frr-test-module/vrfs/vrf/routes/route */ static const void * -frr_test_module_vrfs_vrf_routes_route_get_next(const void *parent_list_entry, - const void *list_entry) +frr_test_module_vrfs_vrf_routes_route_get_next(struct nb_cb_get_next_args *args) { const struct tvrf *vrf; struct listnode *node; - vrf = listgetdata((struct listnode *)parent_list_entry); - if (list_entry == NULL) + vrf = listgetdata((struct listnode *)args->parent_list_entry); + if (args->list_entry == NULL) node = listhead(vrf->routes); else - node = listnextnode((struct listnode *)list_entry); + node = listnextnode((struct listnode *)args->list_entry); return node; } @@ -156,67 +150,64 @@ frr_test_module_vrfs_vrf_routes_route_get_next(const void *parent_list_entry, /* * XPath: /frr-test-module:frr-test-module/vrfs/vrf/routes/route/prefix */ -static struct yang_data * -frr_test_module_vrfs_vrf_routes_route_prefix_get_elem(const char *xpath, - const void *list_entry) +static struct yang_data *frr_test_module_vrfs_vrf_routes_route_prefix_get_elem( + struct nb_cb_get_elem_args *args) { const struct troute *route; - route = listgetdata((struct listnode *)list_entry); - return yang_data_new_ipv4p(xpath, &route->prefix); + route = listgetdata((struct listnode *)args->list_entry); + return yang_data_new_ipv4p(args->xpath, &route->prefix); } /* * XPath: /frr-test-module:frr-test-module/vrfs/vrf/routes/route/next-hop */ static struct yang_data * -frr_test_module_vrfs_vrf_routes_route_next_hop_get_elem(const char *xpath, - const void *list_entry) +frr_test_module_vrfs_vrf_routes_route_next_hop_get_elem( + struct nb_cb_get_elem_args *args) { const struct troute *route; - route = listgetdata((struct listnode *)list_entry); - return yang_data_new_ipv4(xpath, &route->nexthop); + route = listgetdata((struct listnode *)args->list_entry); + return yang_data_new_ipv4(args->xpath, &route->nexthop); } /* * XPath: /frr-test-module:frr-test-module/vrfs/vrf/routes/route/interface */ static struct yang_data * -frr_test_module_vrfs_vrf_routes_route_interface_get_elem(const char *xpath, - const void *list_entry) +frr_test_module_vrfs_vrf_routes_route_interface_get_elem( + struct nb_cb_get_elem_args *args) { const struct troute *route; - route = listgetdata((struct listnode *)list_entry); - return yang_data_new_string(xpath, route->ifname); + route = listgetdata((struct listnode *)args->list_entry); + return yang_data_new_string(args->xpath, route->ifname); } /* * XPath: /frr-test-module:frr-test-module/vrfs/vrf/routes/route/metric */ -static struct yang_data * -frr_test_module_vrfs_vrf_routes_route_metric_get_elem(const char *xpath, - const void *list_entry) +static struct yang_data *frr_test_module_vrfs_vrf_routes_route_metric_get_elem( + struct nb_cb_get_elem_args *args) { const struct troute *route; - route = listgetdata((struct listnode *)list_entry); - return yang_data_new_uint8(xpath, route->metric); + route = listgetdata((struct listnode *)args->list_entry); + return yang_data_new_uint8(args->xpath, route->metric); } /* * XPath: /frr-test-module:frr-test-module/vrfs/vrf/routes/route/active */ -static struct yang_data * -frr_test_module_vrfs_vrf_routes_route_active_get_elem(const char *xpath, - const void *list_entry) +static struct yang_data *frr_test_module_vrfs_vrf_routes_route_active_get_elem( + struct nb_cb_get_elem_args *args) { const struct troute *route; - route = listgetdata((struct listnode *)list_entry); + route = listgetdata((struct listnode *)args->list_entry); if (route->active) - return yang_data_new(xpath, NULL); + return yang_data_new(args->xpath, NULL); return NULL; } @@ -374,7 +365,6 @@ static void vty_do_exit(int isexit) nb_terminate(); yang_terminate(); thread_master_free(master); - closezlog(); log_memstats(stderr, "test-nb-oper-data"); if (!isexit) @@ -402,11 +392,7 @@ int main(int argc, char **argv) /* master init. */ master = thread_master_create(NULL); - openzlog("test-nb-oper-data", "NONE", 0, - LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON); - zlog_set_level(ZLOG_DEST_SYSLOG, ZLOG_DISABLED); - zlog_set_level(ZLOG_DEST_STDOUT, ZLOG_DISABLED); - zlog_set_level(ZLOG_DEST_MONITOR, LOG_DEBUG); + zlog_aux_init("NONE: ", ZLOG_DISABLED); /* Library inits. */ cmd_init(1); diff --git a/tests/lib/test_checksum.c b/tests/lib/test_checksum.c index 13d35b0e99..ddb76c8f9d 100644 --- a/tests/lib/test_checksum.c +++ b/tests/lib/test_checksum.c @@ -23,6 +23,7 @@ #include <time.h> #include "checksum.h" +#include "network.h" struct thread_master *master; @@ -477,7 +478,7 @@ int main(int argc, char **argv) exercise %= MAXDATALEN; for (i = 0; i < exercise; i += sizeof(long int)) { - long int rand = random(); + long int rand = frr_weak_random(); for (j = sizeof(long int); j > 0; j--) buffer[i + (sizeof(long int) - j)] = diff --git a/tests/lib/test_segv.c b/tests/lib/test_segv.c index 43ca0837d5..8133637adc 100644 --- a/tests/lib/test_segv.c +++ b/tests/lib/test_segv.c @@ -73,11 +73,7 @@ int main(void) master = thread_master_create(NULL); signal_init(master, array_size(sigs), sigs); - openzlog("testsegv", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID, - LOG_DAEMON); - zlog_set_level(ZLOG_DEST_SYSLOG, ZLOG_DISABLED); - zlog_set_level(ZLOG_DEST_STDOUT, LOG_DEBUG); - zlog_set_level(ZLOG_DEST_MONITOR, ZLOG_DISABLED); + zlog_aux_init("NONE: ", LOG_DEBUG); thread_execute(master, threadfunc, 0, 0); diff --git a/tests/lib/test_sig.c b/tests/lib/test_sig.c index cf63a3d047..2aceafb8f0 100644 --- a/tests/lib/test_sig.c +++ b/tests/lib/test_sig.c @@ -57,11 +57,7 @@ int main(void) master = thread_master_create(NULL); signal_init(master, array_size(sigs), sigs); - openzlog("testsig", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID, - LOG_DAEMON); - zlog_set_level(ZLOG_DEST_SYSLOG, ZLOG_DISABLED); - zlog_set_level(ZLOG_DEST_STDOUT, LOG_DEBUG); - zlog_set_level(ZLOG_DEST_MONITOR, ZLOG_DISABLED); + zlog_aux_init("NONE: ", LOG_DEBUG); while (thread_fetch(master, &t)) thread_call(&t); diff --git a/tests/lib/test_zlog.c b/tests/lib/test_zlog.c index 07885d9847..48fa7bce94 100644 --- a/tests/lib/test_zlog.c +++ b/tests/lib/test_zlog.c @@ -20,6 +20,7 @@ #include <zebra.h> #include <memory.h> #include "log.h" +#include "network.h" /* maximum amount of data to hexdump */ #define MAXDATA 16384 @@ -37,7 +38,7 @@ static bool test_zlog_hexdump(void) uint8_t d[nl]; for (unsigned int i = 0; i < nl; i++) - d[i] = random(); + d[i] = frr_weak_random(); zlog_hexdump(d, nl - 1); nl += 1 + (nl / 2); @@ -52,9 +53,7 @@ bool (*tests[])(void) = { int main(int argc, char **argv) { - openzlog("testzlog", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID, - LOG_ERR); - zlog_set_file("test_zlog.log", LOG_DEBUG); + zlog_aux_init("NONE: ", ZLOG_DISABLED); for (unsigned int i = 0; i < array_size(tests); i++) if (!tests[i]()) diff --git a/tests/lib/test_zmq.c b/tests/lib/test_zmq.c index b6624915e8..fe330d98d4 100644 --- a/tests/lib/test_zmq.c +++ b/tests/lib/test_zmq.c @@ -120,7 +120,7 @@ static void run_client(int syncfd) /* write callback */ printf("---\n"); - snprintf(buf, 32, "Done receiving"); + snprintf(buf, sizeof(buf), "Done receiving"); printf("client send: %s\n", buf); fflush(stdout); send_delim(zmqsock); diff --git a/tests/subdir.am b/tests/subdir.am index 5efdcbbd4c..04053a6f46 100644 --- a/tests/subdir.am +++ b/tests/subdir.am @@ -38,13 +38,10 @@ else TESTS_OSPF6D = endif -tests/lib/cli/test_cli_clippy.c: $(CLIPPY_DEPS) -tests/lib/cli/tests_lib_cli_test_cli-test_cli.$(OBJEXT): tests/lib/cli/test_cli_clippy.c -tests/lib/cli/test_cli-test_cli.$(OBJEXT): tests/lib/cli/test_cli_clippy.c - -tests/ospf6d/test_lsdb_clippy.c: $(CLIPPY_DEPS) -tests/ospf6d/tests_ospf6d_test_lsdb-test_lsdb.$(OBJEXT): tests/ospf6d/test_lsdb_clippy.c -tests/ospf6d/test_lsdb-test_lsdb.$(OBJEXT): tests/ospf6d/test_lsdb_clippy.c +clippy_scan += \ + tests/lib/cli/test_cli.c \ + tests/ospf6d/test_lsdb.c \ + # end check_PROGRAMS = \ tests/lib/cxxcompat \ diff --git a/tests/topotests/all-protocol-startup/r1/bgpd.conf b/tests/topotests/all-protocol-startup/r1/bgpd.conf index 34cbd086dd..7a7bba7ae7 100644 --- a/tests/topotests/all-protocol-startup/r1/bgpd.conf +++ b/tests/topotests/all-protocol-startup/r1/bgpd.conf @@ -4,6 +4,7 @@ log file bgpd.log router bgp 100 bgp router-id 192.168.0.1 bgp log-neighbor-changes + no bgp ebgp-requires-policy neighbor 192.168.7.10 remote-as 100 neighbor 192.168.7.20 remote-as 200 neighbor fc00:0:0:8::1000 remote-as 100 diff --git a/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref b/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref index 993b4df6a2..044cffae7a 100644 --- a/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref +++ b/tests/topotests/all-protocol-startup/r1/ipv4_routes.ref @@ -10,8 +10,14 @@ C>* 192.168.8.0/26 is directly connected, r1-eth8, XX:XX:XX C>* 192.168.9.0/26 is directly connected, r1-eth9, XX:XX:XX O 192.168.0.0/24 [110/10] is directly connected, r1-eth0, weight 1, XX:XX:XX O 192.168.3.0/26 [110/10] is directly connected, r1-eth3, weight 1, XX:XX:XX -S>* 1.1.1.1/32 [1/0] is directly connected, r1-eth0, weight 1, XX:XX:XX -S>* 1.1.1.2/32 [1/0] is directly connected, r1-eth1, weight 1, XX:XX:XX +S>* 1.1.1.1/32 [1/0] is directly connected, r1-eth1, weight 1, XX:XX:XX +S>* 1.1.1.2/32 [1/0] is directly connected, r1-eth2, weight 1, XX:XX:XX +S>* 1.1.1.3/32 [1/0] is directly connected, r1-eth3, weight 1, XX:XX:XX +S>* 1.1.1.4/32 [1/0] is directly connected, r1-eth4, weight 1, XX:XX:XX +S>* 1.1.1.5/32 [1/0] is directly connected, r1-eth5, weight 1, XX:XX:XX +S>* 1.1.1.6/32 [1/0] is directly connected, r1-eth6, weight 1, XX:XX:XX +S>* 1.1.1.7/32 [1/0] is directly connected, r1-eth7, weight 1, XX:XX:XX +S>* 1.1.1.8/32 [1/0] is directly connected, r1-eth8, weight 1, XX:XX:XX S>* 4.5.6.10/32 [1/0] via 192.168.0.2, r1-eth0, weight 1, XX:XX:XX S>* 4.5.6.11/32 [1/0] via 192.168.0.2, r1-eth0, weight 1, XX:XX:XX S>* 4.5.6.12/32 [1/0] is directly connected, r1-eth0, weight 1, XX:XX:XX diff --git a/tests/topotests/all-protocol-startup/r1/zebra.conf b/tests/topotests/all-protocol-startup/r1/zebra.conf index 858a8a585d..c5ef79630e 100644 --- a/tests/topotests/all-protocol-startup/r1/zebra.conf +++ b/tests/topotests/all-protocol-startup/r1/zebra.conf @@ -27,8 +27,14 @@ ipv6 route 4:5::6:12/128 r1-eth0 ip route 4.5.6.15/32 192.168.0.2 255 ipv6 route 4:5::6:15/128 fc00:0:0:0::2 255 # Routes to put into a nexthop-group -ip route 1.1.1.1/32 r1-eth0 -ip route 1.1.1.2/32 r1-eth1 +ip route 1.1.1.1/32 r1-eth1 +ip route 1.1.1.2/32 r1-eth2 +ip route 1.1.1.3/32 r1-eth3 +ip route 1.1.1.4/32 r1-eth4 +ip route 1.1.1.5/32 r1-eth5 +ip route 1.1.1.6/32 r1-eth6 +ip route 1.1.1.7/32 r1-eth7 +ip route 1.1.1.8/32 r1-eth8 # Create a route that has overlapping distance # so we have backups diff --git a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py index 5f23525a1b..f78c2b4bc0 100755 --- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py +++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py @@ -347,6 +347,35 @@ def test_converge_protocols(): # For debugging after starting FRR/Quagga daemons, uncomment the next line ## CLI(net) +def route_get_nhg_id(route_str): + output = net["r1"].cmd('vtysh -c "show ip route %s nexthop-group"' % route_str) + match = re.search(r"Nexthop Group ID: (\d+)", output) + assert match is not None, "Nexthop Group ID not found for sharpd route %s" % route_str + + nhg_id = int(match.group(1)) + return nhg_id + +def verify_nexthop_group(nhg_id, recursive=False): + # Verify NHG is valid/installed + output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhg_id) + + match = re.search(r"Valid", output) + assert match is not None, "Nexthop Group ID=%d not marked Valid" % nhg_id + + # If recursive, we need to look at its resolved group + if recursive: + match = re.search(r"Depends: \((\d+)\)", output) + resolved_id = int(match.group(1)) + verify_nexthop_group(resolved_id, False) + else: + match = re.search(r"Installed", output) + assert match is not None, "Nexthop Group ID=%d not marked Installed" % nhg_id + +def verify_route_nexthop_group(route_str, recursive=False): + # Verify route and that zebra created NHGs for and they are valid/installed + nhg_id = route_get_nhg_id(route_str) + verify_nexthop_group(nhg_id, recursive) + def test_nexthop_groups(): global fatal_error global net @@ -358,25 +387,77 @@ def test_nexthop_groups(): print("\n\n** Verifying Nexthop Groups") print("******************************************\n") + ### Nexthop Group Tests + + ## Basic test + # Create a lib nexthop-group - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group red" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2"') + net["r1"].cmd('vtysh -c "c t" -c "nexthop-group basic" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2"') # Create with sharpd using nexthop-group - net["r1"].cmd('vtysh -c "sharp install routes 2.2.2.1 nexthop-group red 1"') + net["r1"].cmd('vtysh -c "sharp install routes 2.2.2.1 nexthop-group basic 1"') - # Verify route and that zebra created NHGs for and they are valid/installed - output = net["r1"].cmd('vtysh -c "show ip route 2.2.2.1/32 nexthop-group"') - match = re.search(r"Nexthop Group ID: (\d+)", output); - assert match is not None, "Nexthop Group ID not found for sharpd route 2.2.2.1/32" + verify_route_nexthop_group("2.2.2.1/32") - nhe_id = int(match.group(1)) + ## Connected - output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhe_id) - match = re.search(r"Valid", output) - assert match is not None, "Nexthop Group ID=%d not marked Valid" % nhe_id + net["r1"].cmd('vtysh -c "c t" -c "nexthop-group connected" -c "nexthop r1-eth1" -c "nexthop r1-eth2"') - match = re.search(r"Installed", output) - assert match is not None, "Nexthop Group ID=%d not marked Installed" % nhe_id + net["r1"].cmd('vtysh -c "sharp install routes 2.2.2.2 nexthop-group connected 1"') + + verify_route_nexthop_group("2.2.2.2/32") + + ## Recursive + + net["r1"].cmd('vtysh -c "c t" -c "nexthop-group basic-recursive" -c "nexthop 2.2.2.1"') + + net["r1"].cmd('vtysh -c "sharp install routes 3.3.3.1 nexthop-group basic-recursive 1"') + + verify_route_nexthop_group("3.3.3.1/32", True) + + ## Duplicate + + net["r1"].cmd('vtysh -c "c t" -c "nexthop-group duplicate" -c "nexthop 2.2.2.1" -c "nexthop 1.1.1.1"') + + net["r1"].cmd('vtysh -c "sharp install routes 3.3.3.2 nexthop-group duplicate 1"') + + verify_route_nexthop_group("3.3.3.2/32") + + ## Two 4-Way ECMP + + net["r1"].cmd('vtysh -c "c t" -c "nexthop-group fourA" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2" \ + -c "nexthop 1.1.1.3" -c "nexthop 1.1.1.4"') + + net["r1"].cmd('vtysh -c "sharp install routes 4.4.4.1 nexthop-group fourA 1"') + + verify_route_nexthop_group("4.4.4.1/32") + + net["r1"].cmd('vtysh -c "c t" -c "nexthop-group fourB" -c "nexthop 1.1.1.5" -c "nexthop 1.1.1.6" \ + -c "nexthop 1.1.1.7" -c "nexthop 1.1.1.8"') + + net["r1"].cmd('vtysh -c "sharp install routes 4.4.4.2 nexthop-group fourB 1"') + + verify_route_nexthop_group("4.4.4.2/32") + + ## Recursive to 8-Way ECMP + + net["r1"].cmd('vtysh -c "c t" -c "nexthop-group eight-recursive" -c "nexthop 4.4.4.1" -c "nexthop 4.4.4.2"') + + net["r1"].cmd('vtysh -c "sharp install routes 5.5.5.1 nexthop-group eight-recursive 1"') + + verify_route_nexthop_group("5.5.5.1/32") + + ##CLI(net) + + ## Remove all NHG routes + + net["r1"].cmd('vtysh -c "sharp remove routes 2.2.2.1 1"') + net["r1"].cmd('vtysh -c "sharp remove routes 2.2.2.2 1"') + net["r1"].cmd('vtysh -c "sharp remove routes 3.3.3.1 1"') + net["r1"].cmd('vtysh -c "sharp remove routes 3.3.3.2 1"') + net["r1"].cmd('vtysh -c "sharp remove routes 4.4.4.1 1"') + net["r1"].cmd('vtysh -c "sharp remove routes 4.4.4.2 1"') + net["r1"].cmd('vtysh -c "sharp remove routes 5.5.5.1 1"') def test_rip_status(): global fatal_error @@ -924,6 +1005,82 @@ def test_route_map(): assert failures == 0, "Show route-map command failed for router r%s:\n%s" % (i, diff) +def test_nexthop_groups_with_route_maps(): + global fatal_error + global net + + # Skip if previous fatal error condition is raised + if (fatal_error != ""): + pytest.skip(fatal_error) + + print("\n\n** Verifying Nexthop Groups With Route-Maps") + print("******************************************\n") + + ### Nexthop Group With Route-Map Tests + + # Create a lib nexthop-group + net["r1"].cmd('vtysh -c "c t" -c "nexthop-group test" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2"') + + ## Route-Map Proto Source + + route_str = "2.2.2.1" + src_str = "192.168.0.1" + + net["r1"].cmd('vtysh -c "c t" -c "route-map NH-SRC permit 111" -c "set src %s"' % src_str) + net["r1"].cmd('vtysh -c "c t" -c "ip protocol sharp route-map NH-SRC"') + + net["r1"].cmd('vtysh -c "sharp install routes %s nexthop-group test 1"' % route_str) + + verify_route_nexthop_group("%s/32" % route_str) + + # Only a valid test on linux using nexthop objects + if sys.platform.startswith("linux"): + output = net["r1"].cmd('ip route show %s/32' % route_str) + match = re.search(r"src %s" % src_str, output) + assert match is not None, "Route %s/32 not installed with src %s" % (route_str, src_str) + + # Remove NHG routes and route-map + net["r1"].cmd('vtysh -c "sharp remove routes %s 1"' % route_str) + net["r1"].cmd('vtysh -c "c t" -c "no ip protocol sharp route-map NH-SRC"') + net["r1"].cmd('vtysh -c "c t" -c "no route-map NH-SRC permit 111" -c "set src %s"' % src_str) + net["r1"].cmd('vtysh -c "c t" -c "no route-map NH-SRC"') + + ## Route-Map Deny/Permit with same nexthop group + + permit_route_str = "3.3.3.1" + deny_route_str = "3.3.3.2" + + net["r1"].cmd('vtysh -c "c t" -c "ip prefix-list NOPE seq 5 permit %s/32"' % permit_route_str) + net["r1"].cmd('vtysh -c "c t" -c "route-map NOPE permit 111" -c "match ip address prefix-list NOPE"') + net["r1"].cmd('vtysh -c "c t" -c "route-map NOPE deny 222"') + net["r1"].cmd('vtysh -c "c t" -c "ip protocol sharp route-map NOPE"') + + # This route should be permitted + net["r1"].cmd('vtysh -c "sharp install routes %s nexthop-group test 1"' % permit_route_str) + + verify_route_nexthop_group("%s/32" % permit_route_str) + + # This route should be denied + net["r1"].cmd('vtysh -c "sharp install routes %s nexthop-group test 1"' % deny_route_str) + + nhg_id = route_get_nhg_id(deny_route_str) + output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhg_id) + + match = re.search(r"Valid", output) + assert match is None, "Nexthop Group ID=%d should not be marked Valid" % nhg_id + + match = re.search(r"Installed", output) + assert match is None, "Nexthop Group ID=%d should not be marked Installed" % nhg_id + + # Remove NHG routes and route-map + net["r1"].cmd('vtysh -c "sharp remove routes %s 1"' % permit_route_str) + net["r1"].cmd('vtysh -c "sharp remove routes %s 1"' % deny_route_str) + net["r1"].cmd('vtysh -c "c t" -c "no ip protocol sharp route-map NOPE"') + net["r1"].cmd('vtysh -c "c t" -c "no route-map NOPE permit 111"') + net["r1"].cmd('vtysh -c "c t" -c "no route-map NOPE deny 222"') + net["r1"].cmd('vtysh -c "c t" -c "no route-map NOPE"') + net["r1"].cmd('vtysh -c "c t" -c "no ip prefix-list NOPE seq 5 permit %s/32"' % permit_route_str) + def test_mpls_interfaces(): global fatal_error global net diff --git a/tests/topotests/bfd-bgp-cbit-topo3/r1/bgpd.conf b/tests/topotests/bfd-bgp-cbit-topo3/r1/bgpd.conf index fa6d60a8fc..f69b3c4ba3 100644 --- a/tests/topotests/bfd-bgp-cbit-topo3/r1/bgpd.conf +++ b/tests/topotests/bfd-bgp-cbit-topo3/r1/bgpd.conf @@ -1,6 +1,7 @@ debug bgp neighbor-events router bgp 101 bgp router-id 10.254.254.1 + no bgp ebgp-requires-policy timers bgp 8 24 bgp graceful-restart neighbor 2001:db8:4::1 remote-as 102 @@ -14,7 +15,7 @@ router bgp 101 exit-address-family address-family ipv6 unicast network 2001:db8:8::/64 - network 2001:db8:9::/64 + network 2001:db8:9::/64 neighbor 2001:db8:4::1 activate exit-address-family ! diff --git a/tests/topotests/bfd-bgp-cbit-topo3/r3/bgpd.conf b/tests/topotests/bfd-bgp-cbit-topo3/r3/bgpd.conf index ea5334029c..51b611b2a7 100644 --- a/tests/topotests/bfd-bgp-cbit-topo3/r3/bgpd.conf +++ b/tests/topotests/bfd-bgp-cbit-topo3/r3/bgpd.conf @@ -1,6 +1,7 @@ debug bgp neighbor-events router bgp 102 bgp router-id 10.254.254.3 + no bgp ebgp-requires-policy timers bgp 20 60 bgp graceful-restart ! simulate NSF machine diff --git a/tests/topotests/bfd-topo1/r1/bgpd.conf b/tests/topotests/bfd-topo1/r1/bgpd.conf index 78a5611844..87f20d29e9 100644 --- a/tests/topotests/bfd-topo1/r1/bgpd.conf +++ b/tests/topotests/bfd-topo1/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 101 + no bgp ebgp-requires-policy neighbor 192.168.0.2 remote-as 102 neighbor 192.168.0.2 bfd address-family ipv4 unicast diff --git a/tests/topotests/bfd-topo1/r2/bgpd.conf b/tests/topotests/bfd-topo1/r2/bgpd.conf index af10cfaf40..f87e12f0a7 100644 --- a/tests/topotests/bfd-topo1/r2/bgpd.conf +++ b/tests/topotests/bfd-topo1/r2/bgpd.conf @@ -1,4 +1,5 @@ router bgp 102 + no bgp ebgp-requires-policy neighbor 192.168.0.1 remote-as 101 neighbor 192.168.0.1 bfd neighbor 192.168.1.1 remote-as 103 diff --git a/tests/topotests/bfd-topo1/r3/bgpd.conf b/tests/topotests/bfd-topo1/r3/bgpd.conf index 041fd7a759..0340e067f1 100644 --- a/tests/topotests/bfd-topo1/r3/bgpd.conf +++ b/tests/topotests/bfd-topo1/r3/bgpd.conf @@ -1,4 +1,5 @@ router bgp 103 + no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as 102 neighbor 192.168.1.2 bfd address-family ipv4 unicast diff --git a/tests/topotests/bfd-topo1/r4/bgpd.conf b/tests/topotests/bfd-topo1/r4/bgpd.conf index 9c504699ba..980d927e97 100644 --- a/tests/topotests/bfd-topo1/r4/bgpd.conf +++ b/tests/topotests/bfd-topo1/r4/bgpd.conf @@ -1,4 +1,5 @@ router bgp 104 + no bgp ebgp-requires-policy neighbor 192.168.2.2 remote-as 102 neighbor 192.168.2.2 bfd address-family ipv4 unicast diff --git a/tests/topotests/bfd-topo2/r1/bgpd.conf b/tests/topotests/bfd-topo2/r1/bgpd.conf index 1623b4578b..4d96bec2cb 100644 --- a/tests/topotests/bfd-topo2/r1/bgpd.conf +++ b/tests/topotests/bfd-topo2/r1/bgpd.conf @@ -1,5 +1,6 @@ router bgp 101 bgp router-id 10.254.254.1 + no bgp ebgp-requires-policy neighbor r2g peer-group neighbor r2g remote-as external neighbor r2g bfd diff --git a/tests/topotests/bfd-topo2/r2/bgpd.conf b/tests/topotests/bfd-topo2/r2/bgpd.conf index bf42d21812..4d02fc4f29 100644 --- a/tests/topotests/bfd-topo2/r2/bgpd.conf +++ b/tests/topotests/bfd-topo2/r2/bgpd.conf @@ -1,5 +1,6 @@ router bgp 102 bgp router-id 10.254.254.2 + no bgp ebgp-requires-policy neighbor r2g peer-group neighbor r2g remote-as external neighbor r2g bfd diff --git a/tests/topotests/bfd-vrf-topo1/r1/bgpd.conf b/tests/topotests/bfd-vrf-topo1/r1/bgpd.conf index 7ad4e2bd74..136e53a43f 100644 --- a/tests/topotests/bfd-vrf-topo1/r1/bgpd.conf +++ b/tests/topotests/bfd-vrf-topo1/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 101 vrf r1-cust1 + no bgp ebgp-requires-policy neighbor 192.168.0.2 remote-as 102 ! neighbor 192.168.0.2 ebgp-multihop 10 neighbor 192.168.0.2 bfd diff --git a/tests/topotests/bfd-vrf-topo1/r2/bgpd.conf b/tests/topotests/bfd-vrf-topo1/r2/bgpd.conf index 0715ea32a5..2bd13e22b2 100644 --- a/tests/topotests/bfd-vrf-topo1/r2/bgpd.conf +++ b/tests/topotests/bfd-vrf-topo1/r2/bgpd.conf @@ -1,4 +1,5 @@ router bgp 102 vrf r2-cust1 + no bgp ebgp-requires-policy neighbor 192.168.0.1 remote-as 101 neighbor 192.168.0.1 bfd neighbor 192.168.1.1 remote-as 103 diff --git a/tests/topotests/bfd-vrf-topo1/r3/bgpd.conf b/tests/topotests/bfd-vrf-topo1/r3/bgpd.conf index 277f027d5b..c0cd45f7fe 100644 --- a/tests/topotests/bfd-vrf-topo1/r3/bgpd.conf +++ b/tests/topotests/bfd-vrf-topo1/r3/bgpd.conf @@ -1,4 +1,5 @@ router bgp 103 vrf r3-cust1 + no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as 102 neighbor 192.168.1.2 bfd address-family ipv4 unicast diff --git a/tests/topotests/bfd-vrf-topo1/r4/bgpd.conf b/tests/topotests/bfd-vrf-topo1/r4/bgpd.conf index 66bf28587d..fe1185768d 100644 --- a/tests/topotests/bfd-vrf-topo1/r4/bgpd.conf +++ b/tests/topotests/bfd-vrf-topo1/r4/bgpd.conf @@ -1,4 +1,5 @@ router bgp 104 vrf r4-cust1 + no bgp ebgp-requires-policy neighbor 192.168.2.2 remote-as 102 neighbor 192.168.2.2 bfd address-family ipv4 unicast diff --git a/tests/topotests/bgp-ecmp-topo1/r1/bgpd.conf b/tests/topotests/bgp-ecmp-topo1/r1/bgpd.conf index 627dc76c1b..d3beb2d320 100644 --- a/tests/topotests/bgp-ecmp-topo1/r1/bgpd.conf +++ b/tests/topotests/bgp-ecmp-topo1/r1/bgpd.conf @@ -5,6 +5,7 @@ log file bgpd.log router bgp 100 bgp router-id 10.0.255.1 bgp bestpath as-path multipath-relax + no bgp ebgp-requires-policy neighbor 10.0.1.101 remote-as 99 neighbor 10.0.1.102 remote-as 99 neighbor 10.0.1.103 remote-as 99 diff --git a/tests/topotests/bgp-evpn-vxlan_topo1/PE1/bgpd.conf b/tests/topotests/bgp-evpn-vxlan_topo1/PE1/bgpd.conf index 720b83e485..d337201f71 100644 --- a/tests/topotests/bgp-evpn-vxlan_topo1/PE1/bgpd.conf +++ b/tests/topotests/bgp-evpn-vxlan_topo1/PE1/bgpd.conf @@ -1,10 +1,9 @@ router bgp 65000 + timers 3 9 bgp router-id 10.10.10.10 no bgp default ipv4-unicast neighbor 10.30.30.30 remote-as 65000 - neighbor 10.30.30.30 ebgp-multihop 2 neighbor 10.30.30.30 update-source lo - neighbor 10.30.30.30 capability extended-nexthop address-family l2vpn evpn neighbor 10.30.30.30 activate advertise-all-vni diff --git a/tests/topotests/bgp-evpn-vxlan_topo1/PE2/bgpd.conf b/tests/topotests/bgp-evpn-vxlan_topo1/PE2/bgpd.conf index 7739795367..d99e33fc06 100644 --- a/tests/topotests/bgp-evpn-vxlan_topo1/PE2/bgpd.conf +++ b/tests/topotests/bgp-evpn-vxlan_topo1/PE2/bgpd.conf @@ -1,10 +1,9 @@ router bgp 65000 + timers bgp 3 9 bgp router-id 10.30.30.30 no bgp default ipv4-unicast neighbor 10.10.10.10 remote-as 65000 - neighbor 10.10.10.10 ebgp-multihop 2 neighbor 10.10.10.10 update-source lo - neighbor 10.10.10.10 capability extended-nexthop ! address-family l2vpn evpn neighbor 10.10.10.10 activate diff --git a/tests/topotests/bgp-vrf-route-leak-basic/r1/bgpd.conf b/tests/topotests/bgp-vrf-route-leak-basic/r1/bgpd.conf index 626c268392..03dfbf9322 100644 --- a/tests/topotests/bgp-vrf-route-leak-basic/r1/bgpd.conf +++ b/tests/topotests/bgp-vrf-route-leak-basic/r1/bgpd.conf @@ -1,14 +1,16 @@ hostname r1 router bgp 99 vrf DONNA + no bgp ebgp-requires-policy address-family ipv4 unicast redistribute connected import vrf EVA ! ! router bgp 99 vrf EVA + no bgp ebgp-requires-policy address-family ipv4 unicast redistribute connected import vrf DONNA ! -!
\ No newline at end of file +! diff --git a/tests/topotests/bgp_aggregate-address_origin/r1/bgpd.conf b/tests/topotests/bgp_aggregate-address_origin/r1/bgpd.conf index 528d02af36..9d519fae88 100644 --- a/tests/topotests/bgp_aggregate-address_origin/r1/bgpd.conf +++ b/tests/topotests/bgp_aggregate-address_origin/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 address-family ipv4 unicast redistribute connected diff --git a/tests/topotests/bgp_aggregate-address_origin/r2/bgpd.conf b/tests/topotests/bgp_aggregate-address_origin/r2/bgpd.conf index 73d4d0aeea..38cf5aaca7 100644 --- a/tests/topotests/bgp_aggregate-address_origin/r2/bgpd.conf +++ b/tests/topotests/bgp_aggregate-address_origin/r2/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65001 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65000 exit-address-family ! diff --git a/tests/topotests/bgp_aggregate-address_route-map/r1/bgpd.conf b/tests/topotests/bgp_aggregate-address_route-map/r1/bgpd.conf index ef34817bb1..292f0e967f 100644 --- a/tests/topotests/bgp_aggregate-address_route-map/r1/bgpd.conf +++ b/tests/topotests/bgp_aggregate-address_route-map/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 address-family ipv4 unicast redistribute connected diff --git a/tests/topotests/bgp_aggregate-address_route-map/r2/bgpd.conf b/tests/topotests/bgp_aggregate-address_route-map/r2/bgpd.conf index 73d4d0aeea..38cf5aaca7 100644 --- a/tests/topotests/bgp_aggregate-address_route-map/r2/bgpd.conf +++ b/tests/topotests/bgp_aggregate-address_route-map/r2/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65001 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65000 exit-address-family ! diff --git a/tests/topotests/bgp_as_wide_bgp_identifier/r1/bgpd.conf b/tests/topotests/bgp_as_wide_bgp_identifier/r1/bgpd.conf index fc273ba7c6..75741a3c3e 100644 --- a/tests/topotests/bgp_as_wide_bgp_identifier/r1/bgpd.conf +++ b/tests/topotests/bgp_as_wide_bgp_identifier/r1/bgpd.conf @@ -1,5 +1,6 @@ ! exit1 router bgp 65001 bgp router-id 10.10.10.10 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65002 ! diff --git a/tests/topotests/bgp_as_wide_bgp_identifier/r2/bgpd.conf b/tests/topotests/bgp_as_wide_bgp_identifier/r2/bgpd.conf index 1134d98b38..18a6c66f69 100644 --- a/tests/topotests/bgp_as_wide_bgp_identifier/r2/bgpd.conf +++ b/tests/topotests/bgp_as_wide_bgp_identifier/r2/bgpd.conf @@ -1,6 +1,7 @@ ! spine router bgp 65002 bgp router-id 10.10.10.10 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 neighbor 192.168.255.3 remote-as 65002 ! diff --git a/tests/topotests/bgp_as_wide_bgp_identifier/r3/bgpd.conf b/tests/topotests/bgp_as_wide_bgp_identifier/r3/bgpd.conf index fa943d10c3..27bf126000 100644 --- a/tests/topotests/bgp_as_wide_bgp_identifier/r3/bgpd.conf +++ b/tests/topotests/bgp_as_wide_bgp_identifier/r3/bgpd.conf @@ -1,5 +1,6 @@ ! exit2 router bgp 65002 bgp router-id 10.10.10.10 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65002 ! diff --git a/tests/topotests/bgp_comm-list_delete/r1/bgpd.conf b/tests/topotests/bgp_comm-list_delete/r1/bgpd.conf index 6e1273f464..9518894351 100644 --- a/tests/topotests/bgp_comm-list_delete/r1/bgpd.conf +++ b/tests/topotests/bgp_comm-list_delete/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 address-family ipv4 unicast redistribute connected route-map r2-out diff --git a/tests/topotests/bgp_comm-list_delete/r2/bgpd.conf b/tests/topotests/bgp_comm-list_delete/r2/bgpd.conf index 3d354d56b1..e4c1167745 100644 --- a/tests/topotests/bgp_comm-list_delete/r2/bgpd.conf +++ b/tests/topotests/bgp_comm-list_delete/r2/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65001 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65000 address-family ipv4 neighbor 192.168.255.1 route-map r1-in in diff --git a/tests/topotests/bgp_default-route_route-map/r1/bgpd.conf b/tests/topotests/bgp_default-route_route-map/r1/bgpd.conf index a9925ab661..12e56e27c4 100644 --- a/tests/topotests/bgp_default-route_route-map/r1/bgpd.conf +++ b/tests/topotests/bgp_default-route_route-map/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 address-family ipv4 unicast neighbor 192.168.255.2 default-originate route-map default diff --git a/tests/topotests/bgp_default-route_route-map/r2/bgpd.conf b/tests/topotests/bgp_default-route_route-map/r2/bgpd.conf index a8a6c49f4d..b6b560aa4d 100644 --- a/tests/topotests/bgp_default-route_route-map/r2/bgpd.conf +++ b/tests/topotests/bgp_default-route_route-map/r2/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65001 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65000 address-family ipv4 unicast redistribute connected diff --git a/tests/topotests/bgp_distance_change/r1/bgpd.conf b/tests/topotests/bgp_distance_change/r1/bgpd.conf index 67994702bc..cd2ef675fc 100644 --- a/tests/topotests/bgp_distance_change/r1/bgpd.conf +++ b/tests/topotests/bgp_distance_change/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 exit-address-family ! diff --git a/tests/topotests/bgp_distance_change/r2/bgpd.conf b/tests/topotests/bgp_distance_change/r2/bgpd.conf index 206f626da4..0faec85032 100644 --- a/tests/topotests/bgp_distance_change/r2/bgpd.conf +++ b/tests/topotests/bgp_distance_change/r2/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65001 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65000 address-family ipv4 redistribute connected diff --git a/tests/topotests/bgp_ebgp_requires_policy/r1/bgpd.conf b/tests/topotests/bgp_ebgp_requires_policy/r1/bgpd.conf index e06fa08b57..aaa01ebcf9 100644 --- a/tests/topotests/bgp_ebgp_requires_policy/r1/bgpd.conf +++ b/tests/topotests/bgp_ebgp_requires_policy/r1/bgpd.conf @@ -1,5 +1,4 @@ router bgp 65000 - bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 1000 neighbor 192.168.255.2 local-as 500 address-family ipv4 unicast diff --git a/tests/topotests/bgp_ebgp_requires_policy/r2/bgpd.conf b/tests/topotests/bgp_ebgp_requires_policy/r2/bgpd.conf index 0549697ff0..27427a9aaa 100644 --- a/tests/topotests/bgp_ebgp_requires_policy/r2/bgpd.conf +++ b/tests/topotests/bgp_ebgp_requires_policy/r2/bgpd.conf @@ -1,2 +1,3 @@ router bgp 1000 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 500 diff --git a/tests/topotests/bgp_ebgp_requires_policy/r3/bgpd.conf b/tests/topotests/bgp_ebgp_requires_policy/r3/bgpd.conf index b4e304d82a..2deb4b663d 100644 --- a/tests/topotests/bgp_ebgp_requires_policy/r3/bgpd.conf +++ b/tests/topotests/bgp_ebgp_requires_policy/r3/bgpd.conf @@ -1,5 +1,4 @@ router bgp 65000 - bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 1000 neighbor 192.168.255.2 local-as 500 address-family ipv4 unicast diff --git a/tests/topotests/bgp_ebgp_requires_policy/r4/bgpd.conf b/tests/topotests/bgp_ebgp_requires_policy/r4/bgpd.conf index 0549697ff0..27427a9aaa 100644 --- a/tests/topotests/bgp_ebgp_requires_policy/r4/bgpd.conf +++ b/tests/topotests/bgp_ebgp_requires_policy/r4/bgpd.conf @@ -1,2 +1,3 @@ router bgp 1000 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 500 diff --git a/tests/topotests/bgp_ebgp_requires_policy/r5/bgpd.conf b/tests/topotests/bgp_ebgp_requires_policy/r5/bgpd.conf index 99e6b6818d..92a2797921 100644 --- a/tests/topotests/bgp_ebgp_requires_policy/r5/bgpd.conf +++ b/tests/topotests/bgp_ebgp_requires_policy/r5/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65000 address-family ipv4 unicast redistribute connected diff --git a/tests/topotests/bgp_ebgp_requires_policy/r6/bgpd.conf b/tests/topotests/bgp_ebgp_requires_policy/r6/bgpd.conf index 164f975cb7..342f53d4c7 100644 --- a/tests/topotests/bgp_ebgp_requires_policy/r6/bgpd.conf +++ b/tests/topotests/bgp_ebgp_requires_policy/r6/bgpd.conf @@ -1,3 +1,2 @@ router bgp 65000 - bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65000 diff --git a/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py b/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py index bdacff3a9c..18e36311ad 100644 --- a/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py +++ b/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py @@ -27,6 +27,16 @@ bgp_ebgp_requires_policy.py: Test if eBGP sender without a filter applied to the peer is allowed to send advertisements. + +Scenario 1: + r1 has a filter applied for outgoing direction, + r2 receives 192.168.255.1/32. +Scenario 2: + r3 hasn't a filter appied for outgoing direction, + r4 does not receive 192.168.255.1/32. +Scenario 3: + r5 and r6 establish iBGP session which in turn should ignore + RFC8212. All routes for both directions MUST work. """ import os @@ -112,27 +122,27 @@ def test_ebgp_requires_policy(): test_func = functools.partial(_bgp_converge, "r2") success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is True, 'Failed bgp convergence (r2) in "{}"'.format(router) + assert success is True, 'Failed bgp convergence (r2) in "{}"'.format(tgen.gears["r2"]) test_func = functools.partial(_bgp_has_routes, "r2") success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is True, 'eBGP policy is not working (r2) in "{}"'.format(router) + assert success is True, 'eBGP policy is not working (r2) in "{}"'.format(tgen.gears["r2"]) test_func = functools.partial(_bgp_converge, "r4") success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is True, 'Failed bgp convergence (r4) in "{}"'.format(router) + assert success is True, 'Failed bgp convergence (r4) in "{}"'.format(tgen.gears["r4"]) test_func = functools.partial(_bgp_has_routes, "r4") success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is False, 'eBGP policy is not working (r4) in "{}"'.format(router) + assert success is False, 'eBGP policy is not working (r4) in "{}"'.format(tgen.gears["r4"]) test_func = functools.partial(_bgp_converge, "r6") success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is True, 'Failed bgp convergence (r6) in "{}"'.format(router) + assert success is True, 'Failed bgp convergence (r6) in "{}"'.format(tgen.gears["r6"]) test_func = functools.partial(_bgp_has_routes, "r6") success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is True, 'eBGP policy is not working (r6) in "{}"'.format(router) + assert success is True, 'eBGP policy is not working (r6) in "{}"'.format(tgen.gears["r6"]) if __name__ == "__main__": diff --git a/tests/topotests/bgp_ipv6_rtadv/r1/bgpd.conf b/tests/topotests/bgp_ipv6_rtadv/r1/bgpd.conf index 1623b4578b..4d96bec2cb 100644 --- a/tests/topotests/bgp_ipv6_rtadv/r1/bgpd.conf +++ b/tests/topotests/bgp_ipv6_rtadv/r1/bgpd.conf @@ -1,5 +1,6 @@ router bgp 101 bgp router-id 10.254.254.1 + no bgp ebgp-requires-policy neighbor r2g peer-group neighbor r2g remote-as external neighbor r2g bfd diff --git a/tests/topotests/bgp_ipv6_rtadv/r2/bgpd.conf b/tests/topotests/bgp_ipv6_rtadv/r2/bgpd.conf index bf42d21812..4d02fc4f29 100644 --- a/tests/topotests/bgp_ipv6_rtadv/r2/bgpd.conf +++ b/tests/topotests/bgp_ipv6_rtadv/r2/bgpd.conf @@ -1,5 +1,6 @@ router bgp 102 bgp router-id 10.254.254.2 + no bgp ebgp-requires-policy neighbor r2g peer-group neighbor r2g remote-as external neighbor r2g bfd diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/ce1/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/ce1/bgpd.conf index bd10248d7b..4ce87f773b 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/ce1/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/ce1/bgpd.conf @@ -7,6 +7,7 @@ log monitor notifications log commands router bgp 5226 bgp router-id 99.0.0.1 + no bgp ebgp-requires-policy neighbor 192.168.1.1 remote-as 5226 neighbor 192.168.1.1 update-source 192.168.1.2 address-family ipv4 unicast @@ -28,6 +29,3 @@ route-map rm-nh permit 10 ! end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/ce2/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/ce2/bgpd.conf index ab86c5e1b8..0d5ec148b1 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/ce2/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/ce2/bgpd.conf @@ -7,6 +7,7 @@ log monitor notifications log commands router bgp 5226 bgp router-id 99.0.0.2 + no bgp ebgp-requires-policy neighbor 192.168.1.1 remote-as 5226 neighbor 192.168.1.1 update-source 192.168.1.2 address-family ipv4 unicast @@ -28,6 +29,3 @@ route-map rm-nh permit 10 ! end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/ce3/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/ce3/bgpd.conf index 7d239b0bd5..d58b9b1c90 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/ce3/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/ce3/bgpd.conf @@ -7,6 +7,7 @@ log monitor notifications log commands router bgp 5226 bgp router-id 99.0.0.3 + no bgp ebgp-requires-policy neighbor 192.168.1.1 remote-as 5226 neighbor 192.168.1.1 update-source 192.168.1.2 address-family ipv4 unicast @@ -28,6 +29,3 @@ route-map rm-nh permit 10 ! end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/r1/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/r1/bgpd.conf index 7ec941ee6b..33041262f6 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/r1/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/r1/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 1.1.1.1 bgp cluster-id 1.1.1.1 + no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as 5226 neighbor 192.168.1.2 update-source 192.168.1.1 neighbor 192.168.1.2 route-reflector-client diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/r2/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/r2/bgpd.conf index 241c2ac0ae..524051426b 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/r2/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/r2/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 2.2.2.2 bgp cluster-id 2.2.2.2 + no bgp ebgp-requires-policy neighbor 1.1.1.1 remote-as 5226 neighbor 1.1.1.1 update-source 2.2.2.2 neighbor 3.3.3.3 remote-as 5226 @@ -28,6 +29,3 @@ router bgp 5226 neighbor 4.4.4.4 route-reflector-client exit-address-family end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/r3/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/r3/bgpd.conf index 5591c633c6..29b9f0da6c 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/r3/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/r3/bgpd.conf @@ -8,8 +8,9 @@ log commands router bgp 5226 bgp router-id 3.3.3.3 bgp cluster-id 3.3.3.3 + no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as 5226 - neighbor 192.168.1.2 update-source 192.168.1.2 + neighbor 192.168.1.2 update-source 192.168.1.2 neighbor 192.168.1.2 route-reflector-client neighbor 2.2.2.2 remote-as 5226 neighbor 2.2.2.2 update-source 3.3.3.3 @@ -37,6 +38,3 @@ router bgp 5226 vnc redistribute ipv4 bgp-direct ! end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/r4/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/r4/bgpd.conf index 145390d724..e09b505ee4 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/r4/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/r4/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 4.4.4.4 bgp cluster-id 4.4.4.4 + no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as 5226 neighbor 192.168.1.2 update-source 192.168.1.1 neighbor 192.168.1.2 route-reflector-client @@ -37,6 +38,3 @@ router bgp 5226 vnc redistribute ipv4 bgp-direct ! end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf index a38fb1e9a1..3786350996 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf @@ -9,6 +9,7 @@ log file bgpd.log router bgp 5227 bgp router-id 99.0.0.1 + no bgp ebgp-requires-policy neighbor 192.168.1.1 remote-as 5227 neighbor 192.168.1.1 update-source 192.168.1.2 address-family ipv4 unicast @@ -41,6 +42,3 @@ route-map sharp-nh permit 10 ! end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf index 3aeb9f9c9f..ffe2d54f58 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf @@ -9,6 +9,7 @@ log file bgpd.log router bgp 5227 bgp router-id 99.0.0.2 + no bgp ebgp-requires-policy neighbor 192.168.1.1 remote-as 5227 neighbor 192.168.1.1 update-source 192.168.1.2 address-family ipv4 unicast @@ -41,6 +42,3 @@ route-map sharp-nh permit 10 ! end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf index a65b36f364..31a00b8f73 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf @@ -9,6 +9,7 @@ log file bgpd.log router bgp 5227 bgp router-id 99.0.0.3 + no bgp ebgp-requires-policy neighbor 192.168.1.1 remote-as 5227 neighbor 192.168.1.1 update-source 192.168.1.2 address-family ipv4 unicast @@ -31,6 +32,3 @@ route-map rm-nh permit 10 ! end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf index cb08db5314..f57f96bec4 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf @@ -9,6 +9,7 @@ log file bgpd.log router bgp 5228 vrf ce4-cust2 bgp router-id 99.0.0.4 + no bgp ebgp-requires-policy neighbor 192.168.2.1 remote-as 5228 neighbor 192.168.2.1 update-source 192.168.2.2 address-family ipv4 unicast @@ -31,6 +32,3 @@ route-map rm-nh permit 10 ! end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf index c1bad0b7c6..a9549e8fee 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf @@ -16,6 +16,7 @@ log file bgpd.log debugging router bgp 5226 bgp router-id 1.1.1.1 bgp cluster-id 1.1.1.1 + no bgp ebgp-requires-policy neighbor 2.2.2.2 remote-as 5226 neighbor 2.2.2.2 update-source 1.1.1.1 @@ -31,6 +32,7 @@ router bgp 5226 router bgp 5227 vrf r1-cust1 bgp router-id 192.168.1.1 + no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as 5227 neighbor 192.168.1.2 update-source 192.168.1.1 diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/bgpd.conf index 4ccb0ca5c0..cda6d9429a 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/bgpd.conf @@ -10,6 +10,7 @@ log file bgpd.log debugging router bgp 5226 bgp router-id 2.2.2.2 bgp cluster-id 2.2.2.2 + no bgp ebgp-requires-policy neighbor 1.1.1.1 remote-as 5226 neighbor 1.1.1.1 update-source 2.2.2.2 neighbor 3.3.3.3 remote-as 5226 @@ -30,6 +31,3 @@ router bgp 5226 neighbor 4.4.4.4 route-reflector-client exit-address-family end - - - diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/bgpd.conf index c4b6ac9bb4..e2a8de7db7 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/bgpd.conf @@ -11,6 +11,7 @@ log file bgpd.log router bgp 5226 bgp router-id 3.3.3.3 bgp cluster-id 3.3.3.3 + no bgp ebgp-requires-policy neighbor 2.2.2.2 remote-as 5226 neighbor 2.2.2.2 update-source 3.3.3.3 @@ -25,9 +26,10 @@ router bgp 5226 router bgp 5227 vrf r3-cust1 bgp router-id 192.168.1.1 + no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as 5227 - neighbor 192.168.1.2 update-source 192.168.1.1 + neighbor 192.168.1.2 update-source 192.168.1.1 address-family ipv4 unicast neighbor 192.168.1.2 activate diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/bgpd.conf index 6295406e69..7b267a6ee1 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/bgpd.conf @@ -14,6 +14,7 @@ log file bgpd.log debug router bgp 5226 bgp router-id 4.4.4.4 bgp cluster-id 4.4.4.4 + no bgp ebgp-requires-policy neighbor 2.2.2.2 remote-as 5226 neighbor 2.2.2.2 update-source 4.4.4.4 @@ -28,9 +29,10 @@ router bgp 5226 router bgp 5227 vrf r4-cust1 bgp router-id 192.168.1.1 + no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as 5227 - neighbor 192.168.1.2 update-source 192.168.1.1 + neighbor 192.168.1.2 update-source 192.168.1.1 address-family ipv4 unicast neighbor 192.168.1.2 activate @@ -47,6 +49,7 @@ router bgp 5227 vrf r4-cust1 router bgp 5228 vrf r4-cust2 bgp router-id 192.168.2.1 + no bgp ebgp-requires-policy neighbor 192.168.2.2 remote-as 5228 neighbor 192.168.2.2 update-source 192.168.2.1 diff --git a/tests/topotests/bgp_link_bw_ip/r1/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r1/bgpd.conf index 595e244a21..40c19062a2 100644 --- a/tests/topotests/bgp_link_bw_ip/r1/bgpd.conf +++ b/tests/topotests/bgp_link_bw_ip/r1/bgpd.conf @@ -2,6 +2,7 @@ hostname r1 ! router bgp 65101 bgp router-id 11.1.1.1 + no bgp ebgp-requires-policy bgp bestpath as-path multipath-relax neighbor 11.1.1.2 remote-as external neighbor 11.1.1.6 remote-as external diff --git a/tests/topotests/bgp_link_bw_ip/r10/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r10/bgpd.conf index 88a7bdce22..80588e7961 100644 --- a/tests/topotests/bgp_link_bw_ip/r10/bgpd.conf +++ b/tests/topotests/bgp_link_bw_ip/r10/bgpd.conf @@ -7,6 +7,7 @@ route-map redist permit 10 ! router bgp 65354 bgp router-id 11.1.6.2 + no bgp ebgp-requires-policy neighbor 11.1.6.1 remote-as external ! address-family ipv4 unicast diff --git a/tests/topotests/bgp_link_bw_ip/r2/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r2/bgpd.conf index 2b6e9aeb6f..6fec1913c8 100644 --- a/tests/topotests/bgp_link_bw_ip/r2/bgpd.conf +++ b/tests/topotests/bgp_link_bw_ip/r2/bgpd.conf @@ -3,6 +3,7 @@ hostname r2 router bgp 65201 bgp router-id 11.1.2.1 bgp bestpath as-path multipath-relax + no bgp ebgp-requires-policy neighbor 11.1.1.1 remote-as external neighbor 11.1.2.2 remote-as external neighbor 11.1.2.6 remote-as external diff --git a/tests/topotests/bgp_link_bw_ip/r3/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r3/bgpd.conf index 8b7c0c1792..1c2ca88306 100644 --- a/tests/topotests/bgp_link_bw_ip/r3/bgpd.conf +++ b/tests/topotests/bgp_link_bw_ip/r3/bgpd.conf @@ -3,6 +3,7 @@ hostname r3 router bgp 65202 bgp router-id 11.1.3.1 bgp bestpath as-path multipath-relax + no bgp ebgp-requires-policy neighbor 11.1.1.5 remote-as external neighbor 11.1.3.2 remote-as external ! diff --git a/tests/topotests/bgp_link_bw_ip/r4/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r4/bgpd.conf index fa1f37843f..022a230643 100644 --- a/tests/topotests/bgp_link_bw_ip/r4/bgpd.conf +++ b/tests/topotests/bgp_link_bw_ip/r4/bgpd.conf @@ -18,6 +18,7 @@ route-map anycast_ip permit 20 router bgp 65301 bgp router-id 11.1.4.1 bgp bestpath as-path multipath-relax + no bgp ebgp-requires-policy neighbor 11.1.2.1 remote-as external neighbor 11.1.4.2 remote-as external neighbor 11.1.4.6 remote-as external diff --git a/tests/topotests/bgp_link_bw_ip/r5/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r5/bgpd.conf index 8614f3e178..fc4e3888d8 100644 --- a/tests/topotests/bgp_link_bw_ip/r5/bgpd.conf +++ b/tests/topotests/bgp_link_bw_ip/r5/bgpd.conf @@ -11,6 +11,7 @@ route-map anycast_ip permit 20 router bgp 65302 bgp router-id 11.1.5.1 bgp bestpath as-path multipath-relax + no bgp ebgp-requires-policy neighbor 11.1.2.5 remote-as external neighbor 11.1.5.2 remote-as external ! diff --git a/tests/topotests/bgp_link_bw_ip/r6/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r6/bgpd.conf index 3e5c6df6e1..f08f6337f4 100644 --- a/tests/topotests/bgp_link_bw_ip/r6/bgpd.conf +++ b/tests/topotests/bgp_link_bw_ip/r6/bgpd.conf @@ -11,6 +11,7 @@ route-map anycast_ip permit 20 router bgp 65303 bgp router-id 11.1.6.1 bgp bestpath as-path multipath-relax + no bgp ebgp-requires-policy neighbor 11.1.3.1 remote-as external neighbor 11.1.6.2 remote-as external ! diff --git a/tests/topotests/bgp_link_bw_ip/r7/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r7/bgpd.conf index 7862023f55..98dfe2471a 100644 --- a/tests/topotests/bgp_link_bw_ip/r7/bgpd.conf +++ b/tests/topotests/bgp_link_bw_ip/r7/bgpd.conf @@ -7,6 +7,7 @@ route-map redist permit 10 ! router bgp 65351 bgp router-id 11.1.4.2 + no bgp ebgp-requires-policy neighbor 11.1.4.1 remote-as external ! address-family ipv4 unicast diff --git a/tests/topotests/bgp_link_bw_ip/r8/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r8/bgpd.conf index 02110d9175..b4ba8e8a72 100644 --- a/tests/topotests/bgp_link_bw_ip/r8/bgpd.conf +++ b/tests/topotests/bgp_link_bw_ip/r8/bgpd.conf @@ -7,6 +7,7 @@ route-map redist permit 10 ! router bgp 65352 bgp router-id 11.1.4.6 + no bgp ebgp-requires-policy neighbor 11.1.4.5 remote-as external ! address-family ipv4 unicast diff --git a/tests/topotests/bgp_link_bw_ip/r9/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r9/bgpd.conf index d64663fa16..31f971dd08 100644 --- a/tests/topotests/bgp_link_bw_ip/r9/bgpd.conf +++ b/tests/topotests/bgp_link_bw_ip/r9/bgpd.conf @@ -7,6 +7,7 @@ route-map redist permit 10 ! router bgp 65353 bgp router-id 11.1.5.2 + no bgp ebgp-requires-policy neighbor 11.1.5.1 remote-as external ! address-family ipv4 unicast diff --git a/tests/topotests/bgp_local_as_private_remove/r1/bgpd.conf b/tests/topotests/bgp_local_as_private_remove/r1/bgpd.conf index e2f034453f..6f8fcd753d 100644 --- a/tests/topotests/bgp_local_as_private_remove/r1/bgpd.conf +++ b/tests/topotests/bgp_local_as_private_remove/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 1000 neighbor 192.168.255.2 local-as 500 address-family ipv4 unicast diff --git a/tests/topotests/bgp_local_as_private_remove/r2/bgpd.conf b/tests/topotests/bgp_local_as_private_remove/r2/bgpd.conf index 0549697ff0..27427a9aaa 100644 --- a/tests/topotests/bgp_local_as_private_remove/r2/bgpd.conf +++ b/tests/topotests/bgp_local_as_private_remove/r2/bgpd.conf @@ -1,2 +1,3 @@ router bgp 1000 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 500 diff --git a/tests/topotests/bgp_local_as_private_remove/r3/bgpd.conf b/tests/topotests/bgp_local_as_private_remove/r3/bgpd.conf index 4e57f71c48..f2050ddfdb 100644 --- a/tests/topotests/bgp_local_as_private_remove/r3/bgpd.conf +++ b/tests/topotests/bgp_local_as_private_remove/r3/bgpd.conf @@ -1,4 +1,5 @@ router bgp 3000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 1000 neighbor 192.168.255.2 local-as 500 address-family ipv4 unicast diff --git a/tests/topotests/bgp_local_as_private_remove/r4/bgpd.conf b/tests/topotests/bgp_local_as_private_remove/r4/bgpd.conf index 0549697ff0..27427a9aaa 100644 --- a/tests/topotests/bgp_local_as_private_remove/r4/bgpd.conf +++ b/tests/topotests/bgp_local_as_private_remove/r4/bgpd.conf @@ -1,2 +1,3 @@ router bgp 1000 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 500 diff --git a/tests/topotests/bgp_maximum_prefix_invalid_update/r1/bgpd.conf b/tests/topotests/bgp_maximum_prefix_invalid_update/r1/bgpd.conf index 235b42b3d5..f0df56e947 100644 --- a/tests/topotests/bgp_maximum_prefix_invalid_update/r1/bgpd.conf +++ b/tests/topotests/bgp_maximum_prefix_invalid_update/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 address-family ipv4 unicast redistribute connected diff --git a/tests/topotests/bgp_maximum_prefix_invalid_update/r2/bgpd.conf b/tests/topotests/bgp_maximum_prefix_invalid_update/r2/bgpd.conf index e016284159..ef50dd0d7f 100644 --- a/tests/topotests/bgp_maximum_prefix_invalid_update/r2/bgpd.conf +++ b/tests/topotests/bgp_maximum_prefix_invalid_update/r2/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65001 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65000 address-family ipv4 neighbor 192.168.255.1 maximum-prefix 1 diff --git a/tests/topotests/bgp_maximum_prefix_out/r1/bgpd.conf b/tests/topotests/bgp_maximum_prefix_out/r1/bgpd.conf index 9a68809631..03e3eb6e08 100644 --- a/tests/topotests/bgp_maximum_prefix_out/r1/bgpd.conf +++ b/tests/topotests/bgp_maximum_prefix_out/r1/bgpd.conf @@ -1,5 +1,6 @@ ! router bgp 65001 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65002 address-family ipv4 unicast redistribute connected diff --git a/tests/topotests/bgp_maximum_prefix_out/r2/bgpd.conf b/tests/topotests/bgp_maximum_prefix_out/r2/bgpd.conf index 1659c4bec4..2d47b2f661 100644 --- a/tests/topotests/bgp_maximum_prefix_out/r2/bgpd.conf +++ b/tests/topotests/bgp_maximum_prefix_out/r2/bgpd.conf @@ -1,5 +1,6 @@ ! router bgp 65002 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 exit-address-family ! diff --git a/tests/topotests/bgp_multiview_topo1/r1/bgpd.conf b/tests/topotests/bgp_multiview_topo1/r1/bgpd.conf index 71397a9942..5f65a54d7f 100644 --- a/tests/topotests/bgp_multiview_topo1/r1/bgpd.conf +++ b/tests/topotests/bgp_multiview_topo1/r1/bgpd.conf @@ -13,6 +13,7 @@ log file bgpd.log ! router bgp 100 view 1 bgp router-id 172.30.1.1 + no bgp ebgp-requires-policy network 172.20.0.0/28 route-map local1 timers bgp 60 180 neighbor 172.16.1.1 remote-as 65001 @@ -21,6 +22,7 @@ router bgp 100 view 1 ! router bgp 100 view 2 bgp router-id 172.30.1.1 + no bgp ebgp-requires-policy network 172.20.0.0/28 route-map local2 timers bgp 60 180 neighbor 172.16.1.3 remote-as 65003 @@ -28,6 +30,7 @@ router bgp 100 view 2 ! router bgp 100 view 3 bgp router-id 172.30.1.1 + no bgp ebgp-requires-policy network 172.20.0.0/28 timers bgp 60 180 neighbor 172.16.1.6 remote-as 65006 diff --git a/tests/topotests/bgp_prefix_sid/r1/bgpd.conf b/tests/topotests/bgp_prefix_sid/r1/bgpd.conf index 7a38cc307f..2f8759f960 100644 --- a/tests/topotests/bgp_prefix_sid/r1/bgpd.conf +++ b/tests/topotests/bgp_prefix_sid/r1/bgpd.conf @@ -5,6 +5,7 @@ log commands router bgp 1 bgp router-id 10.0.0.1 no bgp default ipv4-unicast + no bgp ebgp-requires-policy neighbor 10.0.0.101 remote-as 2 neighbor 10.0.0.102 remote-as 3 ! diff --git a/tests/topotests/bgp_reject_as_sets/r1/bgpd.conf b/tests/topotests/bgp_reject_as_sets/r1/bgpd.conf index 7b24c4bbf9..94bfc5e561 100644 --- a/tests/topotests/bgp_reject_as_sets/r1/bgpd.conf +++ b/tests/topotests/bgp_reject_as_sets/r1/bgpd.conf @@ -1,5 +1,6 @@ ! exit1 router bgp 65001 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65002 address-family ipv4 unicast redistribute connected diff --git a/tests/topotests/bgp_reject_as_sets/r2/bgpd.conf b/tests/topotests/bgp_reject_as_sets/r2/bgpd.conf index c991b5bcd8..f217b7f794 100644 --- a/tests/topotests/bgp_reject_as_sets/r2/bgpd.conf +++ b/tests/topotests/bgp_reject_as_sets/r2/bgpd.conf @@ -1,6 +1,7 @@ ! spine router bgp 65002 bgp reject-as-sets + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 neighbor 192.168.254.2 remote-as 65003 address-family ipv4 unicast diff --git a/tests/topotests/bgp_reject_as_sets/r3/bgpd.conf b/tests/topotests/bgp_reject_as_sets/r3/bgpd.conf index bee518c84b..8d085a0e4b 100644 --- a/tests/topotests/bgp_reject_as_sets/r3/bgpd.conf +++ b/tests/topotests/bgp_reject_as_sets/r3/bgpd.conf @@ -1,5 +1,6 @@ ! exit2 router bgp 65003 + no bgp ebgp-requires-policy neighbor 192.168.254.1 remote-as 65002 address-family ipv4 unicast neighbor 192.168.254.1 allowas-in diff --git a/tests/topotests/bgp_rfapi_basic_sanity/r1/bgpd.conf b/tests/topotests/bgp_rfapi_basic_sanity/r1/bgpd.conf index 05eac758f1..b3fe5ff23d 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/r1/bgpd.conf +++ b/tests/topotests/bgp_rfapi_basic_sanity/r1/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 1.1.1.1 bgp cluster-id 1.1.1.1 + no bgp ebgp-requires-policy neighbor 2.2.2.2 remote-as 5226 neighbor 2.2.2.2 update-source 1.1.1.1 ! diff --git a/tests/topotests/bgp_rfapi_basic_sanity/r2/bgpd.conf b/tests/topotests/bgp_rfapi_basic_sanity/r2/bgpd.conf index 241c2ac0ae..524051426b 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/r2/bgpd.conf +++ b/tests/topotests/bgp_rfapi_basic_sanity/r2/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 2.2.2.2 bgp cluster-id 2.2.2.2 + no bgp ebgp-requires-policy neighbor 1.1.1.1 remote-as 5226 neighbor 1.1.1.1 update-source 2.2.2.2 neighbor 3.3.3.3 remote-as 5226 @@ -28,6 +29,3 @@ router bgp 5226 neighbor 4.4.4.4 route-reflector-client exit-address-family end - - - diff --git a/tests/topotests/bgp_rfapi_basic_sanity/r3/bgpd.conf b/tests/topotests/bgp_rfapi_basic_sanity/r3/bgpd.conf index 67b26e3a50..fbb6a65d61 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/r3/bgpd.conf +++ b/tests/topotests/bgp_rfapi_basic_sanity/r3/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 3.3.3.3 bgp cluster-id 3.3.3.3 + no bgp ebgp-requires-policy neighbor 2.2.2.2 remote-as 5226 neighbor 2.2.2.2 update-source 3.3.3.3 ! @@ -45,6 +46,3 @@ router bgp 5226 exit-vnc ! end - - - diff --git a/tests/topotests/bgp_rfapi_basic_sanity/r4/bgpd.conf b/tests/topotests/bgp_rfapi_basic_sanity/r4/bgpd.conf index 2ba5c74e5b..d61f776f3d 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/r4/bgpd.conf +++ b/tests/topotests/bgp_rfapi_basic_sanity/r4/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 4.4.4.4 bgp cluster-id 4.4.4.4 + no bgp ebgp-requires-policy neighbor 2.2.2.2 remote-as 5226 neighbor 2.2.2.2 update-source 4.4.4.4 ! @@ -46,6 +47,3 @@ router bgp 5226 exit-vnc ! end - - - diff --git a/tests/topotests/bgp_rfapi_basic_sanity_config2/r1/bgpd.conf b/tests/topotests/bgp_rfapi_basic_sanity_config2/r1/bgpd.conf index f7f5e2ee96..626d8227e7 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity_config2/r1/bgpd.conf +++ b/tests/topotests/bgp_rfapi_basic_sanity_config2/r1/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 1.1.1.1 bgp cluster-id 1.1.1.1 + no bgp ebgp-requires-policy neighbor 2.2.2.2 remote-as 5226 neighbor 2.2.2.2 update-source 1.1.1.1 ! diff --git a/tests/topotests/bgp_rfapi_basic_sanity_config2/r2/bgpd.conf b/tests/topotests/bgp_rfapi_basic_sanity_config2/r2/bgpd.conf index 241c2ac0ae..524051426b 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity_config2/r2/bgpd.conf +++ b/tests/topotests/bgp_rfapi_basic_sanity_config2/r2/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 2.2.2.2 bgp cluster-id 2.2.2.2 + no bgp ebgp-requires-policy neighbor 1.1.1.1 remote-as 5226 neighbor 1.1.1.1 update-source 2.2.2.2 neighbor 3.3.3.3 remote-as 5226 @@ -28,6 +29,3 @@ router bgp 5226 neighbor 4.4.4.4 route-reflector-client exit-address-family end - - - diff --git a/tests/topotests/bgp_rfapi_basic_sanity_config2/r3/bgpd.conf b/tests/topotests/bgp_rfapi_basic_sanity_config2/r3/bgpd.conf index 17e351988d..8c75a39efa 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity_config2/r3/bgpd.conf +++ b/tests/topotests/bgp_rfapi_basic_sanity_config2/r3/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 3.3.3.3 bgp cluster-id 3.3.3.3 + no bgp ebgp-requires-policy neighbor 2.2.2.2 remote-as 5226 neighbor 2.2.2.2 update-source 3.3.3.3 ! @@ -46,6 +47,3 @@ router bgp 5226 exit-vnc ! end - - - diff --git a/tests/topotests/bgp_rfapi_basic_sanity_config2/r4/bgpd.conf b/tests/topotests/bgp_rfapi_basic_sanity_config2/r4/bgpd.conf index 0b8808cb80..38f8758cbc 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity_config2/r4/bgpd.conf +++ b/tests/topotests/bgp_rfapi_basic_sanity_config2/r4/bgpd.conf @@ -8,6 +8,7 @@ log commands router bgp 5226 bgp router-id 4.4.4.4 bgp cluster-id 4.4.4.4 + no bgp ebgp-requires-policy neighbor 2.2.2.2 remote-as 5226 neighbor 2.2.2.2 update-source 4.4.4.4 ! @@ -47,6 +48,3 @@ router bgp 5226 exit-vnc ! end - - - diff --git a/tests/topotests/bgp_rr_ibgp/spine1/bgpd.conf b/tests/topotests/bgp_rr_ibgp/spine1/bgpd.conf index 29a119c291..fa77cce073 100644 --- a/tests/topotests/bgp_rr_ibgp/spine1/bgpd.conf +++ b/tests/topotests/bgp_rr_ibgp/spine1/bgpd.conf @@ -1,5 +1,6 @@ hostname spine1 router bgp 99 + no bgp ebgp-requires-policy neighbor 192.168.2.1 remote-as internal neighbor 192.168.4.2 remote-as internal address-family ipv4 uni diff --git a/tests/topotests/bgp_rr_ibgp/tor1/bgpd.conf b/tests/topotests/bgp_rr_ibgp/tor1/bgpd.conf index e8ec0f7680..b028ab4e8b 100644 --- a/tests/topotests/bgp_rr_ibgp/tor1/bgpd.conf +++ b/tests/topotests/bgp_rr_ibgp/tor1/bgpd.conf @@ -1,4 +1,5 @@ hostname tor1 router bgp 99 + no bgp ebgp-requires-policy neighbor 192.168.2.3 remote-as internal redistribute connected diff --git a/tests/topotests/bgp_rr_ibgp/tor2/bgpd.conf b/tests/topotests/bgp_rr_ibgp/tor2/bgpd.conf index b091c97ac3..99c34158b9 100644 --- a/tests/topotests/bgp_rr_ibgp/tor2/bgpd.conf +++ b/tests/topotests/bgp_rr_ibgp/tor2/bgpd.conf @@ -1,4 +1,5 @@ hostname tor2 router bgp 99 + no bgp ebgp-requires-policy neighbor 192.168.4.3 remote-as internal redistribute connected diff --git a/tests/topotests/bgp_sender-as-path-loop-detection/r1/bgpd.conf b/tests/topotests/bgp_sender-as-path-loop-detection/r1/bgpd.conf index a91b564bff..b16e94d7c1 100644 --- a/tests/topotests/bgp_sender-as-path-loop-detection/r1/bgpd.conf +++ b/tests/topotests/bgp_sender-as-path-loop-detection/r1/bgpd.conf @@ -1,5 +1,6 @@ ! exit1 router bgp 65001 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65002 address-family ipv4 unicast neighbor 192.168.255.1 route-map prepend out diff --git a/tests/topotests/bgp_sender-as-path-loop-detection/r2/bgpd.conf b/tests/topotests/bgp_sender-as-path-loop-detection/r2/bgpd.conf index 6e8e89360f..674877edd3 100644 --- a/tests/topotests/bgp_sender-as-path-loop-detection/r2/bgpd.conf +++ b/tests/topotests/bgp_sender-as-path-loop-detection/r2/bgpd.conf @@ -1,5 +1,6 @@ ! spine router bgp 65002 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 neighbor 192.168.255.2 solo neighbor 192.168.254.2 remote-as 65003 diff --git a/tests/topotests/bgp_sender-as-path-loop-detection/r3/bgpd.conf b/tests/topotests/bgp_sender-as-path-loop-detection/r3/bgpd.conf index 8962befad2..4ee7a39ab2 100644 --- a/tests/topotests/bgp_sender-as-path-loop-detection/r3/bgpd.conf +++ b/tests/topotests/bgp_sender-as-path-loop-detection/r3/bgpd.conf @@ -1,4 +1,5 @@ ! exit2 router bgp 65003 + no bgp ebgp-requires-policy neighbor 192.168.254.1 remote-as 65002 ! diff --git a/tests/topotests/bgp_set_local-preference_add_subtract/r1/bgpd.conf b/tests/topotests/bgp_set_local-preference_add_subtract/r1/bgpd.conf index 1a9c5325ad..7dab52fef0 100644 --- a/tests/topotests/bgp_set_local-preference_add_subtract/r1/bgpd.conf +++ b/tests/topotests/bgp_set_local-preference_add_subtract/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65000 neighbor 192.168.255.3 remote-as 65000 exit-address-family diff --git a/tests/topotests/bgp_set_local-preference_add_subtract/r2/bgpd.conf b/tests/topotests/bgp_set_local-preference_add_subtract/r2/bgpd.conf index 89e1256667..a8a0384632 100644 --- a/tests/topotests/bgp_set_local-preference_add_subtract/r2/bgpd.conf +++ b/tests/topotests/bgp_set_local-preference_add_subtract/r2/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65000 address-family ipv4 redistribute connected diff --git a/tests/topotests/bgp_set_local-preference_add_subtract/r3/bgpd.conf b/tests/topotests/bgp_set_local-preference_add_subtract/r3/bgpd.conf index fabd4605f3..2f5dceede2 100644 --- a/tests/topotests/bgp_set_local-preference_add_subtract/r3/bgpd.conf +++ b/tests/topotests/bgp_set_local-preference_add_subtract/r3/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.1 remote-as 65000 address-family ipv4 redistribute connected diff --git a/tests/topotests/bgp_show_ip_bgp_fqdn/r1/bgpd.conf b/tests/topotests/bgp_show_ip_bgp_fqdn/r1/bgpd.conf index 235b42b3d5..f0df56e947 100644 --- a/tests/topotests/bgp_show_ip_bgp_fqdn/r1/bgpd.conf +++ b/tests/topotests/bgp_show_ip_bgp_fqdn/r1/bgpd.conf @@ -1,4 +1,5 @@ router bgp 65000 + no bgp ebgp-requires-policy neighbor 192.168.255.2 remote-as 65001 address-family ipv4 unicast redistribute connected diff --git a/tests/topotests/bgp_show_ip_bgp_fqdn/r2/bgpd.conf b/tests/topotests/bgp_show_ip_bgp_fqdn/r2/bgpd.conf index c05bfd5a6b..422a7345f9 100644 --- a/tests/topotests/bgp_show_ip_bgp_fqdn/r2/bgpd.conf +++ b/tests/topotests/bgp_show_ip_bgp_fqdn/r2/bgpd.conf @@ -1,5 +1,5 @@ router bgp 65001 + no bgp ebgp-requires-policy bgp default show-hostname neighbor 192.168.255.1 remote-as 65000 - address-family ipv4 unicast - redistribute connected + neighbor 192.168.254.1 remote-as 65001 diff --git a/tests/topotests/bgp_show_ip_bgp_fqdn/r2/zebra.conf b/tests/topotests/bgp_show_ip_bgp_fqdn/r2/zebra.conf index 5abba71ce8..e9e2e4391f 100644 --- a/tests/topotests/bgp_show_ip_bgp_fqdn/r2/zebra.conf +++ b/tests/topotests/bgp_show_ip_bgp_fqdn/r2/zebra.conf @@ -5,5 +5,8 @@ interface lo interface r2-eth0 ip address 192.168.255.2/24 ! +interface r2-eth1 + ip address 192.168.254.2/24 +! ip forwarding ! diff --git a/tests/topotests/bgp_show_ip_bgp_fqdn/r3/bgpd.conf b/tests/topotests/bgp_show_ip_bgp_fqdn/r3/bgpd.conf new file mode 100644 index 0000000000..8fcf6a736d --- /dev/null +++ b/tests/topotests/bgp_show_ip_bgp_fqdn/r3/bgpd.conf @@ -0,0 +1,3 @@ +router bgp 65001 + bgp default show-hostname + neighbor 192.168.254.2 remote-as 65001 diff --git a/tests/topotests/bgp_show_ip_bgp_fqdn/r3/zebra.conf b/tests/topotests/bgp_show_ip_bgp_fqdn/r3/zebra.conf new file mode 100644 index 0000000000..a8b8bc38c5 --- /dev/null +++ b/tests/topotests/bgp_show_ip_bgp_fqdn/r3/zebra.conf @@ -0,0 +1,6 @@ +! +interface r3-eth0 + ip address 192.168.254.1/24 +! +ip forwarding +! diff --git a/tests/topotests/bgp_show_ip_bgp_fqdn/test_bgp_show_ip_bgp_fqdn.py b/tests/topotests/bgp_show_ip_bgp_fqdn/test_bgp_show_ip_bgp_fqdn.py index c41ae7cb2a..e8ad180935 100644 --- a/tests/topotests/bgp_show_ip_bgp_fqdn/test_bgp_show_ip_bgp_fqdn.py +++ b/tests/topotests/bgp_show_ip_bgp_fqdn/test_bgp_show_ip_bgp_fqdn.py @@ -26,6 +26,13 @@ test_bgp_show_ip_bgp_fqdn.py: Test if FQND is visible in `show [ip] bgp` output if `bgp default show-hostname` is toggled. + +Topology: +r1 <-- eBGP --> r2 <-- iBGP --> r3 + +1. Check if both hostname and ip are added to JSON output +for 172.16.255.254/32 on r2. +2. Check if only ip is added to JSON output for 172.16.255.254/32 on r3. """ import os @@ -49,13 +56,17 @@ class TemplateTopo(Topo): def build(self, *_args, **_opts): tgen = get_topogen(self) - for routern in range(1, 3): + for routern in range(1, 4): tgen.add_router("r{}".format(routern)) switch = tgen.add_switch("s1") switch.add_link(tgen.gears["r1"]) switch.add_link(tgen.gears["r2"]) + switch = tgen.add_switch("s2") + switch.add_link(tgen.gears["r2"]) + switch.add_link(tgen.gears["r3"]) + def setup_module(mod): tgen = Topogen(TemplateTopo, mod.__name__) @@ -85,30 +96,36 @@ def test_bgp_show_ip_bgp_hostname(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - router = tgen.gears["r2"] - def _bgp_converge(router): - output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json")) - expected = { - "192.168.255.1": { - "bgpState": "Established", - "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 2}}, - } - } + output = json.loads(router.vtysh_cmd("show ip bgp 172.16.255.254/32 json")) + expected = {"prefix": "172.16.255.254/32"} return topotest.json_cmp(output, expected) def _bgp_show_nexthop_hostname_and_ip(router): output = json.loads(router.vtysh_cmd("show ip bgp json")) - for nh in output["routes"]["172.16.255.253/32"][0]["nexthops"]: + for nh in output["routes"]["172.16.255.254/32"][0]["nexthops"]: if "hostname" in nh and "ip" in nh: return True return False - test_func = functools.partial(_bgp_converge, router) + def _bgp_show_nexthop_ip_only(router): + output = json.loads(router.vtysh_cmd("show ip bgp json")) + for nh in output["routes"]["172.16.255.254/32"][0]["nexthops"]: + if "ip" in nh and not "hostname" in nh: + return True + return False + + test_func = functools.partial(_bgp_converge, tgen.gears["r2"]) success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert result is None, 'Failed bgp convergence in "{}"'.format(router) - assert _bgp_show_nexthop_hostname_and_ip(router) == True + test_func = functools.partial(_bgp_converge, tgen.gears["r3"]) + success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + + assert result is None, 'Failed bgp convergence in "{}"'.format(tgen.gears["r2"]) + assert _bgp_show_nexthop_hostname_and_ip(tgen.gears["r2"]) == True + + assert result is None, 'Failed bgp convergence in "{}"'.format(tgen.gears["r3"]) + assert _bgp_show_nexthop_ip_only(tgen.gears["r3"]) == True if __name__ == "__main__": diff --git a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/bgpd.conf b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/bgpd.conf index 3c974c767f..002cecd1fa 100644 --- a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/bgpd.conf +++ b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/bgpd.conf @@ -1,5 +1,6 @@ router bgp 101 vrf r1-cust1 bgp router-id 10.254.254.1 + no bgp ebgp-requires-policy neighbor r2g peer-group neighbor r2g remote-as external neighbor r2g bfd diff --git a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/bgpd.conf b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/bgpd.conf index 39362abd46..0878b9b995 100644 --- a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/bgpd.conf +++ b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r2/bgpd.conf @@ -1,5 +1,6 @@ router bgp 102 vrf r2-cust1 bgp router-id 10.254.254.2 + no bgp ebgp-requires-policy neighbor r2g peer-group neighbor r2g remote-as external neighbor r2g bfd diff --git a/tests/topotests/bgp_vrf_netns/r1/bgpd.conf b/tests/topotests/bgp_vrf_netns/r1/bgpd.conf index e3f158d7b3..dabf9521ac 100644 --- a/tests/topotests/bgp_vrf_netns/r1/bgpd.conf +++ b/tests/topotests/bgp_vrf_netns/r1/bgpd.conf @@ -2,6 +2,7 @@ router bgp 100 vrf r1-cust1 bgp router-id 10.0.1.1 bgp bestpath as-path multipath-relax + no bgp ebgp-requires-policy neighbor 10.0.1.101 remote-as 99 ! ! diff --git a/tests/topotests/evpn-pim-1/leaf1/bgpd.conf b/tests/topotests/evpn-pim-1/leaf1/bgpd.conf index 33d34db677..4dedfecd61 100644 --- a/tests/topotests/evpn-pim-1/leaf1/bgpd.conf +++ b/tests/topotests/evpn-pim-1/leaf1/bgpd.conf @@ -1,9 +1,10 @@ router bgp 65002 + no bgp ebgp-requires-policy neighbor 192.168.1.1 remote-as external redistribute connected address-family l2vpn evpn neighbor 192.168.1.1 activate advertise-all-vni ! -!
\ No newline at end of file +! diff --git a/tests/topotests/evpn-pim-1/leaf2/bgpd.conf b/tests/topotests/evpn-pim-1/leaf2/bgpd.conf index 3dd9f237be..5bc708240d 100644 --- a/tests/topotests/evpn-pim-1/leaf2/bgpd.conf +++ b/tests/topotests/evpn-pim-1/leaf2/bgpd.conf @@ -1,9 +1,10 @@ router bgp 65003 + no bgp ebgp-requires-policy neighbor 192.168.2.1 remote-as external redistribute connected address-family l2vpn evpn neighbor 192.168.2.1 activate advertise-all-vni ! -!
\ No newline at end of file +! diff --git a/tests/topotests/evpn-pim-1/spine/bgpd.conf b/tests/topotests/evpn-pim-1/spine/bgpd.conf index 9a845043e9..16c17b29cc 100644 --- a/tests/topotests/evpn-pim-1/spine/bgpd.conf +++ b/tests/topotests/evpn-pim-1/spine/bgpd.conf @@ -1,5 +1,6 @@ router bgp 65001 + no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as external neighbor 192.168.2.3 remote-as external redistribute connected diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py index b2cd2d284d..cafba60abf 100644 --- a/tests/topotests/lib/bgp.py +++ b/tests/topotests/lib/bgp.py @@ -209,6 +209,9 @@ def __create_bgp_global(tgen, input_dict, router, build=False): config_data.append(cmd) + # Skip RFC8212 in topotests + config_data.append("no bgp ebgp-requires-policy") + router_id = bgp_data.setdefault("router_id", None) del_router_id = bgp_data.setdefault("del_router_id", False) if del_router_id: diff --git a/tests/topotests/pim-basic/r1/bgpd.conf b/tests/topotests/pim-basic/r1/bgpd.conf index 8acaac96a0..1ca643f758 100644 --- a/tests/topotests/pim-basic/r1/bgpd.conf +++ b/tests/topotests/pim-basic/r1/bgpd.conf @@ -1,3 +1,4 @@ router bgp 65001 + no bgp ebgp-requires-policy neighbor 10.0.30.3 remote-as external redistribute connected diff --git a/tests/topotests/pim-basic/rp/bgpd.conf b/tests/topotests/pim-basic/rp/bgpd.conf index 6b16c067a5..451799288a 100644 --- a/tests/topotests/pim-basic/rp/bgpd.conf +++ b/tests/topotests/pim-basic/rp/bgpd.conf @@ -1,3 +1,4 @@ router bgp 65003 + no bgp ebgp-requires-policy neighbor 10.0.30.1 remote-as external redistribute connected |
