From 253651ee685c07d342c96adb18fee852b5e02b67 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Thu, 26 Jan 2023 20:16:52 +0100 Subject: [PATCH] Add test_utils ODL startup opt-out support Signed-off-by: guillaume.lambert Change-Id: I28b94e6ff6cf94c4bc9643992aef6c0ff68ba41a --- tests/transportpce_tests/common/test_utils.py | 3 +++ .../tapi/test01_abstracted_topology.py | 2 +- .../tapi/test02_full_topology.py | 2 +- .../test03_tapi_device_change_notifications.py | 2 +- .../with_docker/test02_nbinotifications.py | 2 +- .../with_docker/test03_tapi_nbinotifications.py | 2 +- tox.ini | 16 ++++++++-------- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/transportpce_tests/common/test_utils.py b/tests/transportpce_tests/common/test_utils.py index fb1c39faa..3ff03545c 100644 --- a/tests/transportpce_tests/common/test_utils.py +++ b/tests/transportpce_tests/common/test_utils.py @@ -153,6 +153,9 @@ def start_sims(sims_list): def start_tpce(): + if 'NO_ODL_STARTUP' in os.environ: + print('No OpenDaylight instance to start!') + return [] print('starting OpenDaylight...') if 'USE_LIGHTY' in os.environ and os.environ['USE_LIGHTY'] == 'True': process = start_lighty() diff --git a/tests/transportpce_tests/tapi/test01_abstracted_topology.py b/tests/transportpce_tests/tapi/test01_abstracted_topology.py index 9f33dd822..3e3d99d00 100644 --- a/tests/transportpce_tests/tapi/test01_abstracted_topology.py +++ b/tests/transportpce_tests/tapi/test01_abstracted_topology.py @@ -147,7 +147,7 @@ class TransportTapitesting(unittest.TestCase): os.environ['JAVA_MAX_MEM'] = '4096M' cls.processes = test_utils.start_tpce() # TAPI feature is not installed by default in Karaf - if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': + if "NO_ODL_STARTUP" not in os.environ or "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': print("installing tapi feature...") result = test_utils.install_karaf_feature("odl-transportpce-tapi") if result.returncode != 0: diff --git a/tests/transportpce_tests/tapi/test02_full_topology.py b/tests/transportpce_tests/tapi/test02_full_topology.py index 64ddc4394..10ec7bf07 100644 --- a/tests/transportpce_tests/tapi/test02_full_topology.py +++ b/tests/transportpce_tests/tapi/test02_full_topology.py @@ -104,7 +104,7 @@ class TransportPCEtesting(unittest.TestCase): os.environ['JAVA_MAX_MEM'] = '4096M' cls.processes = test_utils.start_tpce() # TAPI feature is not installed by default in Karaf - if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': + if "NO_ODL_STARTUP" not in os.environ or "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': print("installing tapi feature...") result = test_utils.install_karaf_feature("odl-transportpce-tapi") if result.returncode != 0: diff --git a/tests/transportpce_tests/tapi/test03_tapi_device_change_notifications.py b/tests/transportpce_tests/tapi/test03_tapi_device_change_notifications.py index 2a4f3f292..13a68b209 100644 --- a/tests/transportpce_tests/tapi/test03_tapi_device_change_notifications.py +++ b/tests/transportpce_tests/tapi/test03_tapi_device_change_notifications.py @@ -113,7 +113,7 @@ class TransportPCEFulltesting(unittest.TestCase): os.environ['JAVA_MAX_MEM'] = '4096M' cls.processes = test_utils.start_tpce() # TAPI feature is not installed by default in Karaf - if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': + if "NO_ODL_STARTUP" not in os.environ or "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': print("installing tapi feature...") result = test_utils.install_karaf_feature("odl-transportpce-tapi") if result.returncode != 0: diff --git a/tests/transportpce_tests/with_docker/test02_nbinotifications.py b/tests/transportpce_tests/with_docker/test02_nbinotifications.py index f7dd69e95..41eb33b5f 100644 --- a/tests/transportpce_tests/with_docker/test02_nbinotifications.py +++ b/tests/transportpce_tests/with_docker/test02_nbinotifications.py @@ -85,7 +85,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): cls.init_failed = False cls.processes = test_utils.start_tpce() # NBI notification feature is not installed by default in Karaf - if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': + if "NO_ODL_STARTUP" not in os.environ or "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': print("installing NBI notification feature...") result = test_utils.install_karaf_feature("odl-transportpce-nbinotifications") if result.returncode != 0: diff --git a/tests/transportpce_tests/with_docker/test03_tapi_nbinotifications.py b/tests/transportpce_tests/with_docker/test03_tapi_nbinotifications.py index b9537caf5..6b93e2173 100644 --- a/tests/transportpce_tests/with_docker/test03_tapi_nbinotifications.py +++ b/tests/transportpce_tests/with_docker/test03_tapi_nbinotifications.py @@ -147,7 +147,7 @@ class TransportNbiNotificationstesting(unittest.TestCase): os.environ['JAVA_MAX_MEM'] = '4096M' cls.processes = test_utils.start_tpce() # NBI notification feature is not installed by default in Karaf - if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': + if "NO_ODL_STARTUP" not in os.environ or "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': print("installing NBI notification feature...") result = test_utils.install_karaf_feature("odl-transportpce-nbinotifications") if result.returncode != 0: diff --git a/tox.ini b/tox.ini index deea5646d..b2976bf5e 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ skipsdist = true setupdir = tests/ [testenv] -passenv = USE_LIGHTY http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY OLM_TIMER1 OLM_TIMER2 +passenv = USE_LIGHTY NO_ODL_STARTUP http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY OLM_TIMER1 OLM_TIMER2 setenv = # USE_LIGHTY=True OLM_TIMER1=3000 @@ -67,7 +67,7 @@ deps = setuptools>=7.0 gnpy4tpce==2.4.7 whitelist_externals = launch_tests.sh -passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION +passenv = LAUNCHER USE_LIGHTY NO_ODL_STARTUP USE_ODL_RESTCONF_VERSION basepython = python3 commands = ./launch_tests.sh pce {posargs:} @@ -88,7 +88,7 @@ commands = depends = buildcontroller,build_karaf_tests121,sims121,testsPCE # testsPCE dependency is only here to chain tests in the gate and avoid resources starvation whitelist_externals = launch_tests.sh -passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION +passenv = LAUNCHER USE_LIGHTY NO_ODL_STARTUP USE_ODL_RESTCONF_VERSION setenv = # USE_LIGHTY=True # USE_ODL_RESTCONF_VERSION=draft-bierman02 @@ -121,7 +121,7 @@ commands = depends = buildcontroller,build_karaf_tests221,sims221,tests71 # tests71 dependency is only here to chain tests in the gate and avoid ressources starvation whitelist_externals = launch_tests.sh -passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION +passenv = LAUNCHER USE_LIGHTY NO_ODL_STARTUP USE_ODL_RESTCONF_VERSION setenv = # USE_LIGHTY=True # USE_ODL_RESTCONF_VERSION=draft-bierman02 @@ -145,7 +145,7 @@ commands = [testenv:tests71] depends = buildcontroller,build_karaf_tests71,sims71,tests_tapi whitelist_externals = launch_tests.sh -passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION +passenv = LAUNCHER USE_LIGHTY NO_ODL_STARTUP USE_ODL_RESTCONF_VERSION setenv = # USE_LIGHTY=True # USE_ODL_RESTCONF_VERSION=draft-bierman02 @@ -169,7 +169,7 @@ commands = depends = buildcontroller,build_karaf_tests_hybrid,sims121,sims221,sims71,tests121,tests221,tests71 #the last dependency is to avoid temporarily concurrent ressources problem in parallel mode whitelist_externals = launch_tests.sh -passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION +passenv = LAUNCHER USE_LIGHTY NO_ODL_STARTUP USE_ODL_RESTCONF_VERSION setenv = # USE_LIGHTY=True # USE_ODL_RESTCONF_VERSION=draft-bierman02 @@ -182,7 +182,7 @@ commands = [testenv:tests_tapi] depends = buildcontroller,build_karaf_tests221,sims221 whitelist_externals = launch_tests.sh add_tapi_feature_to_tests221.sh -passenv = LAUNCHER USE_LIGHTY OLM_TIMER1 OLM_TIMER2 USE_ODL_RESTCONF_VERSION +passenv = LAUNCHER USE_LIGHTY NO_ODL_STARTUP OLM_TIMER1 OLM_TIMER2 USE_ODL_RESTCONF_VERSION setenv = # USE_LIGHTY=True # USE_ODL_RESTCONF_VERSION=draft-bierman02 @@ -200,7 +200,7 @@ commands = depends = buildcontroller,sims221 whitelist_externals = launch_tests.sh dockercmd.sh -passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION OLM_TIMER1 OLM_TIMER2 +passenv = LAUNCHER USE_LIGHTY NO_ODL_STARTUP USE_ODL_RESTCONF_VERSION OLM_TIMER1 OLM_TIMER2 setenv = OLM_TIMER1=3000 OLM_TIMER2=2000 -- 2.36.6