Change way to start simulators
[transportpce.git] / tests / transportpce_tests / 2.2.1 / test_portmapping.py
index 7692c3246168bb75a9336832da361ce39558f1c2..9316b20b616f0ecad66f564db5d9ab3de87d2f07 100644 (file)
 import unittest
 import time
 import requests
-from common import test_utils
+import sys
+sys.path.append('transportpce_tests/common/')
+import test_utils
 
 
 class TransportPCEPortMappingTesting(unittest.TestCase):
 
     processes = None
+    NODE_VERSION = '2.2.1'
 
     @classmethod
     def setUpClass(cls):
         cls.processes = test_utils.start_tpce()
-        cls.processes = test_utils.start_sims(['xpdra', 'roadma'])
+        cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION), ('roadma', cls.NODE_VERSION)])
 
     @classmethod
     def tearDownClass(cls):
@@ -39,7 +42,7 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         time.sleep(10)
 
     def test_01_rdm_device_connection(self):
-        response = test_utils.mount_device("ROADM-A1", 'roadma')
+        response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION))
         self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
 
     def test_02_rdm_device_connected(self):
@@ -70,7 +73,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         res = response.json()
         self.assertIn(
             {'supporting-port': 'L1', 'supporting-circuit-pack-name': '1/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_DEG2_TTP_TXRX_with_ots_oms(self):
@@ -81,7 +85,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
             {'supporting-port': 'L1', 'supporting-circuit-pack-name': '2/0',
              'logical-connection-point': 'DEG2-TTP-TXRX',
              'supporting-oms': 'OMS-DEG2-TTP-TXRX', 'supporting-ots': 'OTS-DEG2-TTP-TXRX',
-             'port-direction': 'bidirectional'},
+             'port-direction': 'bidirectional',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_06_rdm_portmapping_SRG1_PP3_TXRX(self):
@@ -90,7 +95,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
         res = response.json()
         self.assertIn(
             {'supporting-port': 'C3', 'supporting-circuit-pack-name': '3/0',
-             'logical-connection-point': 'SRG1-PP3-TXRX', 'port-direction': 'bidirectional'},
+             'logical-connection-point': 'SRG1-PP3-TXRX', 'port-direction': 'bidirectional',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_07_rdm_portmapping_SRG3_PP1_TXRX(self):
@@ -99,11 +105,12 @@ 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_08_xpdr_device_connection(self):
-        response = test_utils.mount_device("XPDR-A1", 'xpdra')
+        response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION))
         self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
 
     def test_09_xpdr_device_connected(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-qual': 'xpdr-network',
              'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-CLIENT1',
-             'lcp-hash-val': 'AMkDwQ7xTmRI'},
+             'lcp-hash-val': 'AMkDwQ7xTmRI',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_12_xpdr_portmapping_NETWORK2(self):
@@ -149,7 +157,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-CLIENT2', 'port-qual': 'xpdr-network',
-             'lcp-hash-val': 'AMkDwQ7xTmRL'},
+             'lcp-hash-val': 'AMkDwQ7xTmRL',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_13_xpdr_portmapping_CLIENT1(self):
@@ -162,7 +171,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
              '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',
-             'lcp-hash-val': 'AJUUr6I5fALj'},
+             'lcp-hash-val': 'AJUUr6I5fALj',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_14_xpdr_portmapping_CLIENT2(self):
@@ -175,7 +185,8 @@ class TransportPCEPortMappingTesting(unittest.TestCase):
              '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',
-             'lcp-hash-val': 'AJUUr6I5fALg'},
+             'lcp-hash-val': 'AJUUr6I5fALg',
+             'port-admin-state': 'InService', 'port-oper-state': 'InService'},
             res['mapping'])
 
     def test_15_xpdr_device_disconnection(self):