Set port states in portMapping
[transportpce.git] / tests / transportpce_tests / 1.2.1 / test_portmapping.py
index 9bfeb4840f6bec7ef00731ad30fe6096f950f7b5..5cc4c14ddfadb014e57196f720756de55d3eaf23 100644 (file)
@@ -9,6 +9,9 @@
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
 
+# pylint: disable=no-member
+# pylint: disable=too-many-public-methods
+
 import unittest
 import time
 import requests
@@ -26,6 +29,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
 
     @classmethod
     def tearDownClass(cls):
+        # pylint: disable=not-an-iterable
         for process in cls.processes:
             test_utils.shutdown_process(process)
         print("all processes killed")
@@ -82,7 +86,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         res = response.json()
         self.assertIn(
             {'supporting-port': 'L1', 'supporting-circuit-pack-name': '2/0',
-             'logical-connection-point': 'DEG1-TTP-TXRX', 'port-direction': 'bidirectional'},
+             'logical-connection-point': 'DEG1-TTP-TXRX', 'port-direction': 'bidirectional',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_05_rdm_portmapping_SRG1_PP7_TXRX(self):
@@ -91,7 +96,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         res = response.json()
         self.assertIn(
             {'supporting-port': 'C7', 'supporting-circuit-pack-name': '4/0',
-             'logical-connection-point': 'SRG1-PP7-TXRX', 'port-direction': 'bidirectional'},
+             'logical-connection-point': 'SRG1-PP7-TXRX', 'port-direction': 'bidirectional',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_06_rdm_portmapping_SRG3_PP1_TXRX(self):
@@ -100,7 +106,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         res = response.json()
         self.assertIn(
             {'supporting-port': 'C1', 'supporting-circuit-pack-name': '5/0',
-             'logical-connection-point': 'SRG3-PP1-TXRX', 'port-direction': 'bidirectional'},
+             'logical-connection-point': 'SRG3-PP1-TXRX', 'port-direction': 'bidirectional',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_07_xpdr_device_connection(self):
@@ -137,7 +144,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
             {'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
              'logical-connection-point': 'XPDR1-NETWORK1', 'port-direction': 'bidirectional',
              'connection-map-lcp': 'XPDR1-CLIENT1', 'port-qual': 'xpdr-network',
-             'lcp-hash-val': 'OSvMgUyP+mE='},
+             'lcp-hash-val': 'OSvMgUyP+mE=',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_11_xpdr_portmapping_NETWORK2(self):
@@ -148,7 +156,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
             {'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/2-PLUG-NET',
              'logical-connection-point': 'XPDR1-NETWORK2', 'port-direction': 'bidirectional',
              'connection-map-lcp': 'XPDR1-CLIENT3', 'port-qual': 'xpdr-network',
-             'lcp-hash-val': 'OSvMgUyP+mI='},
+             'lcp-hash-val': 'OSvMgUyP+mI=',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_12_xpdr_portmapping_CLIENT1(self):
@@ -160,7 +169,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
              'supporting-circuit-pack-name': '1/0/C1-PLUG-CLIENT',
              'logical-connection-point': 'XPDR1-CLIENT1', 'port-direction': 'bidirectional',
              'connection-map-lcp': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-client',
-             'lcp-hash-val': 'AO9UFkY/TLYw'},
+             'lcp-hash-val': 'AO9UFkY/TLYw',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_13_xpdr_portmapping_CLIENT2(self):
@@ -172,7 +182,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
              'supporting-circuit-pack-name': '1/0/C2-PLUG-CLIENT',
              'logical-connection-point': 'XPDR1-CLIENT2', 'port-direction': 'bidirectional',
              'port-qual': 'xpdr-client',
-             'lcp-hash-val': 'AO9UFkY/TLYz'},
+             'lcp-hash-val': 'AO9UFkY/TLYz',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_14_xpdr_portmapping_CLIENT3(self):
@@ -184,9 +195,11 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
              'supporting-circuit-pack-name': '1/0/C3-PLUG-CLIENT',
              'logical-connection-point': 'XPDR1-CLIENT3',
              'connection-map-lcp': 'XPDR1-NETWORK2', 'port-direction': 'bidirectional',
-             'port-qual': 'xpdr-client', 'lcp-hash-val': 'AO9UFkY/TLYy'},
+             'port-qual': 'xpdr-client', 'lcp-hash-val': 'AO9UFkY/TLYy',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
+    def test_15_xpdr_portmapping_CLIENT4(self):
         response = test_utils.portmapping_request("XPDRA01/mapping/XPDR1-CLIENT4")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
@@ -194,7 +207,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
             {'supporting-port': 'C4',
              'supporting-circuit-pack-name': '1/0/C4-PLUG-CLIENT',
              'logical-connection-point': 'XPDR1-CLIENT4', 'port-direction': 'bidirectional',
-             'port-qual': 'xpdr-client', 'lcp-hash-val': 'AO9UFkY/TLY1'},
+             'port-qual': 'xpdr-client', 'lcp-hash-val': 'AO9UFkY/TLY1',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_16_xpdr_device_disconnection(self):
@@ -203,7 +217,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
 
     def test_17_xpdr_device_disconnected(self):
         response = test_utils.get_netconf_oper_request("XPDRA01")
-        self.assertEqual(response.status_code, requests.codes.not_found)
+        self.assertEqual(response.status_code, requests.codes.conflict)
         res = response.json()
         self.assertIn(
             {"error-type": "application", "error-tag": "data-missing",
@@ -212,7 +226,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
 
     def test_18_xpdr_device_not_connected(self):
         response = test_utils.portmapping_request("XPDRA01")
-        self.assertEqual(response.status_code, requests.codes.not_found)
+        self.assertEqual(response.status_code, requests.codes.conflict)
         res = response.json()
         self.assertIn(
             {"error-type": "application", "error-tag": "data-missing",
@@ -225,7 +239,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
 
     def test_20_rdm_device_disconnected(self):
         response = test_utils.get_netconf_oper_request("ROADMA01")
-        self.assertEqual(response.status_code, requests.codes.not_found)
+        self.assertEqual(response.status_code, requests.codes.conflict)
         res = response.json()
         self.assertIn(
             {"error-type": "application", "error-tag": "data-missing",
@@ -234,7 +248,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
 
     def test_21_rdm_device_not_connected(self):
         response = test_utils.portmapping_request("ROADMA01")
-        self.assertEqual(response.status_code, requests.codes.not_found)
+        self.assertEqual(response.status_code, requests.codes.conflict)
         res = response.json()
         self.assertIn(
             {"error-type": "application", "error-tag": "data-missing",