diff options
19 files changed, 125 insertions, 24 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 8c3e54566e..0703853354 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -519,6 +519,8 @@ static void form_auto_rt(struct bgp *bgp, vni_t vni, struct list *rtl) if (!ecom_found) listnode_add_sort(rtl, ecomadd); + else + ecommunity_free(&ecomadd); } /* diff --git a/lib/thread.c b/lib/thread.c index 19e4827283..db35a3f031 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -438,7 +438,8 @@ struct thread_master *thread_master_create(const char *name) pthread_cond_init(&rv->cancel_cond, NULL); /* Set name */ - rv->name = name ? XSTRDUP(MTYPE_THREAD_MASTER, name) : NULL; + name = name ? name : "default"; + rv->name = XSTRDUP(MTYPE_THREAD_MASTER, name); /* Initialize I/O task data structures */ getrlimit(RLIMIT_NOFILE, &limit); @@ -449,10 +450,13 @@ struct thread_master *thread_master_create(const char *name) rv->write = XCALLOC(MTYPE_THREAD_POLL, sizeof(struct thread *) * rv->fd_limit); + char tmhashname[strlen(name) + 32]; + snprintf(tmhashname, sizeof(tmhashname), "%s - threadmaster event hash", + name); rv->cpu_record = hash_create_size( 8, (unsigned int (*)(const void *))cpu_record_hash_key, (bool (*)(const void *, const void *))cpu_record_hash_cmp, - "Thread Hash"); + tmhashname); thread_list_init(&rv->event); thread_list_init(&rv->ready); diff --git a/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py b/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py index 69e050caed..41fa7c0a09 100755 --- a/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py +++ b/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py @@ -76,6 +76,7 @@ from lib.common_config import ( create_prefix_lists, create_route_maps, verify_bgp_community, + required_linux_kernel_version ) from lib.topolog import logger from lib.bgp import ( @@ -137,6 +138,11 @@ def setup_module(mod): * `mod`: module name """ + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") + testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) diff --git a/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py b/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py index 948f641afb..6068f5f831 100755 --- a/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py @@ -61,6 +61,7 @@ from lib.common_config import ( check_address_types, interface_status, reset_config_on_routers, + required_linux_kernel_version ) from lib.topolog import logger from lib.bgp import verify_bgp_convergence, create_router_bgp, clear_bgp @@ -108,6 +109,11 @@ def setup_module(mod): global NEXT_HOPS, INTF_LIST_R3, INTF_LIST_R2, TEST_STATIC global ADDR_TYPES + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") + testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) diff --git a/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py b/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py index 5b997fdd16..ae54019a0f 100755 --- a/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py @@ -61,6 +61,7 @@ from lib.common_config import ( check_address_types, interface_status, reset_config_on_routers, + required_linux_kernel_version ) from lib.topolog import logger from lib.bgp import verify_bgp_convergence, create_router_bgp, clear_bgp @@ -108,6 +109,11 @@ def setup_module(mod): global NEXT_HOPS, INTF_LIST_R3, INTF_LIST_R2, TEST_STATIC global ADDR_TYPES + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") + testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) diff --git a/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py b/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py index 89b15c46d3..f9d22a3a36 100755 --- a/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py +++ b/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py @@ -65,6 +65,7 @@ from lib.common_config import ( create_route_maps, check_address_types, step, + required_linux_kernel_version ) from lib.topolog import logger from lib.bgp import ( @@ -112,6 +113,11 @@ def setup_module(mod): * `mod`: module name """ + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") + testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) diff --git a/tests/topotests/bgp_communities_topo1/test_bgp_communities.py b/tests/topotests/bgp_communities_topo1/test_bgp_communities.py index 7d960d6916..57e8e0d34a 100644 --- a/tests/topotests/bgp_communities_topo1/test_bgp_communities.py +++ b/tests/topotests/bgp_communities_topo1/test_bgp_communities.py @@ -54,6 +54,7 @@ from lib.common_config import ( create_route_maps, create_prefix_lists, create_route_maps, + required_linux_kernel_version ) from lib.topolog import logger from lib.bgp import ( @@ -102,6 +103,11 @@ def setup_module(mod): * `mod`: module name """ + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") + testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py index fdc1bed522..fdbd317093 100755 --- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py +++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py @@ -135,6 +135,7 @@ from lib.common_config import ( kill_mininet_routers_process, get_frr_ipv6_linklocal, create_route_maps, + required_linux_kernel_version ) # Reading the data from JSON File for topology and configuration creation @@ -186,6 +187,11 @@ def setup_module(mod): global ADDR_TYPES + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") + testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) diff --git a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py index 83a04f491f..e1ec0ea81b 100755 --- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py +++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py @@ -135,6 +135,7 @@ from lib.common_config import ( kill_mininet_routers_process, get_frr_ipv6_linklocal, create_route_maps, + required_linux_kernel_version ) # Reading the data from JSON File for topology and configuration creation @@ -183,6 +184,11 @@ def setup_module(mod): * `mod`: module name """ + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") + global ADDR_TYPES testsuite_run_time = time.asctime(time.localtime(time.time())) diff --git a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py index 334aaebb4b..dc06b7131a 100755 --- a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py +++ b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py @@ -67,6 +67,7 @@ from lib.common_config import ( verify_bgp_community, step, check_address_types, + required_linux_kernel_version ) from lib.topolog import logger from lib.bgp import verify_bgp_convergence, create_router_bgp, clear_bgp_and_verify @@ -142,6 +143,11 @@ def setup_module(mod): * `mod`: module name """ + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") + global ADDR_TYPES testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py index 502a9a9ec4..bb88e47415 100755 --- a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py +++ b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py @@ -91,6 +91,7 @@ from lib.common_config import ( verify_route_maps, create_static_routes, check_address_types, + required_linux_kernel_version ) from lib.topolog import logger from lib.bgp import verify_bgp_convergence, create_router_bgp, clear_bgp_and_verify @@ -133,6 +134,11 @@ def setup_module(mod): * `mod`: module name """ + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") + testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) diff --git a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py index a37e3f36a3..c15b88d371 100755 --- a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py +++ b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py @@ -132,6 +132,7 @@ from lib.common_config import ( create_bgp_community_lists, check_router_status, apply_raw_config, + required_linux_kernel_version ) from lib.topolog import logger @@ -209,6 +210,10 @@ def setup_module(mod): * `mod`: module name """ + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py index c36e66a60e..bb13d54019 100755 --- a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py +++ b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py @@ -78,6 +78,7 @@ from lib.common_config import ( get_frr_ipv6_linklocal, check_router_status, apply_raw_config, + required_linux_kernel_version ) from lib.topolog import logger @@ -141,6 +142,10 @@ def setup_module(mod): * `mod`: module name """ + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version('4.15') + if result is not True: + pytest.skip("Kernel requirements are not met") testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py index e2f887bb89..53257525c6 100644 --- a/tests/topotests/lib/bgp.py +++ b/tests/topotests/lib/bgp.py @@ -2198,7 +2198,7 @@ def verify_bgp_attributes( return True -@retry(attempts=4, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=5, wait=2, return_is_str=True) def verify_best_path_as_per_bgp_attribute( tgen, addr_type, router, input_dict, attribute ): @@ -2513,7 +2513,7 @@ def verify_best_path_as_per_admin_distance( return True -@retry(attempts=5, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=6, wait=2, return_is_str=True) def verify_bgp_rib(tgen, addr_type, dut, input_dict, next_hop=None, aspath=None): """ This API is to verify whether bgp rib has any @@ -2773,7 +2773,7 @@ def verify_bgp_rib(tgen, addr_type, dut, input_dict, next_hop=None, aspath=None) return True -@retry(attempts=4, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=5, wait=2, return_is_str=True) def verify_graceful_restart(tgen, topo, addr_type, input_dict, dut, peer): """ This API is to verify verify_graceful_restart configuration of DUT and @@ -3022,7 +3022,7 @@ def verify_graceful_restart(tgen, topo, addr_type, input_dict, dut, peer): return True -@retry(attempts=4, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=5, wait=2, return_is_str=True) def verify_r_bit(tgen, topo, addr_type, input_dict, dut, peer): """ This API is to verify r_bit in the BGP gr capability advertised @@ -3140,7 +3140,7 @@ def verify_r_bit(tgen, topo, addr_type, input_dict, dut, peer): return True -@retry(attempts=4, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=5, wait=2, return_is_str=True) def verify_eor(tgen, topo, addr_type, input_dict, dut, peer): """ This API is to verify EOR @@ -3303,7 +3303,7 @@ def verify_eor(tgen, topo, addr_type, input_dict, dut, peer): return True -@retry(attempts=4, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=5, wait=2, return_is_str=True) def verify_f_bit(tgen, topo, addr_type, input_dict, dut, peer): """ This API is to verify f_bit in the BGP gr capability advertised @@ -3443,7 +3443,7 @@ def verify_f_bit(tgen, topo, addr_type, input_dict, dut, peer): return True -@retry(attempts=4, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=5, wait=2, return_is_str=True) def verify_graceful_restart_timers(tgen, topo, addr_type, input_dict, dut, peer): """ This API is to verify graceful restart timers, configured and recieved @@ -3569,7 +3569,7 @@ def verify_graceful_restart_timers(tgen, topo, addr_type, input_dict, dut, peer) return True -@retry(attempts=4, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=5, wait=2, return_is_str=True) def verify_gr_address_family(tgen, topo, addr_type, addr_family, dut): """ This API is to verify gr_address_family in the BGP gr capability advertised @@ -3659,7 +3659,7 @@ def verify_gr_address_family(tgen, topo, addr_type, addr_family, dut): logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) -@retry(attempts=5, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=6, wait=2, return_is_str=True) def verify_attributes_for_evpn_routes( tgen, topo, @@ -4060,7 +4060,7 @@ def verify_attributes_for_evpn_routes( return False -@retry(attempts=5, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=6, wait=2, return_is_str=True) def verify_evpn_routes( tgen, topo, dut, input_dict, routeType=5, EthTag=0, next_hop=None ): diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py index 1846d43138..45a86c7a3f 100644 --- a/tests/topotests/lib/common_config.py +++ b/tests/topotests/lib/common_config.py @@ -36,6 +36,8 @@ import ConfigParser import traceback import socket import ipaddress +import platform + if sys.version_info[0] > 2: import io @@ -46,7 +48,7 @@ else: from lib.topolog import logger, logger_config from lib.topogen import TopoRouter, get_topogen -from lib.topotest import interface_set_status +from lib.topotest import interface_set_status, version_cmp FRRCFG_FILE = "frr_json.conf" FRRCFG_BKUP_FILE = "frr_json_initial.conf" @@ -2462,7 +2464,7 @@ def configure_interface_mac(tgen, input_dict): ############################################# # Verification APIs ############################################# -@retry(attempts=5, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=6, wait=2, return_is_str=True) def verify_rib( tgen, addr_type, @@ -3495,7 +3497,7 @@ def verify_prefix_lists(tgen, input_dict): return True -@retry(attempts=2, wait=4, return_is_str=True, initial_wait=2) +@retry(attempts=3, wait=4, return_is_str=True) def verify_route_maps(tgen, input_dict): """ Running "show route-map" command and verifying given route-map @@ -3746,7 +3748,7 @@ def verify_cli_json(tgen, input_dict): return True -@retry(attempts=2, wait=4, return_is_str=True, initial_wait=2) +@retry(attempts=3, wait=4, return_is_str=True) def verify_evpn_vni(tgen, input_dict): """ API to verify evpn vni details using "show evpn vni detail json" @@ -3864,7 +3866,7 @@ def verify_evpn_vni(tgen, input_dict): return False -@retry(attempts=2, wait=4, return_is_str=True, initial_wait=2) +@retry(attempts=3, wait=4, return_is_str=True) def verify_vrf_vni(tgen, input_dict): """ API to verify vrf vni details using "show vrf vni json" @@ -3973,3 +3975,30 @@ def verify_vrf_vni(tgen, input_dict): logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) return False + + +def required_linux_kernel_version(required_version): + """ + This API is used to check linux version compatibility of the test suite. + If version mentioned in required_version is higher than the linux kernel + of the system, test suite will be skipped. This API returns true or errormsg. + + Parameters + ---------- + * `required_version` : Kernel version required for the suites to run. + + Usage + ----- + result = linux_kernel_version_lowerthan('4.15') + + Returns + ------- + errormsg(str) or True + """ + system_kernel = platform.release() + if version_cmp(system_kernel, required_version) < 0: + error_msg = ('These tests will not run on kernel "{}", ' + 'they require kernel >= {})'.format(system_kernel, + required_version )) + return error_msg + return True diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c index 73df93258e..653783f28c 100644 --- a/zebra/zebra_evpn.c +++ b/zebra/zebra_evpn.c @@ -921,7 +921,7 @@ zebra_evpn_t *zebra_evpn_add(vni_t vni) zevpn = hash_get(zvrf->evpn_table, &tmp_zevpn, zebra_evpn_alloc); assert(zevpn); - zebra_evpn_evpn_es_init(zevpn); + zebra_evpn_es_evi_init(zevpn); /* Create hash table for MAC */ zevpn->mac_table = zebra_mac_db_create("Zebra EVPN MAC Table"); @@ -951,7 +951,7 @@ int zebra_evpn_del(zebra_evpn_t *zevpn) hash_free(zevpn->mac_table); zevpn->mac_table = NULL; - zebra_evpn_evpn_es_cleanup(zevpn); + zebra_evpn_es_evi_cleanup(zevpn); /* Free the EVPN hash entry and allocated memory. */ tmp_zevpn = hash_release(zvrf->evpn_table, zevpn); diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c index b9cc02a276..eb4e4f9a57 100644 --- a/zebra/zebra_evpn_mac.c +++ b/zebra/zebra_evpn_mac.c @@ -2060,6 +2060,7 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, if (is_dup_detect) { inform_client = false; upd_neigh = false; + es_change = false; } } } @@ -2092,7 +2093,8 @@ int zebra_evpn_add_update_local_mac(struct zebra_vrf *zvrf, zebra_evpn_t *zevpn, mac->es ? mac->es->esi_str : "", mac->loc_seq, mac->flags, local_inactive ? " local-inactive" : ""); - inform_client = true; + if (!is_dup_detect) + inform_client = true; } if (es_change) { diff --git a/zebra/zebra_evpn_mh.c b/zebra/zebra_evpn_mh.c index 3c99ce29c3..2567171c5e 100644 --- a/zebra/zebra_evpn_mh.c +++ b/zebra/zebra_evpn_mh.c @@ -363,7 +363,7 @@ void zebra_evpn_es_evi_show_vni(struct vty *vty, bool uj, vni_t vni, int detail) } /* Initialize the ES tables maintained per-L2_VNI */ -void zebra_evpn_evpn_es_init(zebra_evpn_t *zevpn) +void zebra_evpn_es_evi_init(zebra_evpn_t *zevpn) { /* Initialize the ES-EVI RB tree */ RB_INIT(zebra_es_evi_rb_head, &zevpn->es_evi_rb_tree); @@ -376,7 +376,7 @@ void zebra_evpn_evpn_es_init(zebra_evpn_t *zevpn) } /* Cleanup the ES info maintained per- EVPN */ -void zebra_evpn_evpn_es_cleanup(zebra_evpn_t *zevpn) +void zebra_evpn_es_evi_cleanup(zebra_evpn_t *zevpn) { struct zebra_evpn_es_evi *es_evi; struct zebra_evpn_es_evi *es_evi_next; diff --git a/zebra/zebra_evpn_mh.h b/zebra/zebra_evpn_mh.h index ed62677e3b..72b7f9b675 100644 --- a/zebra/zebra_evpn_mh.h +++ b/zebra/zebra_evpn_mh.h @@ -198,8 +198,8 @@ extern void zebra_evpn_mh_terminate(void); extern bool zebra_evpn_is_if_es_capable(struct zebra_if *zif); extern void zebra_evpn_if_init(struct zebra_if *zif); extern void zebra_evpn_if_cleanup(struct zebra_if *zif); -extern void zebra_evpn_evpn_es_init(zebra_evpn_t *zevpn); -extern void zebra_evpn_evpn_es_cleanup(zebra_evpn_t *zevpn); +extern void zebra_evpn_es_evi_init(zebra_evpn_t *zevpn); +extern void zebra_evpn_es_evi_cleanup(zebra_evpn_t *zevpn); extern void zebra_evpn_vxl_evpn_set(struct zebra_if *zif, zebra_evpn_t *zevpn, bool set); extern void zebra_evpn_es_set_base_evpn(zebra_evpn_t *zevpn); |
