summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py6
-rwxr-xr-xtests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py6
-rwxr-xr-xtests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py6
-rwxr-xr-xtests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py6
-rw-r--r--tests/topotests/bgp_communities_topo1/test_bgp_communities.py6
-rwxr-xr-xtests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py6
-rwxr-xr-xtests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py6
-rwxr-xr-xtests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py6
-rwxr-xr-xtests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py6
-rwxr-xr-xtests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py5
-rwxr-xr-xtests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py5
-rw-r--r--tests/topotests/lib/bgp.py20
-rw-r--r--tests/topotests/lib/common_config.py39
13 files changed, 108 insertions, 15 deletions
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