Workaround to install tapi feature in func tests 38/104138/3
authorguillaume.lambert <guillaume.lambert@orange.com>
Wed, 25 Jan 2023 10:17:31 +0000 (11:17 +0100)
committerguillaume.lambert <guillaume.lambert@orange.com>
Wed, 25 Jan 2023 13:04:49 +0000 (14:04 +0100)
JIRA: TRNSPRTPCE-701
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I148587b258066e90930012cba2ca7387af75e8f2

tests/add_tapi_feature_to_tests221.sh [new file with mode: 0755]
tests/transportpce_tests/tapi/test01_abstracted_topology.py
tests/transportpce_tests/tapi/test02_full_topology.py
tests/transportpce_tests/tapi/test03_tapi_device_change_notifications.py
tox.ini

diff --git a/tests/add_tapi_feature_to_tests221.sh b/tests/add_tapi_feature_to_tests221.sh
new file mode 100755 (executable)
index 0000000..f358607
--- /dev/null
@@ -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</feature>' $xmlfeatconfigfile | sed 's@odl-transportpce</feature>@odl-transportpce-tapi</feature>@g')
+sed -i_ "/odl-transportpce<\/feature>/a $newconfigline" $xmlfeatconfigfile
+
+cd $(dirname $0)
index 9f33dd822f3c9825818f96411a212d06ae0d57c2..d895f989894fffab161e9a7933edbbfb885b5595 100644 (file)
@@ -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])
index 64ddc4394aaf18ebb88f6ba268ba8b65b6dd6c38..0ab966b85308ba1cbf70263bebaca5a63326904b 100644 (file)
@@ -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])
index 2a4f3f2925851ee1dc588861eb8ab7db9c89c81a..f4b3be42e6d0756d262012a0d8eb29d5d5383020 100644 (file)
@@ -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 7b18494cec9e6de424b8cf2f586bf5e14005e8aa..4911701c8e4ac8a38ebfe02cadb3ac0bc451a559 100644 (file)
--- 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]