From: naveen Date: Wed, 12 Aug 2020 05:45:57 +0000 (+0530) Subject: tests: Kernel version check for topojson scripts. X-Git-Tag: base_7.6~558^2~3 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=eb5e807234ae269614887097507f7a82206478e3;p=mirror%2Ffrr.git tests: Kernel version check for topojson scripts. 1. Added linux kernel version check to avoid failures in CI systems if matching kernel version not found. Signed-off-by: naveen --- 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..7e7155e8fa 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 @@ -46,8 +46,9 @@ import sys import json import time import pytest +import platform from copy import deepcopy - +from lib.topotest import version_cmp # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(CWD, "../")) 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..6059060729 100755 --- a/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py @@ -41,7 +41,7 @@ import sys import time import json import pytest - +import platform # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(CWD, "../")) @@ -51,7 +51,7 @@ sys.path.append(os.path.join(CWD, "../../")) # Import topogen and topotest helpers from lib.topogen import Topogen, get_topogen from mininet.topo import Topo - +from lib.topotest import version_cmp from lib.common_config import ( start_topology, write_test_header, @@ -124,6 +124,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) + if version_cmp(platform.release(), '4.19') < 0: + error_msg = ('These tests will not run. (have kernel "{}", ' + 'requires kernel >= 4.19)'.format(platform.release())) + pytest.skip(error_msg) + # Don't run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) 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..81486dd2a1 100755 --- a/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py @@ -41,7 +41,7 @@ import sys import time import json import pytest - +import platform # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(CWD, "../")) @@ -51,7 +51,7 @@ sys.path.append(os.path.join(CWD, "../../")) # Import topogen and topotest helpers from lib.topogen import Topogen, get_topogen from mininet.topo import Topo - +from lib.topotest import version_cmp from lib.common_config import ( start_topology, write_test_header, @@ -124,6 +124,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) + if version_cmp(platform.release(), '4.19') < 0: + error_msg = ('These tests will not run. (have kernel "{}", ' + 'requires kernel >= 4.19)'.format(platform.release())) + pytest.skip(error_msg) + # Don't run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) 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..197a2619aa 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 @@ -43,7 +43,7 @@ import sys import time import json import pytest - +import platform # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(CWD, "../")) @@ -53,7 +53,7 @@ sys.path.append(os.path.join(CWD, "../lib/")) # Import topogen and topotest helpers from mininet.topo import Topo from lib.topogen import Topogen, get_topogen - +from lib.topotest import version_cmp # Import topoJson from lib, to create topology and initial configuration from lib.common_config import ( start_topology, @@ -129,6 +129,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) + if version_cmp(platform.release(), '4.19') < 0: + error_msg = ('These tests will not run. (have kernel "{}", ' + 'requires kernel >= 4.19)'.format(platform.release())) + pytest.skip(error_msg) + # Checking BGP convergence global BGP_CONVERGENCE global ADDR_TYPES diff --git a/tests/topotests/bgp_communities_topo1/test_bgp_communities.py b/tests/topotests/bgp_communities_topo1/test_bgp_communities.py index 7d960d6916..2726f65ad9 100644 --- a/tests/topotests/bgp_communities_topo1/test_bgp_communities.py +++ b/tests/topotests/bgp_communities_topo1/test_bgp_communities.py @@ -31,6 +31,7 @@ import sys import time import json import pytest +import platform # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) @@ -40,7 +41,7 @@ sys.path.append(os.path.join(CWD, "../")) # Import topogen and topotest helpers from mininet.topo import Topo from lib.topogen import Topogen, get_topogen - +from lib.topotest import version_cmp # Import topoJson from lib, to create topology and initial configuration from lib.common_config import ( start_topology, @@ -119,6 +120,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) + if version_cmp(platform.release(), '4.19') < 0: + error_msg = ('These tests will not run. (have kernel "{}", ' + 'requires kernel >= 4.19)'.format(platform.release())) + pytest.skip(error_msg) + # Checking BGP convergence global BGP_CONVERGENCE global ADDR_TYPES 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..fc6c528f71 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 @@ -91,6 +91,7 @@ import json import time import inspect import pytest +import platform from time import sleep # Save the Current Working Directory to find configuration files. @@ -103,7 +104,7 @@ sys.path.append(os.path.join("../lib/")) from lib import topotest from lib.topogen import Topogen, TopoRouter, get_topogen from lib.topolog import logger - +from lib.topotest import version_cmp # Required to instantiate the topology builder class. from mininet.topo import Topo @@ -206,6 +207,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) + if version_cmp(platform.release(), '4.19') < 0: + error_msg = ('These tests will not run. (have kernel "{}", ' + 'requires kernel >= 4.19)'.format(platform.release())) + pytest.skip(error_msg) + # Don't run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) 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..49045f2bb6 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 @@ -87,6 +87,7 @@ import sys import json import time import pytest +import platform from time import sleep from copy import deepcopy @@ -100,7 +101,7 @@ sys.path.append(os.path.join("../lib/")) from lib import topotest from lib.topogen import Topogen, TopoRouter, get_topogen from lib.topolog import logger - +from lib.topotest import version_cmp # Required to instantiate the topology builder class. from mininet.topo import Topo @@ -202,6 +203,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) + if version_cmp(platform.release(), '4.19') < 0: + error_msg = ('These tests will not run. (have kernel "{}", ' + 'requires kernel >= 4.19)'.format(platform.release())) + pytest.skip(error_msg) + # Api call verify whether BGP is converged ADDR_TYPES = check_address_types() 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..baa0653dc2 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 @@ -51,7 +51,8 @@ import time from os import path as os_path import sys from json import load as json_load - +import platform +from lib.topotest import version_cmp # Required to instantiate the topology builder class. from lib.topogen import Topogen, get_topogen from mininet.topo import Topo @@ -160,6 +161,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) + if version_cmp(platform.release(), '4.19') < 0: + error_msg = ('These tests will not run. (have kernel "{}", ' + 'requires kernel >= 4.19)'.format(platform.release())) + pytest.skip(error_msg) + # Checking BGP convergence global bgp_convergence 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..5ec663c633 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 @@ -64,7 +64,7 @@ import sys import json import pytest import time - +import platform # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(CWD, "../")) @@ -75,7 +75,7 @@ sys.path.append(os.path.join(CWD, "../lib/")) # Import topoJson from lib, to create topology and initial configuration from lib.topogen import Topogen, get_topogen from mininet.topo import Topo - +from lib.topotest import version_cmp from lib.common_config import ( start_topology, write_test_header, @@ -150,6 +150,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) + if version_cmp(platform.release(), '4.19') < 0: + error_msg = ('These tests will not run. (have kernel "{}", ' + 'requires kernel >= 4.19)'.format(platform.release())) + pytest.skip(error_msg) + # Checking BGP convergence global bgp_convergence, ADDR_TYPES 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..74cbda6a25 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 @@ -102,6 +102,7 @@ import sys import json import time import pytest +import platform from copy import deepcopy # Save the Current Working Directory to find configuration files. @@ -115,7 +116,7 @@ sys.path.append(os.path.join(CWD, "../lib/")) # Import topogen and topotest helpers from lib.topogen import Topogen, get_topogen from mininet.topo import Topo - +from lib.topotest import version_cmp from lib.common_config import ( step, verify_rib, @@ -230,6 +231,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) + if version_cmp(platform.release(), '4.19') < 0: + error_msg = ('These tests will not run. (have kernel "{}", ' + 'requires kernel >= 4.19)'.format(platform.release())) + pytest.skip(error_msg) + global BGP_CONVERGENCE global ADDR_TYPES ADDR_TYPES = check_address_types() 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..f1522c2a99 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 @@ -43,9 +43,10 @@ import sys import json import time import pytest +import platform from copy import deepcopy from time import sleep - +from lib.topotest import version_cmp # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) @@ -162,6 +163,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) + if version_cmp(platform.release(), '4.19') < 0: + error_msg = ('These tests will not run. (have kernel "{}", ' + 'requires kernel >= 4.19)'.format(platform.release())) + pytest.skip(error_msg) + global BGP_CONVERGENCE global ADDR_TYPES ADDR_TYPES = check_address_types()