review sims/tpce process management in 2.2.1 tests
[transportpce.git] / tests / transportpce_tests / 2.2.1 / test_portmapping.py
index 034da46781ad91701a62164efb2b480c265538cd..f532c4e231f10e64b20a93a2400554a1070a4195 100644 (file)
@@ -23,44 +23,19 @@ import test_utils
 
 class TransportPCEPortMappingTesting(unittest.TestCase):
 
-    honeynode_process1 = None
-    honeynode_process2 = None
-    odl_process = None
+    processes = None
     restconf_baseurl = "http://localhost:8181/restconf"
 
     @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_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'])
 
     @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 process in cls.processes:
+            test_utils.shutdown_process(process)
+        print("all processes killed")
 
     def setUp(self):
         print("execution of {}".format(self.id().split(".")[-1]))
@@ -75,7 +50,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
             "netconf-node-topology:username": "admin",
             "netconf-node-topology:password": "admin",
             "netconf-node-topology:host": "127.0.0.1",
-            "netconf-node-topology:port": "17841",
+            "netconf-node-topology:port": test_utils.sims['roadma']['port'],
             "netconf-node-topology:tcp-only": "false",
             "netconf-node-topology:pass-through": {}}]}
         headers = {'content-type': 'application/json'}
@@ -184,7 +159,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
             "netconf-node-topology:username": "admin",
             "netconf-node-topology:password": "admin",
             "netconf-node-topology:host": "127.0.0.1",
-            "netconf-node-topology:port": "17840",
+            "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'}
@@ -239,7 +214,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
             {'supported-interface-capability': ['org-openroadm-port-types:if-OCH'],
              'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
              'logical-connection-point': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-network',
-             'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-CLIENT1'},
+             'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-CLIENT1',
+             'lcp-hash-val': '8e128ba57560403cfd4ffafae38cd941'},
             res['mapping'])
 
     def test_12_xpdr_portmapping_NETWORK2(self):
@@ -255,7 +231,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
             {'supported-interface-capability': ['org-openroadm-port-types:if-OCH'],
              'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/2-PLUG-NET',
              'logical-connection-point': 'XPDR1-NETWORK2', 'port-direction': 'bidirectional',
-             'connection-map-lcp': 'XPDR1-CLIENT2', 'port-qual': 'xpdr-network'},
+             'connection-map-lcp': 'XPDR1-CLIENT2', 'port-qual': 'xpdr-network',
+             'lcp-hash-val': '8e128ba57560403cfd4ffafae38cd942'},
             res['mapping'])
 
     def test_13_xpdr_portmapping_CLIENT1(self):
@@ -272,7 +249,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
              'supporting-port': 'C1',
              'supporting-circuit-pack-name': '1/0/1-PLUG-CLIENT',
              'logical-connection-point': 'XPDR1-CLIENT1', 'port-direction': 'bidirectional',
-             'connection-map-lcp': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-client'},
+             'connection-map-lcp': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-client',
+             'lcp-hash-val': '3ed8ed1336784ac7c2f66c22f2f03d8'},
             res['mapping'])
 
     def test_14_xpdr_portmapping_CLIENT2(self):
@@ -289,7 +267,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
              'supporting-port': 'C1',
              'supporting-circuit-pack-name': '1/0/2-PLUG-CLIENT',
              'logical-connection-point': 'XPDR1-CLIENT2', 'port-direction': 'bidirectional',
-             'connection-map-lcp': 'XPDR1-NETWORK2', 'port-qual': 'xpdr-client'},
+             'connection-map-lcp': 'XPDR1-NETWORK2', 'port-qual': 'xpdr-client',
+             'lcp-hash-val': '3ed8ed1336784ac7c2f66c22f2f03db'},
             res['mapping'])
 
     def test_15_xpdr_device_disconnected(self):