Align 1.2.1 tests sims/tpce management to 2.2.1
[transportpce.git] / tests / transportpce_tests / 1.2.1 / test_renderer_service_path_nominal.py
index 796de915cd76935701cec8b3ba9ed0255fa76a39..6ccec33b3c36c8f93c3834522788dc2fc2ee51de 100644 (file)
@@ -19,54 +19,29 @@ import os
 import psutil
 import shutil
 from unittest.result import failfast
-import test_utils
+from common import test_utils
 
 
 class TransportPCERendererTesting(unittest.TestCase):
 
-    sim_process1 = None
-    sim_process2 = None
-    odl_process = None
+    processes = None
     restconf_baseurl = "http://localhost:8181/restconf"
 
-# START_IGNORE_XTESTING
-
     @classmethod
     def setUpClass(cls):
-        cls.sim_process1 = test_utils.start_sim('xpdra')
-        time.sleep(20)
-
-        cls.sim_process2 = test_utils.start_sim('roadma')
-        time.sleep(20)
-
-        cls.odl_process = test_utils.start_tpce()
-        time.sleep(60)
-        print("opendaylight started")
+        cls.processes = test_utils.start_tpce()
+        cls.processes = test_utils.start_sims(['xpdra', 'roadma'])
 
     @classmethod
     def tearDownClass(cls):
-        for child in psutil.Process(cls.odl_process.pid).children():
-            child.send_signal(signal.SIGINT)
-            child.wait()
-        cls.odl_process.send_signal(signal.SIGINT)
-        cls.odl_process.wait()
-        for child in psutil.Process(cls.sim_process1.pid).children():
-            child.send_signal(signal.SIGINT)
-            child.wait()
-        cls.sim_process1.send_signal(signal.SIGINT)
-        cls.sim_process1.wait()
-        for child in psutil.Process(cls.sim_process2.pid).children():
-            child.send_signal(signal.SIGINT)
-            child.wait()
-        cls.sim_process2.send_signal(signal.SIGINT)
-        cls.sim_process2.wait()
+        for process in cls.processes:
+            test_utils.shutdown_process(process)
+        print("all processes killed")
 
     def setUp(self):
         print("execution of {}".format(self.id().split(".")[-1]))
         time.sleep(10)
 
-# END_IGNORE_XTESTING
-
     def test_01_rdm_device_connected(self):
         url = ("{}/config/network-topology:"
                "network-topology/topology/topology-netconf/node/ROADMA01"