fix topology files relative paths in PCE functest
[transportpce.git] / tests / transportpce_tests / 1.2.1 / test_renderer_service_path_nominal.py
index 37bbfabaa6e65a62e115ae3d241d79f56637dbfa..796de915cd76935701cec8b3ba9ed0255fa76a39 100644 (file)
@@ -24,8 +24,8 @@ import test_utils
 
 class TransportPCERendererTesting(unittest.TestCase):
 
-    honeynode_process1 = None
-    honeynode_process2 = None
+    sim_process1 = None
+    sim_process2 = None
     odl_process = None
     restconf_baseurl = "http://localhost:8181/restconf"
 
@@ -33,15 +33,12 @@ class TransportPCERendererTesting(unittest.TestCase):
 
     @classmethod
     def setUpClass(cls):
-        print("starting honeynode1...")
-        cls.honeynode_process1 = test_utils.start_xpdra_honeynode()
+        cls.sim_process1 = test_utils.start_sim('xpdra')
         time.sleep(20)
 
-        print("starting honeynode2...")
-        cls.honeynode_process2 = test_utils.start_roadma_honeynode()
+        cls.sim_process2 = test_utils.start_sim('roadma')
         time.sleep(20)
 
-        print("starting opendaylight...")
         cls.odl_process = test_utils.start_tpce()
         time.sleep(60)
         print("opendaylight started")
@@ -53,16 +50,16 @@ class TransportPCERendererTesting(unittest.TestCase):
             child.wait()
         cls.odl_process.send_signal(signal.SIGINT)
         cls.odl_process.wait()
-        for child in psutil.Process(cls.honeynode_process1.pid).children():
+        for child in psutil.Process(cls.sim_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():
+        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.honeynode_process2.send_signal(signal.SIGINT)
-        cls.honeynode_process2.wait()
+        cls.sim_process2.send_signal(signal.SIGINT)
+        cls.sim_process2.wait()
 
     def setUp(self):
         print("execution of {}".format(self.id().split(".")[-1]))
@@ -79,7 +76,7 @@ class TransportPCERendererTesting(unittest.TestCase):
             "netconf-node-topology:username": "admin",
             "netconf-node-topology:password": "admin",
             "netconf-node-topology:host": "127.0.0.1",
-            "netconf-node-topology:port": "17831",
+            "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'}
@@ -98,7 +95,7 @@ class TransportPCERendererTesting(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'}
@@ -181,10 +178,17 @@ class TransportPCERendererTesting(unittest.TestCase):
             "GET", url, headers=headers, auth=('admin', 'admin'))
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertDictContainsSubset({'name': 'DEG1-TTP-TXRX-7', 'administrative-state': 'inService',
-                                       'supporting-circuit-pack-name': '2/0',
-                                       'type': 'org-openroadm-interfaces:opticalChannel',
-                                       'supporting-port': 'L1'}, res['interface'][0])
+        # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+        self.assertDictEqual(
+            dict({
+                'name': 'DEG1-TTP-TXRX-7',
+                'administrative-state': 'inService',
+                'supporting-circuit-pack-name': '2/0',
+                'type': 'org-openroadm-interfaces:opticalChannel',
+                'supporting-port': 'L1'
+            }, **res['interface'][0]),
+            res['interface'][0]
+        )
         self.assertDictEqual(
             {'wavelength-number': 7},
             res['interface'][0]['org-openroadm-optical-channel-interfaces:och'])
@@ -199,12 +203,17 @@ class TransportPCERendererTesting(unittest.TestCase):
             "GET", url, headers=headers, auth=('admin', 'admin'))
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertDictContainsSubset(
-            {'name': 'SRG1-PP7-TXRX-7', 'administrative-state': 'inService',
-             'supporting-circuit-pack-name': '4/0',
-             'type': 'org-openroadm-interfaces:opticalChannel',
-             'supporting-port': 'C7'},
-            res['interface'][0])
+        # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+        self.assertDictEqual(
+            dict({
+                'name': 'SRG1-PP7-TXRX-7',
+                'administrative-state': 'inService',
+                'supporting-circuit-pack-name': '4/0',
+                'type': 'org-openroadm-interfaces:opticalChannel',
+                'supporting-port': 'C7'
+            }, **res['interface'][0]),
+            res['interface'][0]
+        )
         self.assertDictEqual(
             {'wavelength-number': 7},
             res['interface'][0]['org-openroadm-optical-channel-interfaces:och'])
@@ -219,11 +228,15 @@ class TransportPCERendererTesting(unittest.TestCase):
             "GET", url, headers=headers, auth=('admin', 'admin'))
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertDictContainsSubset(
-            {'connection-number': 'SRG1-PP7-TXRX-DEG1-TTP-TXRX-7',
-             'wavelength-number': 7,
-             'opticalControlMode': 'off'},
-            res['roadm-connections'][0])
+        # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+        self.assertDictEqual(
+            dict({
+                'connection-number': 'SRG1-PP7-TXRX-DEG1-TTP-TXRX-7',
+                'wavelength-number': 7,
+                'opticalControlMode': 'off'
+            }, **res['roadm-connections'][0]),
+            res['roadm-connections'][0]
+        )
         self.assertDictEqual(
             {'src-if': 'SRG1-PP7-TXRX-7'},
             res['roadm-connections'][0]['source'])
@@ -241,12 +254,17 @@ class TransportPCERendererTesting(unittest.TestCase):
             "GET", url, headers=headers, auth=('admin', 'admin'))
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertDictContainsSubset(
-            {'name': 'XPDR1-NETWORK1-7', 'administrative-state': 'inService',
-             'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
-             'type': 'org-openroadm-interfaces:opticalChannel',
-             'supporting-port': '1'},
-            res['interface'][0])
+        # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+        self.assertDictEqual(
+            dict({
+                'name': 'XPDR1-NETWORK1-7',
+                'administrative-state': 'inService',
+                'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
+                'type': 'org-openroadm-interfaces:opticalChannel',
+                'supporting-port': '1'
+            }, **res['interface'][0]),
+            res['interface'][0]
+        )
         self.assertDictEqual(
             {u'rate': u'org-openroadm-optical-channel-interfaces:R100G',
              u'transmit-power': -5,
@@ -264,13 +282,18 @@ class TransportPCERendererTesting(unittest.TestCase):
             "GET", url, headers=headers, auth=('admin', 'admin'))
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertDictContainsSubset(
-            {'name': 'XPDR1-NETWORK1-OTU', 'administrative-state': 'inService',
-             'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
-             'type': 'org-openroadm-interfaces:otnOtu',
-             'supporting-port': '1',
-             'supporting-interface': 'XPDR1-NETWORK1-7'},
-            res['interface'][0])
+        # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+        self.assertDictEqual(
+            dict({
+                'name': 'XPDR1-NETWORK1-OTU',
+                'administrative-state': 'inService',
+                'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
+                'type': 'org-openroadm-interfaces:otnOtu',
+                'supporting-port': '1',
+                'supporting-interface': 'XPDR1-NETWORK1-7'
+            }, **res['interface'][0]),
+            res['interface'][0]
+        )
         self.assertDictEqual(
             {u'rate': u'org-openroadm-otn-otu-interfaces:OTU4',
              u'fec': u'scfec'},
@@ -286,17 +309,25 @@ class TransportPCERendererTesting(unittest.TestCase):
             "GET", url, headers=headers, auth=('admin', 'admin'))
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertDictContainsSubset(
-            {'name': 'XPDR1-NETWORK1-ODU', 'administrative-state': 'inService',
-             'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
-             'type': 'org-openroadm-interfaces:otnOdu',
-             'supporting-port': '1',
-             'supporting-interface': 'XPDR1-NETWORK1-OTU'},
-            res['interface'][0])
-        self.assertDictContainsSubset(
-            {'rate': 'org-openroadm-otn-odu-interfaces:ODU4',
-             u'monitoring-mode': u'terminated'},
-            res['interface'][0]['org-openroadm-otn-odu-interfaces:odu'])
+        # the 2 following statements replace self.assertDictContainsSubset deprecated in python 3.2
+        self.assertDictEqual(
+            dict({
+                'name': 'XPDR1-NETWORK1-ODU',
+                'administrative-state': 'inService',
+                'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
+                'type': 'org-openroadm-interfaces:otnOdu',
+                'supporting-port': '1',
+                'supporting-interface': 'XPDR1-NETWORK1-OTU'
+            }, **res['interface'][0]),
+            res['interface'][0]
+        )
+        self.assertDictEqual(
+            dict({
+                'rate': 'org-openroadm-otn-odu-interfaces:ODU4',
+                u'monitoring-mode': u'terminated'
+            }, **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']),
+            res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']
+        )
         self.assertDictEqual({u'exp-payload-type': u'07', u'payload-type': u'07'},
                              res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu'])
 
@@ -310,12 +341,17 @@ class TransportPCERendererTesting(unittest.TestCase):
             "GET", url, headers=headers, auth=('admin', 'admin'))
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
-        self.assertDictContainsSubset(
-            {'name': 'XPDR1-CLIENT1-ETHERNET', 'administrative-state': 'inService',
-             'supporting-circuit-pack-name': '1/0/C1-PLUG-CLIENT',
-             'type': 'org-openroadm-interfaces:ethernetCsmacd',
-             'supporting-port': 'C1'},
-            res['interface'][0])
+        # the following statement replaces self.assertDictContainsSubset deprecated in python 3.2
+        self.assertDictEqual(
+            dict({
+                'name': 'XPDR1-CLIENT1-ETHERNET',
+                'administrative-state': 'inService',
+                'supporting-circuit-pack-name': '1/0/C1-PLUG-CLIENT',
+                'type': 'org-openroadm-interfaces:ethernetCsmacd',
+                'supporting-port': 'C1'
+            }, **res['interface'][0]),
+            res['interface'][0]
+        )
         self.assertDictEqual(
             {'speed': 100000,
              'mtu': 9000,