Align 1.2.1 tests sims/tpce management to 2.2.1 97/90497/3
authorguillaume.lambert <guillaume.lambert@orange.com>
Thu, 18 Jun 2020 10:43:04 +0000 (12:43 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Mon, 22 Jun 2020 08:11:01 +0000 (10:11 +0200)
- move 2.2.1 test_utils.py to a common folder
  to make it resuable in 1.2.1 tests
- create 2 simulators.py files with version specific parameters
  to import them in test_utils
- use symlinks to by pass python relative import beyond top-level issues
- adapt functional tests code accordingly

Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I81351ecc33a32bd7149bc9d16c4a8fa53bd4938c

24 files changed:
tests/transportpce_tests/1.2.1/common [new symlink]
tests/transportpce_tests/1.2.1/simulators.py [new file with mode: 0644]
tests/transportpce_tests/1.2.1/test_end2end.py
tests/transportpce_tests/1.2.1/test_gnpy.py
tests/transportpce_tests/1.2.1/test_olm.py
tests/transportpce_tests/1.2.1/test_pce.py
tests/transportpce_tests/1.2.1/test_portmapping.py
tests/transportpce_tests/1.2.1/test_renderer_service_path_nominal.py
tests/transportpce_tests/1.2.1/test_topoPortMapping.py
tests/transportpce_tests/1.2.1/test_topology.py
tests/transportpce_tests/1.2.1/test_utils.py [deleted file]
tests/transportpce_tests/2.2.1/common [new symlink]
tests/transportpce_tests/2.2.1/simulators.py [new file with mode: 0644]
tests/transportpce_tests/2.2.1/test_end2end.py
tests/transportpce_tests/2.2.1/test_olm.py
tests/transportpce_tests/2.2.1/test_otn_renderer.py
tests/transportpce_tests/2.2.1/test_otn_topology.py
tests/transportpce_tests/2.2.1/test_portmapping.py
tests/transportpce_tests/2.2.1/test_renderer_service_path_nominal.py
tests/transportpce_tests/2.2.1/test_tapi.py
tests/transportpce_tests/2.2.1/test_topoPortMapping.py
tests/transportpce_tests/2.2.1/test_topology.py
tests/transportpce_tests/common/simulators.py [new symlink]
tests/transportpce_tests/common/test_utils.py [moved from tests/transportpce_tests/2.2.1/test_utils.py with 88% similarity]

diff --git a/tests/transportpce_tests/1.2.1/common b/tests/transportpce_tests/1.2.1/common
new file mode 120000 (symlink)
index 0000000..8332399
--- /dev/null
@@ -0,0 +1 @@
+../common/
\ No newline at end of file
diff --git a/tests/transportpce_tests/1.2.1/simulators.py b/tests/transportpce_tests/1.2.1/simulators.py
new file mode 100644 (file)
index 0000000..a44c466
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+##############################################################################
+# Copyright (c) 2020 Orange, Inc. and others.  All rights reserved.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+import os
+
+sims = {
+    'xpdra': {'port': '17830', 'configfile': 'oper-XPDRA.xml', 'logfile': 'oper-XPDRA.log'},
+    'roadma': {'port': '17831', 'configfile': 'oper-ROADMA.xml', 'logfile': 'oper-ROADMA.log'},
+    'roadmb': {'port': '17832', 'configfile': 'oper-ROADMB.xml', 'logfile': 'oper-ROADMB.log'},
+    'roadmc': {'port': '17833', 'configfile': 'oper-ROADMC.xml', 'logfile': 'oper-ROADMC.log'},
+    'xpdrc': {'port': '17834', 'configfile': 'oper-XPDRC.xml', 'logfile': 'oper-XPDRC.log'},
+    'roadma-full': {'port': '17821', 'configfile': 'oper-ROADMA-full.xml', 'logfile': 'oper-ROADMA.log'},
+    'roadmc-full': {'port': '17823', 'configfile': 'oper-ROADMC-full.xml', 'logfile': 'oper-ROADMC.log'}
+}
+
+honeynode_executable = os.path.join(
+    os.path.dirname(os.path.realpath(__file__)),
+    "..", "..", "honeynode", "1.2.1", "honeynode-simulator", "honeycomb-tpce")
+samples_directory = os.path.join(
+    os.path.dirname(os.path.realpath(__file__)),
+    "..", "..", "sample_configs", "openroadm", "1.2.1")
index 3fad3d284b05c931c8cd5a0e18381c083212fa1f..5afdb0e1e11b0335c2800608c9862248a8953e90 100644 (file)
@@ -16,74 +16,31 @@ import unittest
 
 import psutil
 import requests
-import test_utils
+from common import test_utils
 
 
 class TransportPCEFulltesting(unittest.TestCase):
+
     headers = {'content-type': 'application/json'}
-    odl_process = None
-    sim_process1 = None
-    sim_process2 = None
-    sim_process3 = None
-    sim_process4 = None
-    restconf_baseurl = "http://localhost:8181/restconf"
     WAITING = 20  # nominal value is 300
 
-    #  START_IGNORE_XTESTING
+    processes = None
+    restconf_baseurl = "http://localhost:8181/restconf"
 
     @classmethod
     def setUpClass(cls):
-        cls.sim_process1 = test_utils.start_sim('xpdra')
-        time.sleep(20)
-
-        cls.sim_process2 = test_utils.start_sim('roadma-full')
-        time.sleep(20)
-
-        cls.sim_process3 = test_utils.start_sim('roadmc-full')
-        time.sleep(20)
-
-        cls.sim_process4 = test_utils.start_sim('xpdrc')
-        time.sleep(20)
-        print("all sims started")
-
-        cls.odl_process = test_utils.start_tpce()
-        time.sleep(80)
-        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.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 child in psutil.Process(cls.sim_process3.pid).children():
-            child.send_signal(signal.SIGINT)
-            child.wait()
-        cls.sim_process3.send_signal(signal.SIGINT)
-        cls.sim_process3.wait()
-        for child in psutil.Process(cls.sim_process4.pid).children():
-            child.send_signal(signal.SIGINT)
-            child.wait()
-        cls.sim_process4.send_signal(signal.SIGINT)
-        cls.sim_process4.wait()
+        for process in cls.processes:
+            test_utils.shutdown_process(process)
         print("all processes killed")
 
     def setUp(self):  # instruction executed before each test method
         print("execution of {}".format(self.id().split(".")[-1]))
 
-    # END_IGNORE_XTESTING
-
     #  connect netconf devices
     def test_01_connect_xpdrA(self):
         url = ("{}/config/network-topology:"
index 64a88194a9a9dc471a66f302e38ca1e8fe0db7d3..447e65f3174e005a74dbefd82804b874c7e464b0 100644 (file)
@@ -16,33 +16,28 @@ import requests
 import signal
 import time
 import unittest
-import test_utils
+from common import test_utils
 
 
 class TransportGNPYtesting(unittest.TestCase):
 
-    gnpy_process = None
-    odl_process = None
-    restconf_baseurl = "http://localhost:8181/restconf"
-
     @classmethod
     def __init_logfile(cls):
         if os.path.isfile("./transportpce_tests/gnpy.log"):
             os.remove("transportpce_tests/gnpy.log")
 
+    processes = None
+    restconf_baseurl = "http://localhost:8181/restconf"
+
     @classmethod
     def setUpClass(cls):
-        cls.odl_process = test_utils.start_tpce()
-        time.sleep(30)
-        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):
         time.sleep(2)
index 956305635bd953d20100334508fe4c2be2a75353..7d4a7698a9e4d1058f4db0978b761ed7e0ac5950 100644 (file)
@@ -19,73 +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):
 
-    sim_process1 = None
-    sim_process2 = None
-    sim_process3 = None
-    sim_process4 = 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-full')
-        time.sleep(20)
-
-        cls.sim_process3 = test_utils.start_sim('roadmc-full')
-        time.sleep(20)
-
-        cls.sim_process4 = test_utils.start_sim('xpdrc')
-        time.sleep(20)
-        print("all sims started")
-
-        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.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 child in psutil.Process(cls.sim_process3.pid).children():
-            child.send_signal(signal.SIGINT)
-            child.wait()
-        cls.sim_process3.send_signal(signal.SIGINT)
-        cls.sim_process3.wait()
-        for child in psutil.Process(cls.sim_process4.pid).children():
-            child.send_signal(signal.SIGINT)
-            child.wait()
-        cls.sim_process4.send_signal(signal.SIGINT)
-        cls.sim_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"
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)
index bf42eb9d509ee41eed8b4353538cf000b20d25eb..d9f91e48b6b005eaef1172943e4b7af38a5a512e 100644 (file)
@@ -15,54 +15,29 @@ import unittest
 import time
 import requests
 import psutil
-import test_utils
+from common import test_utils
 
 
 class TransportPCEPortMappingTesting(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_restconfAPI(self):
 #        url = ("{}/operational/network-topology:network-topology/topology/"
 #        "topology-netconf/node/controller-config".format(self.restconf_baseurl))
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"
index ab46c0df96422ef4916b648b322a8d0414a0fdfc..2a41e52f8d9b51ba714ac92bd7c0c58bf443bddb 100644 (file)
@@ -15,53 +15,28 @@ import time
 import unittest
 import requests
 import psutil
-import test_utils
+from common import test_utils
 
 
 class TransportPCEtesting(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):
         time.sleep(10)
 
-# END_IGNORE_XTESTING
-
     # Connect the ROADMA
     def test_01_connect_rdm(self):
         # Config ROADMA
index bade42ccf1bbe56d2663a21d7d2cdb010011cf74..bb3867ac354855e27193d3423537d28b458a0259 100644 (file)
@@ -15,74 +15,28 @@ import time
 import unittest
 import requests
 import psutil
-import test_utils
+from common import test_utils
 
 
 class TransportPCETopologyTesting(unittest.TestCase):
 
-    sim_process1 = None
-    sim_process2 = None
-    sim_process3 = None
-    sim_process4 = 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.sim_process3 = test_utils.start_sim('roadmb')
-        time.sleep(20)
-
-        cls.sim_process4 = test_utils.start_sim('roadmc')
-        time.sleep(20)
-        print("all sims started")
-
-        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', 'roadmb', 'roadmc'])
 
     @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 child in psutil.Process(cls.sim_process3.pid).children():
-            child.send_signal(signal.SIGINT)
-            child.wait()
-        cls.sim_process3.send_signal(signal.SIGINT)
-        cls.sim_process3.wait()
-
-        for child in psutil.Process(cls.sim_process4.pid).children():
-            child.send_signal(signal.SIGINT)
-            child.wait()
-        cls.sim_process4.send_signal(signal.SIGINT)
-        cls.sim_process4.wait()
+        for process in cls.processes:
+            test_utils.shutdown_process(process)
+        print("all processes killed")
 
     def setUp(self):
         time.sleep(5)
 
-# END_IGNORE_XTESTING
-
     def test_01_connect_ROADMA(self):
         # Config ROADMA
         url = ("{}/config/network-topology:"
diff --git a/tests/transportpce_tests/1.2.1/test_utils.py b/tests/transportpce_tests/1.2.1/test_utils.py
deleted file mode 100644 (file)
index 99a5102..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-##############################################################################
-# Copyright (c) 2020 Orange, Inc. and others.  All rights reserved.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-import os
-import subprocess
-
-sims = {
-    'xpdra': {'port': '17830', 'configfile': 'oper-XPDRA.xml'},
-    'roadma': {'port': '17831', 'configfile': 'oper-ROADMA.xml'},
-    'roadmb': {'port': '17832', 'configfile': 'oper-ROADMB.xml'},
-    'roadmc': {'port': '17833', 'configfile': 'oper-ROADMC.xml'},
-    'xpdrc': {'port': '17834', 'configfile': 'oper-XPDRC.xml'},
-    'roadma-full': {'port': '17821', 'configfile': 'oper-ROADMA-full.xml'},
-    'roadmc-full': {'port': '17823', 'configfile': 'oper-ROADMC-full.xml'}
-}
-
-honeynode_executable = os.path.join(
-    os.path.dirname(os.path.realpath(__file__)),
-    "..", "..", "honeynode", "1.2.1", "honeynode-simulator", "honeycomb-tpce")
-samples_directory = os.path.join(
-    os.path.dirname(os.path.realpath(__file__)),
-    "..", "..", "sample_configs", "openroadm", "1.2.1")
-
-
-def start_sim(sim):
-    print("starting simulator for " + sim + "...")
-    if os.path.isfile(honeynode_executable):
-        with open(sim+'.log', 'w') as outfile:
-            return subprocess.Popen(
-                [honeynode_executable, sims[sim]['port'], os.path.join(samples_directory, sims[sim]['configfile'])],
-                stdout=outfile, stderr=outfile)
-
-
-def start_tpce():
-    print("starting opendaylight...")
-    if "USE_LIGHTY" in os.environ and os.environ['USE_LIGHTY'] == 'True':
-        print("starting LIGHTY.IO TransportPCE build...")
-        executable = os.path.join(
-            os.path.dirname(os.path.realpath(__file__)),
-            "..", "..", "..", "lighty", "target", "tpce",
-            "clean-start-controller.sh")
-        with open('odl.log', 'w') as outfile:
-            return subprocess.Popen(
-                ["sh", executable], stdout=outfile, stderr=outfile, stdin=None)
-    else:
-        print("starting KARAF TransportPCE build...")
-        executable = os.path.join(
-            os.path.dirname(os.path.realpath(__file__)),
-            "..", "..", "..", "karaf", "target", "assembly", "bin", "karaf")
-        with open('odl.log', 'w') as outfile:
-            return subprocess.Popen(
-                ["sh", executable, "server"], stdout=outfile, stderr=outfile, stdin=None)
diff --git a/tests/transportpce_tests/2.2.1/common b/tests/transportpce_tests/2.2.1/common
new file mode 120000 (symlink)
index 0000000..8332399
--- /dev/null
@@ -0,0 +1 @@
+../common/
\ No newline at end of file
diff --git a/tests/transportpce_tests/2.2.1/simulators.py b/tests/transportpce_tests/2.2.1/simulators.py
new file mode 100644 (file)
index 0000000..8892226
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+##############################################################################
+# Copyright (c) 2020 Orange, Inc. and others.  All rights reserved.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import os
+
+sims = {
+    'xpdra': {'port': '17840', 'configfile': 'oper-XPDRA.xml', 'logfile': 'oper-XPDRA.log'},
+    'roadma': {'port': '17841', 'configfile': 'oper-ROADMA.xml', 'logfile': 'oper-ROADMA.log'},
+    'roadmb': {'port': '17842', 'configfile': 'oper-ROADMB.xml', 'logfile': 'oper-ROADMB.log'},
+    'roadmc': {'port': '17843', 'configfile': 'oper-ROADMC.xml', 'logfile': 'oper-ROADMC.log'},
+    'xpdrc': {'port': '17844', 'configfile': 'oper-XPDRC.xml', 'logfile': 'oper-XPDRC.log'},
+    'spdrav2': {'port': '17845', 'configfile': 'oper-SPDRAv2.xml', 'logfile': 'oper-SPDRAv2.log'},
+    'spdrav1': {'port': '17846', 'configfile': 'oper-SPDRAv1.xml', 'logfile': 'oper-SPDRAv1.log'}
+}
+
+honeynode_executable = os.path.join(
+    os.path.dirname(os.path.realpath(__file__)),
+    "..", "..", "honeynode", "2.2.1", "honeynode-simulator", "honeycomb-tpce")
+samples_directory = os.path.join(
+    os.path.dirname(os.path.realpath(__file__)),
+    "..", "..", "sample_configs", "openroadm", "2.2.1")
index 8e33de6aac192c59d80178feeefaf31cea286ef2..755d0c668bb9289214544bd7e323f6f6bc7ba20a 100644 (file)
@@ -18,7 +18,7 @@ import shutil
 import subprocess
 import time
 import unittest
-import test_utils
+from common import test_utils
 
 
 class TransportPCEFulltesting(unittest.TestCase):
index d96b302aa42288f1f4c77044cf5cb7a31f29abc8..09b5e2ed39b7ecbe528bf4d398410fb0b9b450df 100644 (file)
@@ -19,7 +19,7 @@ import os
 import psutil
 import shutil
 from unittest.result import failfast
-import test_utils
+from common import test_utils
 
 
 class TransportOlmTesting(unittest.TestCase):
index f1a617365ec1ef0d53c9606216481a64a48d77bb..04f09c6d11e6de9cd1d0a11504363b86bd6cccc0 100644 (file)
@@ -19,7 +19,7 @@ import subprocess
 import time
 import unittest
 import logging
-import test_utils
+from common import test_utils
 
 
 def extract_a_from_b(a, b):
index 8fa8b8b8745789139ef24fb1d10d58a6c81bd9ac..89a2eef03d9c298ec0e1f64e718df49b1b852a96 100644 (file)
@@ -19,7 +19,7 @@ import subprocess
 import time
 import unittest
 import logging
-import test_utils
+from common import test_utils
 
 
 class TransportPCEtesting(unittest.TestCase):
index f532c4e231f10e64b20a93a2400554a1070a4195..14edf70964861d5295cf3ac85de415363e537c24 100644 (file)
@@ -18,7 +18,7 @@ import shutil
 import subprocess
 import time
 import unittest
-import test_utils
+from common import test_utils
 
 
 class TransportPCEPortMappingTesting(unittest.TestCase):
index 213530692198248339403e92d6122ca5c800b5d6..c5c7ec2295cd1f1d43b6acac9d30eb0cb1c38985 100644 (file)
@@ -19,7 +19,7 @@ import os
 import psutil
 import shutil
 from unittest.result import failfast
-import test_utils
+from common import test_utils
 
 
 class TransportPCERendererTesting(unittest.TestCase):
index 6f7eb37a6c7ccc0eec4bfe3a6f7111af39121486..718b7404b711deb7c3a71e428d1f0348a05617c7 100644 (file)
@@ -14,7 +14,7 @@ import unittest
 
 import requests
 
-import test_utils
+from common import test_utils
 
 RESTCONF_BASE_URL = "http://localhost:8181/restconf"
 
index b88f199916b248f83efda0bd7c3af4bb1001bf40..f6285bafb527b5a9cadd346924845d92e2a5db48 100644 (file)
@@ -19,7 +19,7 @@ import subprocess
 import time
 import unittest
 import logging
-import test_utils
+from common import test_utils
 
 
 class TransportPCEtesting(unittest.TestCase):
index 54c172e87e5248988df5db091c2c1b4591c56466..c531cb25fc4f523247660b55777e1de6218440e0 100644 (file)
@@ -19,7 +19,7 @@ import subprocess
 import time
 import unittest
 import logging
-import test_utils
+from common import test_utils
 
 
 class TransportPCEtesting(unittest.TestCase):
diff --git a/tests/transportpce_tests/common/simulators.py b/tests/transportpce_tests/common/simulators.py
new file mode 120000 (symlink)
index 0000000..18d5fb8
--- /dev/null
@@ -0,0 +1 @@
+../simulators.py
\ No newline at end of file
similarity index 88%
rename from tests/transportpce_tests/2.2.1/test_utils.py
rename to tests/transportpce_tests/common/test_utils.py
index 5402eae5b4610b236cb8de6a77e90a8932e1cc6c..b94c9de012a13a3298fb685af5d89179c8bd4376 100644 (file)
@@ -16,15 +16,11 @@ import subprocess
 import psutil
 import requests
 
-sims = {
-    'xpdra': {'port': '17840', 'configfile': 'oper-XPDRA.xml', 'logfile': 'oper-XPDRA.log'},
-    'roadma': {'port': '17841', 'configfile': 'oper-ROADMA.xml', 'logfile': 'oper-ROADMA.log'},
-    'roadmb': {'port': '17842', 'configfile': 'oper-ROADMB.xml', 'logfile': 'oper-ROADMB.log'},
-    'roadmc': {'port': '17843', 'configfile': 'oper-ROADMC.xml', 'logfile': 'oper-ROADMC.log'},
-    'xpdrc': {'port': '17844', 'configfile': 'oper-XPDRC.xml', 'logfile': 'oper-XPDRC.log'},
-    'spdrav2': {'port': '17845', 'configfile': 'oper-SPDRAv2.xml', 'logfile': 'oper-SPDRAv2.log'},
-    'spdrav1': {'port': '17846', 'configfile': 'oper-SPDRAv1.xml', 'logfile': 'oper-SPDRAv1.log'}
-}
+import simulators
+
+sims = simulators.sims
+honeynode_executable = simulators.honeynode_executable
+samples_directory = simulators.samples_directory
 
 HONEYNODE_OK_START_MSG = re.escape("Netconf SSH endpoint started successfully at 0.0.0.0")
 KARAF_OK_START_MSG = re.escape("Blueprint container for bundle "
@@ -32,14 +28,6 @@ KARAF_OK_START_MSG = re.escape("Blueprint container for bundle "
 
 TYPE_APPLICATION_JSON = {'content-type': 'application/json'}
 
-honeynode_executable = os.path.join(
-    os.path.dirname(os.path.realpath(__file__)),
-    "..", "..", "honeynode", "2.2.1", "honeynode-simulator", "honeycomb-tpce")
-
-samples_directory = os.path.join(
-    os.path.dirname(os.path.realpath(__file__)),
-    "..", "..", "sample_configs", "openroadm", "2.2.1")
-
 log_directory = os.path.dirname(os.path.realpath(__file__))
 
 karaf_log = os.path.join(
@@ -48,6 +36,7 @@ karaf_log = os.path.join(
 
 process_list = []
 
+
 def start_sims(sims_list):
     for sim in sims_list:
         print("starting simulator for " + sim + "...")