X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Ftransportpce_tests%2F1.2.1%2Ftest_olm.py;h=7d4a7698a9e4d1058f4db0978b761ed7e0ac5950;hb=f4d7679be9ffcc5ef14241cbfe9040c1c177b260;hp=a6059ecb3891e0602007f7ace924d0d83f178480;hpb=0b7d7035d3affa2b9fc85d85d7c0b916e29ab799;p=transportpce.git diff --git a/tests/transportpce_tests/1.2.1/test_olm.py b/tests/transportpce_tests/1.2.1/test_olm.py index a6059ecb3..7d4a7698a 100644 --- a/tests/transportpce_tests/1.2.1/test_olm.py +++ b/tests/transportpce_tests/1.2.1/test_olm.py @@ -19,78 +19,29 @@ import os import psutil import shutil from unittest.result import failfast -import test_utils +from common import test_utils class TransportOlmTesting(unittest.TestCase): - honeynode_process1 = None - honeynode_process2 = None - honeynode_process3 = None - honeynode_process4 = None - odl_process = None + processes = None restconf_baseurl = "http://localhost:8181/restconf" -# START_IGNORE_XTESTING - @classmethod def setUpClass(cls): - print("starting honeynode1...") - cls.honeynode_process1 = test_utils.start_xpdra_honeynode() - time.sleep(20) - - print("starting honeynode2...") - cls.honeynode_process2 = test_utils.start_roadma_full_honeynode() - time.sleep(20) - - print("starting honeynode3...") - cls.honeynode_process3 = test_utils.start_roadmc_full_honeynode() - time.sleep(20) - - print("starting honeynode4...") - cls.honeynode_process4 = test_utils.start_xpdrc_honeynode() - time.sleep(20) - print("all honeynodes started") - - print("starting opendaylight...") - 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-full', 'roadmc-full', 'xpdrc']) @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.honeynode_process1.pid).children(): - child.send_signal(signal.SIGINT) - child.wait() - cls.honeynode_process1.send_signal(signal.SIGINT) - cls.honeynode_process1.wait() - for child in psutil.Process(cls.honeynode_process2.pid).children(): - child.send_signal(signal.SIGINT) - child.wait() - cls.honeynode_process2.send_signal(signal.SIGINT) - cls.honeynode_process2.wait() - for child in psutil.Process(cls.honeynode_process3.pid).children(): - child.send_signal(signal.SIGINT) - child.wait() - cls.honeynode_process3.send_signal(signal.SIGINT) - cls.honeynode_process3.wait() - for child in psutil.Process(cls.honeynode_process4.pid).children(): - child.send_signal(signal.SIGINT) - child.wait() - cls.honeynode_process4.send_signal(signal.SIGINT) - cls.honeynode_process4.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(1) -# END_IGNORE_XTESTING - def test_01_xpdrA_device_connected(self): url = ("{}/config/network-topology:" "network-topology/topology/topology-netconf/node/XPDRA01" @@ -100,7 +51,7 @@ class TransportOlmTesting(unittest.TestCase): "netconf-node-topology:username": "admin", "netconf-node-topology:password": "admin", "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17830", + "netconf-node-topology:port": test_utils.sims['xpdra']['port'], "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} @@ -119,7 +70,7 @@ class TransportOlmTesting(unittest.TestCase): "netconf-node-topology:username": "admin", "netconf-node-topology:password": "admin", "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17834", + "netconf-node-topology:port": test_utils.sims['xpdrc']['port'], "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} @@ -138,7 +89,7 @@ class TransportOlmTesting(unittest.TestCase): "netconf-node-topology:username": "admin", "netconf-node-topology:password": "admin", "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17821", + "netconf-node-topology:port": test_utils.sims['roadma-full']['port'], "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'} @@ -157,7 +108,7 @@ class TransportOlmTesting(unittest.TestCase): "netconf-node-topology:username": "admin", "netconf-node-topology:password": "admin", "netconf-node-topology:host": "127.0.0.1", - "netconf-node-topology:port": "17823", + "netconf-node-topology:port": test_utils.sims['roadmc-full']['port'], "netconf-node-topology:tcp-only": "false", "netconf-node-topology:pass-through": {}}]} headers = {'content-type': 'application/json'}