TAPI connectivity upgrade
[transportpce.git] / tests / transportpce_tests / 2.2.1 / test11_otn_end2end.py
index d62719b485d087b1d65dcaeedb478ede743b8e3c..58b5ad40fff99940e6dbda9b5612a575888b6892 100644 (file)
 
 # pylint: disable=no-member
 # pylint: disable=too-many-public-methods
+# pylint: disable=too-many-lines
 
 import base64
 import unittest
 import time
 import requests
+# pylint: disable=wrong-import-order
 import sys
 sys.path.append('transportpce_tests/common/')
+# pylint: disable=wrong-import-position
+# pylint: disable=import-error
 import test_utils  # nopep8
 
 
@@ -282,8 +286,8 @@ class TransportPCEtesting(unittest.TestCase):
                              res['interface'][0])
 
         self.assertDictEqual(
-            {u'frequency': 196.1, u'rate': u'org-openroadm-common-types:R100G',
-             u'transmit-power': -5, u'modulation-format': 'dp-qpsk'},
+            {'frequency': 196.1, 'rate': 'org-openroadm-common-types:R100G',
+             'transmit-power': -5, 'modulation-format': 'dp-qpsk'},
             res['interface'][0]['org-openroadm-optical-channel-interfaces:och'])
 
     def test_15_check_interface_OTU4_spdra(self):
@@ -298,8 +302,10 @@ class TransportPCEtesting(unittest.TestCase):
                         'type': 'org-openroadm-interfaces:otnOtu',
                         'supporting-port': 'CP1-CFP0-P1'
                         }
-        input_dict_2 = {'tx-sapi': 'Swfw02qXGyI=',
-                        'expected-dapi': 'Swfw02qXGyI=',
+        input_dict_2 = {'tx-sapi': 'H/OelLynehI=',
+                        'expected-dapi': 'H/OelLynehI=',
+                        'tx-dapi': 'AMf1n5hK6Xkk',
+                        'expected-sapi': 'AMf1n5hK6Xkk',
                         'rate': 'org-openroadm-otn-common-types:OTU4',
                         'fec': 'scfec'
                         }
@@ -324,8 +330,8 @@ class TransportPCEtesting(unittest.TestCase):
                              res['interface'][0])
 
         self.assertDictEqual(
-            {u'frequency': 196.1, u'rate': u'org-openroadm-common-types:R100G',
-             u'transmit-power': -5, u'modulation-format': 'dp-qpsk'},
+            {'frequency': 196.1, 'rate': 'org-openroadm-common-types:R100G',
+             'transmit-power': -5, 'modulation-format': 'dp-qpsk'},
             res['interface'][0]['org-openroadm-optical-channel-interfaces:och'])
 
     def test_17_check_interface_OTU4_spdrc(self):
@@ -340,10 +346,10 @@ class TransportPCEtesting(unittest.TestCase):
                         'type': 'org-openroadm-interfaces:otnOtu',
                         'supporting-port': 'CP1-CFP0-P1'
                         }
-        input_dict_2 = {'tx-dapi': 'Swfw02qXGyI=',
-                        'expected-sapi': 'Swfw02qXGyI=',
-                        'tx-sapi': 'fuYZwEO660g=',
-                        'expected-dapi': 'fuYZwEO660g=',
+        input_dict_2 = {'tx-dapi': 'H/OelLynehI=',
+                        'expected-sapi': 'H/OelLynehI=',
+                        'tx-sapi': 'AMf1n5hK6Xkk',
+                        'expected-dapi': 'AMf1n5hK6Xkk',
                         'rate': 'org-openroadm-otn-common-types:OTU4',
                         'fec': 'scfec'
                         }
@@ -371,8 +377,8 @@ class TransportPCEtesting(unittest.TestCase):
         res = response.json()
         ele = res['node'][0]['ietf-network-topology:termination-point'][0]
         self.assertEqual('XPDR1-NETWORK1', ele['tp-id'])
-        self.assertEqual({u'frequency': 196.1,
-                          u'width': 40},
+        self.assertEqual({'frequency': 196.1,
+                          'width': 40},
                          ele['org-openroadm-network-topology:xpdr-network-attributes']['wavelength'])
         time.sleep(3)
 
@@ -480,14 +486,17 @@ class TransportPCEtesting(unittest.TestCase):
                         'supporting-circuit-pack-name': 'CP1-CFP0',
                         'supporting-interface': 'XPDR1-NETWORK1-OTU',
                         'type': 'org-openroadm-interfaces:otnOdu',
-                        'supporting-port': 'CP1-CFP0-P1'}
+                        'supporting-port': 'CP1-CFP0-P1',
+                        'circuit-id': 'TBD',
+                        'description': 'TBD'}
         # SAPI/DAPI are added in the Otu4 renderer
         input_dict_2 = {'odu-function': 'org-openroadm-otn-common-types:ODU-TTP',
                         'rate': 'org-openroadm-otn-common-types:ODU4',
-                        'expected-dapi': 'Swfw02qXGyI=',
-                        'expected-sapi': 'fuYZwEO660g=',
-                        'tx-dapi': 'fuYZwEO660g=',
-                        'tx-sapi': 'Swfw02qXGyI='}
+                        'monitoring-mode': 'terminated',
+                        'expected-dapi': 'H/OelLynehI=',
+                        'expected-sapi': 'AMf1n5hK6Xkk',
+                        'tx-dapi': 'AMf1n5hK6Xkk',
+                        'tx-sapi': 'H/OelLynehI='}
 
         self.assertDictEqual(dict(input_dict_1, **res['interface'][0]),
                              res['interface'][0])
@@ -496,7 +505,7 @@ class TransportPCEtesting(unittest.TestCase):
                              res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']
                              )
         self.assertDictEqual(
-            {u'payload-type': u'21', u'exp-payload-type': u'21'},
+            {'payload-type': '21', 'exp-payload-type': '21'},
             res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu'])
 
     def test_26_check_interface_ODU4_spdrc(self):
@@ -509,14 +518,17 @@ class TransportPCEtesting(unittest.TestCase):
                         'supporting-circuit-pack-name': 'CP1-CFP0',
                         'supporting-interface': 'XPDR1-NETWORK1-OTU',
                         'type': 'org-openroadm-interfaces:otnOdu',
-                        'supporting-port': 'CP1-CFP0-P1'}
+                        'supporting-port': 'CP1-CFP0-P1',
+                        'circuit-id': 'TBD',
+                        'description': 'TBD'}
         # SAPI/DAPI are added in the Otu4 renderer
         input_dict_2 = {'odu-function': 'org-openroadm-otn-common-types:ODU-TTP',
                         'rate': 'org-openroadm-otn-common-types:ODU4',
-                        'tx-sapi': 'fuYZwEO660g=',
-                        'tx-dapi': 'Swfw02qXGyI=',
-                        'expected-sapi': 'Swfw02qXGyI=',
-                        'expected-dapi': 'fuYZwEO660g='
+                        'monitoring-mode': 'terminated',
+                        'tx-sapi': 'AMf1n5hK6Xkk',
+                        'tx-dapi': 'H/OelLynehI=',
+                        'expected-sapi': 'H/OelLynehI=',
+                        'expected-dapi': 'AMf1n5hK6Xkk'
                         }
         self.assertDictEqual(dict(input_dict_1, **res['interface'][0]),
                              res['interface'][0])
@@ -525,7 +537,7 @@ class TransportPCEtesting(unittest.TestCase):
                              res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']
                              )
         self.assertDictEqual(
-            {u'payload-type': u'21', u'exp-payload-type': u'21'},
+            {'payload-type': '21', 'exp-payload-type': '21'},
             res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu'])
 
     def test_27_check_otn_topo_links(self):
@@ -562,7 +574,7 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.get_otn_topo_request()
         res = response.json()
         for node in res['network'][0]['node']:
-            if node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1':
+            if node['node-id'] in ('SPDR-SA1-XPDR1', 'SPDR-SC1-XPDR1'):
                 tpList = node['ietf-network-topology:termination-point']
                 for tp in tpList:
                     if tp['tp-id'] == 'XPDR1-NETWORK1':
@@ -623,7 +635,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertDictEqual(dict(input_dict, **res['interface'][0]),
                              res['interface'][0])
         self.assertDictEqual(
-            {u'speed': 10000},
+            {'speed': 10000},
             res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet'])
 
     def test_32_check_interface_ODU2E_CLIENT_spdra(self):
@@ -648,7 +660,7 @@ class TransportPCEtesting(unittest.TestCase):
                                   **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']),
                              res['interface'][0]['org-openroadm-otn-odu-interfaces:odu'])
         self.assertDictEqual(
-            {u'payload-type': u'03', u'exp-payload-type': u'03'},
+            {'payload-type': '03', 'exp-payload-type': '03'},
             res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu'])
 
     def test_33_check_interface_ODU2E_NETWORK_spdra(self):
@@ -694,9 +706,9 @@ class TransportPCEtesting(unittest.TestCase):
 
         self.assertDictEqual(dict(input_dict_1, **res['odu-connection'][0]),
                              res['odu-connection'][0])
-        self.assertDictEqual({u'dst-if': u'XPDR1-NETWORK1-ODU2e-service1-10GE'},
+        self.assertDictEqual({'dst-if': 'XPDR1-NETWORK1-ODU2e-service1-10GE'},
                              res['odu-connection'][0]['destination'])
-        self.assertDictEqual({u'src-if': u'XPDR1-CLIENT1-ODU2e-service1-10GE'},
+        self.assertDictEqual({'src-if': 'XPDR1-CLIENT1-ODU2e-service1-10GE'},
                              res['odu-connection'][0]['source'])
 
     def test_35_check_interface_10GE_CLIENT_spdrc(self):
@@ -713,7 +725,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertDictEqual(dict(input_dict, **res['interface'][0]),
                              res['interface'][0])
         self.assertDictEqual(
-            {u'speed': 10000},
+            {'speed': 10000},
             res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet'])
 
     def test_36_check_interface_ODU2E_CLIENT_spdrc(self):
@@ -738,7 +750,7 @@ class TransportPCEtesting(unittest.TestCase):
                                   **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']),
                              res['interface'][0]['org-openroadm-otn-odu-interfaces:odu'])
         self.assertDictEqual(
-            {u'payload-type': u'03', u'exp-payload-type': u'03'},
+            {'payload-type': '03', 'exp-payload-type': '03'},
             res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu'])
 
     def test_37_check_interface_ODU2E_NETWORK_spdrc(self):
@@ -788,9 +800,9 @@ class TransportPCEtesting(unittest.TestCase):
 
         self.assertDictEqual(dict(input_dict_1, **res['odu-connection'][0]),
                              res['odu-connection'][0])
-        self.assertDictEqual({u'dst-if': u'XPDR1-NETWORK1-ODU2e-service1-10GE'},
+        self.assertDictEqual({'dst-if': 'XPDR1-NETWORK1-ODU2e-service1-10GE'},
                              res['odu-connection'][0]['destination'])
-        self.assertDictEqual({u'src-if': u'XPDR1-CLIENT1-ODU2e-service1-10GE'},
+        self.assertDictEqual({'src-if': 'XPDR1-CLIENT1-ODU2e-service1-10GE'},
                              res['odu-connection'][0]['source'])
 
     def test_39_check_otn_topo_links(self):
@@ -812,7 +824,7 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.get_otn_topo_request()
         res = response.json()
         for node in res['network'][0]['node']:
-            if node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1':
+            if node['node-id'] in ('SPDR-SA1-XPDR1', 'SPDR-SC1-XPDR1'):
                 tpList = node['ietf-network-topology:termination-point']
                 for tp in tpList:
                     if tp['tp-id'] == 'XPDR1-NETWORK1':
@@ -882,7 +894,7 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.get_otn_topo_request()
         res = response.json()
         for node in res['network'][0]['node']:
-            if (node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1'):
+            if node['node-id'] in ('SPDR-SA1-XPDR1', 'SPDR-SC1-XPDR1'):
                 tpList = node['ietf-network-topology:termination-point']
                 for tp in tpList:
                     if tp['tp-id'] == 'XPDR1-NETWORK1':
@@ -918,7 +930,7 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.get_otn_topo_request()
         res = response.json()
         for node in res['network'][0]['node']:
-            if node['node-id'] == 'SPDR-SA1-XPDR1' or 'SPDR-SC1-XPDR1':
+            if node['node-id'] in ('SPDR-SA1-XPDR1', 'SPDR-SC1-XPDR1'):
                 tpList = node['ietf-network-topology:termination-point']
                 for tp in tpList:
                     if tp['tp-id'] == 'XPDR1-NETWORK1':
@@ -968,7 +980,7 @@ class TransportPCEtesting(unittest.TestCase):
         tp = res['node'][0]['ietf-network-topology:termination-point'][0]
         self.assertEqual('XPDR1-NETWORK1', tp['tp-id'])
         self.assertNotIn('wavelength', dict.keys(
-            tp[u'org-openroadm-network-topology:xpdr-network-attributes']))
+            tp['org-openroadm-network-topology:xpdr-network-attributes']))
         time.sleep(3)
 
     def test_60_check_openroadm_topo_ROADMA_SRG(self):
@@ -1047,6 +1059,7 @@ class TransportPCEtesting(unittest.TestCase):
         time.sleep(2)
 
     def test_66_create_OCH_OTU4_service_2(self):
+        # pylint: disable=line-too-long
         self.cr_serv_sample_data["input"]["service-name"] = "service2-OCH-OTU4"
         self.cr_serv_sample_data["input"]["connection-type"] = "infrastructure"
         self.cr_serv_sample_data["input"]["service-a-end"]["service-rate"] = "100"
@@ -1086,6 +1099,7 @@ class TransportPCEtesting(unittest.TestCase):
         time.sleep(2)
 
     def test_68_create_ODU4_service_2(self):
+        # pylint: disable=line-too-long
         self.cr_serv_sample_data["input"]["service-name"] = "service2-ODU4"
         self.cr_serv_sample_data["input"]["service-a-end"]["service-format"] = "ODU"
         self.cr_serv_sample_data["input"]["service-a-end"]["tx-direction"]["port"]["port-device-name"] = "SPDR-SA1-XPDR3"
@@ -1125,6 +1139,7 @@ class TransportPCEtesting(unittest.TestCase):
         time.sleep(2)
 
     def test_70_create_1GE_service(self):
+        # pylint: disable=line-too-long
         self.cr_serv_sample_data["input"]["service-name"] = "service1-1GE"
         self.cr_serv_sample_data["input"]["connection-type"] = "service"
         self.cr_serv_sample_data["input"]["service-a-end"]["service-rate"] = "1"
@@ -1176,7 +1191,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertDictEqual(dict(input_dict, **res['interface'][0]),
                              res['interface'][0])
         self.assertDictEqual(
-            {u'speed': 1000},
+            {'speed': 1000},
             res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet'])
 
     def test_73_check_interface_ODU0_CLIENT_spdra(self):
@@ -1201,7 +1216,7 @@ class TransportPCEtesting(unittest.TestCase):
                                   **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']),
                              res['interface'][0]['org-openroadm-otn-odu-interfaces:odu'])
         self.assertDictEqual(
-            {u'payload-type': u'07', u'exp-payload-type': u'07'},
+            {'payload-type': '07', 'exp-payload-type': '07'},
             res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu'])
 
     def test_74_check_interface_ODU0_NETWORK_spdra(self):
@@ -1247,9 +1262,9 @@ class TransportPCEtesting(unittest.TestCase):
 
         self.assertDictEqual(dict(input_dict_1, **res['odu-connection'][0]),
                              res['odu-connection'][0])
-        self.assertDictEqual({u'dst-if': u'XPDR3-NETWORK1-ODU0-service1-1GE'},
+        self.assertDictEqual({'dst-if': 'XPDR3-NETWORK1-ODU0-service1-1GE'},
                              res['odu-connection'][0]['destination'])
-        self.assertDictEqual({u'src-if': u'XPDR3-CLIENT1-ODU0-service1-1GE'},
+        self.assertDictEqual({'src-if': 'XPDR3-CLIENT1-ODU0-service1-1GE'},
                              res['odu-connection'][0]['source'])
 
     def test_76_check_interface_1GE_CLIENT_spdrc(self):
@@ -1266,7 +1281,7 @@ class TransportPCEtesting(unittest.TestCase):
         self.assertDictEqual(dict(input_dict, **res['interface'][0]),
                              res['interface'][0])
         self.assertDictEqual(
-            {u'speed': 1000},
+            {'speed': 1000},
             res['interface'][0]['org-openroadm-ethernet-interfaces:ethernet'])
 
     def test_77_check_interface_ODU0_CLIENT_spdrc(self):
@@ -1291,7 +1306,7 @@ class TransportPCEtesting(unittest.TestCase):
                                   **res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']),
                              res['interface'][0]['org-openroadm-otn-odu-interfaces:odu'])
         self.assertDictEqual(
-            {u'payload-type': u'07', u'exp-payload-type': u'07'},
+            {'payload-type': '07', 'exp-payload-type': '07'},
             res['interface'][0]['org-openroadm-otn-odu-interfaces:odu']['opu'])
 
     def test_78_check_interface_ODU0_NETWORK_spdrc(self):
@@ -1341,9 +1356,9 @@ class TransportPCEtesting(unittest.TestCase):
 
         self.assertDictEqual(dict(input_dict_1, **res['odu-connection'][0]),
                              res['odu-connection'][0])
-        self.assertDictEqual({u'dst-if': u'XPDR3-NETWORK1-ODU0-service1-1GE'},
+        self.assertDictEqual({'dst-if': 'XPDR3-NETWORK1-ODU0-service1-1GE'},
                              res['odu-connection'][0]['destination'])
-        self.assertDictEqual({u'src-if': u'XPDR3-CLIENT1-ODU0-service1-1GE'},
+        self.assertDictEqual({'src-if': 'XPDR3-CLIENT1-ODU0-service1-1GE'},
                              res['odu-connection'][0]['source'])
 
     def test_80_check_otn_topo_links(self):
@@ -1365,7 +1380,7 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.get_otn_topo_request()
         res = response.json()
         for node in res['network'][0]['node']:
-            if node['node-id'] == 'SPDR-SA1-XPDR3' or 'SPDR-SC1-XPDR3':
+            if node['node-id'] in ('SPDR-SA1-XPDR3', 'SPDR-SC1-XPDR3'):
                 tpList = node['ietf-network-topology:termination-point']
                 for tp in tpList:
                     if tp['tp-id'] == 'XPDR3-NETWORK1':
@@ -1435,7 +1450,7 @@ class TransportPCEtesting(unittest.TestCase):
         response = test_utils.get_otn_topo_request()
         res = response.json()
         for node in res['network'][0]['node']:
-            if (node['node-id'] == 'SPDR-SA1-XPDR3' or 'SPDR-SC1-XPDR3'):
+            if node['node-id'] in ('SPDR-SA1-XPDR3', 'SPDR-SC1-XPDR3'):
                 tpList = node['ietf-network-topology:termination-point']
                 for tp in tpList:
                     if tp['tp-id'] == 'XPDR3-NETWORK1':
@@ -1467,8 +1482,7 @@ class TransportPCEtesting(unittest.TestCase):
         res = response.json()
         links = res['network'][0]['ietf-network-topology:link']
         for link in links:
-            if (link["org-openroadm-common-network:link-type"] == "XPONDER-OUTPUT" or
-                    link["org-openroadm-common-network:link-type"] == "XPONDER-INPUT"):
+            if link["org-openroadm-common-network:link-type"] in ('XPONDER-OUTPUT', 'XPONDER-INPUT'):
                 link_name = link["link-id"]
                 response = test_utils.delete_request(url+link_name)
                 self.assertEqual(response.status_code, requests.codes.ok)