From 5d00ae0e5a66e825b558d874f7a8bb75f4f2c812 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Wed, 25 Jan 2023 11:17:31 +0100 Subject: [PATCH] Workaround to install tapi feature in func tests JIRA: TRNSPRTPCE-701 Signed-off-by: guillaume.lambert Change-Id: I148587b258066e90930012cba2ca7387af75e8f2 --- tests/add_tapi_feature_to_tests221.sh | 28 +++++++++++++++++++ .../tapi/test01_abstracted_topology.py | 23 +++++++-------- .../tapi/test02_full_topology.py | 23 +++++++-------- ...test03_tapi_device_change_notifications.py | 23 +++++++-------- tox.ini | 3 +- 5 files changed, 66 insertions(+), 34 deletions(-) create mode 100755 tests/add_tapi_feature_to_tests221.sh diff --git a/tests/add_tapi_feature_to_tests221.sh b/tests/add_tapi_feature_to_tests221.sh new file mode 100755 index 000000000..f35860751 --- /dev/null +++ b/tests/add_tapi_feature_to_tests221.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +if [ "$USE_LIGHTY" = "True" ]; then + exit 0; +fi + +cd $(dirname $0) +cd .. + +if [ ! -d karaf221/ ]; then + echo 'no target directory' >&2 + cd $(dirname $0) + exit 1 +fi + +featreference=$(grep '^featuresBoot =' karaf221/target/assembly/etc/org.apache.karaf.features.cfg | cut -d= -f2 | sed 's/^ *//') +xmlfeatconfigfile=$(grep -lR $featreference karaf221/target/assembly/etc/*.xml) + +if [ -f "$xmlfeatconfigfile"_ ]; then + echo "nothing to do : $xmlfeatconfigfile already modified" >&2 + cd $(dirname $0) + exit 0 +fi + +newconfigline=$(grep 'odl-transportpce' $xmlfeatconfigfile | sed 's@odl-transportpce@odl-transportpce-tapi@g') +sed -i_ "/odl-transportpce<\/feature>/a $newconfigline" $xmlfeatconfigfile + +cd $(dirname $0) diff --git a/tests/transportpce_tests/tapi/test01_abstracted_topology.py b/tests/transportpce_tests/tapi/test01_abstracted_topology.py index 9f33dd822..d895f9898 100644 --- a/tests/transportpce_tests/tapi/test01_abstracted_topology.py +++ b/tests/transportpce_tests/tapi/test01_abstracted_topology.py @@ -147,17 +147,18 @@ 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': - print("installing tapi feature...") - result = test_utils.install_karaf_feature("odl-transportpce-tapi") - if result.returncode != 0: - cls.init_failed = True - print("Restarting OpenDaylight...") - test_utils.shutdown_process(cls.processes[0]) - cls.processes[0] = test_utils.start_karaf() - test_utils.process_list[0] = cls.processes[0] - cls.init_failed = not test_utils.wait_until_log_contains( - test_utils.KARAF_LOG, test_utils.KARAF_OK_START_MSG, time_to_wait=60) +# FIXME: https://jira.opendaylight.org/browse/TRNSPRTPCE-701 +# if "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: +# cls.init_failed = True +# print("Restarting OpenDaylight...") +# test_utils.shutdown_process(cls.processes[0]) +# cls.processes[0] = test_utils.start_karaf() +# test_utils.process_list[0] = cls.processes[0] +# cls.init_failed = not test_utils.wait_until_log_contains( +# test_utils.KARAF_LOG, test_utils.KARAF_OK_START_MSG, time_to_wait=60) if cls.init_failed: print("tapi installation feature failed...") test_utils.shutdown_process(cls.processes[0]) diff --git a/tests/transportpce_tests/tapi/test02_full_topology.py b/tests/transportpce_tests/tapi/test02_full_topology.py index 64ddc4394..0ab966b85 100644 --- a/tests/transportpce_tests/tapi/test02_full_topology.py +++ b/tests/transportpce_tests/tapi/test02_full_topology.py @@ -104,17 +104,18 @@ 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': - print("installing tapi feature...") - result = test_utils.install_karaf_feature("odl-transportpce-tapi") - if result.returncode != 0: - cls.init_failed = True - print("Restarting OpenDaylight...") - test_utils.shutdown_process(cls.processes[0]) - cls.processes[0] = test_utils.start_karaf() - test_utils.process_list[0] = cls.processes[0] - cls.init_failed = not test_utils.wait_until_log_contains( - test_utils.KARAF_LOG, test_utils.KARAF_OK_START_MSG, time_to_wait=60) +# FIXME: https://jira.opendaylight.org/browse/TRNSPRTPCE-701 +# if "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: +# cls.init_failed = True +# print("Restarting OpenDaylight...") +# test_utils.shutdown_process(cls.processes[0]) +# cls.processes[0] = test_utils.start_karaf() +# test_utils.process_list[0] = cls.processes[0] +# cls.init_failed = not test_utils.wait_until_log_contains( +# test_utils.KARAF_LOG, test_utils.KARAF_OK_START_MSG, time_to_wait=60) if cls.init_failed: print("tapi installation feature failed...") test_utils.shutdown_process(cls.processes[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..f4b3be42e 100644 --- a/tests/transportpce_tests/tapi/test03_tapi_device_change_notifications.py +++ b/tests/transportpce_tests/tapi/test03_tapi_device_change_notifications.py @@ -113,17 +113,18 @@ 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': - print("installing tapi feature...") - result = test_utils.install_karaf_feature("odl-transportpce-tapi") - if result.returncode != 0: - cls.init_failed = True - print("Restarting OpenDaylight...") - test_utils.shutdown_process(cls.processes[0]) - cls.processes[0] = test_utils.start_karaf() - test_utils.process_list[0] = cls.processes[0] - cls.init_failed = not test_utils.wait_until_log_contains( - test_utils.KARAF_LOG, test_utils.KARAF_OK_START_MSG, time_to_wait=60) +# FIXME: https://jira.opendaylight.org/browse/TRNSPRTPCE-701 +# if "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: +# cls.init_failed = True +# print("Restarting OpenDaylight...") +# test_utils.shutdown_process(cls.processes[0]) +# cls.processes[0] = test_utils.start_karaf() +# test_utils.process_list[0] = cls.processes[0] +# cls.init_failed = not test_utils.wait_until_log_contains( +# test_utils.KARAF_LOG, test_utils.KARAF_OK_START_MSG, time_to_wait=60) if cls.init_failed: print("tapi installation feature failed...") test_utils.shutdown_process(cls.processes[0]) diff --git a/tox.ini b/tox.ini index 7b18494ce..4911701c8 100644 --- a/tox.ini +++ b/tox.ini @@ -181,7 +181,7 @@ commands = [testenv:tests_tapi] depends = buildcontroller,build_karaf_tests221,sims221 -whitelist_externals = launch_tests.sh +whitelist_externals = launch_tests.sh add_tapi_feature_to_tests221.sh passenv = LAUNCHER USE_LIGHTY OLM_TIMER1 OLM_TIMER2 USE_ODL_RESTCONF_VERSION setenv = USE_LIGHTY=True @@ -193,6 +193,7 @@ setenv = OLM_TIMER2=2000 commands = + ./add_tapi_feature_to_tests221.sh ./launch_tests.sh tapi {posargs:} [testenv:with_docker] -- 2.36.6