Align 1.2.1 tests sims/tpce management to 2.2.1
[transportpce.git] / tests / transportpce_tests / 1.2.1 / test_pce.py
index 61f3b2ab63357da633a990d61d53ecbc878fae76..8a87a9bb236011fb6a849afbf7c81c32df1d12aa 100644 (file)
@@ -17,16 +17,14 @@ import shutil
 import subprocess
 import time
 import unittest
-import test_utils
+from common import test_utils
 
 
 class TransportPCEtesting(unittest.TestCase):
 
-    odl_process = None
     simple_topo_bi_dir_data = None
     simple_topo_uni_dir_data = None
     complex_topo_uni_dir_data = None
-    restconf_baseurl = "http://localhost:8181/restconf"
 
     @classmethod
     def _get_file(cls):
@@ -46,20 +44,19 @@ class TransportPCEtesting(unittest.TestCase):
             with open(topo_uni_dir_complex_file, 'r') as topo_uni_dir_complex:
                 cls.complex_topo_uni_dir_data = topo_uni_dir_complex.read()
 
+    processes = None
+    restconf_baseurl = "http://localhost:8181/restconf"
+
     @classmethod
-    def setUpClass(cls):  # a class method called before tests in an individual class run.
+    def setUpClass(cls):
         cls._get_file()
-        cls.odl_process = test_utils.start_tpce()
-        time.sleep(90)
-        print("opendaylight started")
+        cls.processes = test_utils.start_tpce()
 
     @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 process in cls.processes:
+            test_utils.shutdown_process(process)
+        print("all processes killed")
 
     def setUp(self):  # instruction executed before each test method
         time.sleep(1)