X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ftransportpce_tests%2F1.2.1%2Ftest_pce.py;h=8a87a9bb236011fb6a849afbf7c81c32df1d12aa;hb=f4d7679be9ffcc5ef14241cbfe9040c1c177b260;hp=f97dda23adb6159908643770b7da8f828808a17a;hpb=77fcc6a019ffb351ee6b5d13757cefecdd837a30;p=transportpce.git diff --git a/tests/transportpce_tests/1.2.1/test_pce.py b/tests/transportpce_tests/1.2.1/test_pce.py index f97dda23a..8a87a9bb2 100644 --- a/tests/transportpce_tests/1.2.1/test_pce.py +++ b/tests/transportpce_tests/1.2.1/test_pce.py @@ -17,47 +17,46 @@ 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): - topo_bi_dir_file = "sample_configs/honeynode-topo.xml" + topo_bi_dir_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), + "..", "..", "sample_configs", "honeynode-topo.xml") if os.path.isfile(topo_bi_dir_file): with open(topo_bi_dir_file, 'r') as topo_bi_dir: cls.simple_topo_bi_dir_data = topo_bi_dir.read() - topo_uni_dir_file = "sample_configs/NW-simple-topology.xml" + topo_uni_dir_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), + "..", "..", "sample_configs", "NW-simple-topology.xml") if os.path.isfile(topo_uni_dir_file): with open(topo_uni_dir_file, 'r') as topo_uni_dir: cls.simple_topo_uni_dir_data = topo_uni_dir.read() - topo_uni_dir_complex_file = "sample_configs/NW-for-test-5-4.xml" + topo_uni_dir_complex_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), + "..", "..", "sample_configs", "NW-for-test-5-4.xml") if os.path.isfile(topo_uni_dir_complex_file): 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() - print("starting opendaylight...") - 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)