3 ##############################################################################
4 # Copyright (c) 2017 Orange, Inc. and others. All rights reserved.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
12 # pylint: disable=no-member
13 # pylint: disable=too-many-public-methods
14 # a pylint false positive due to unittest
15 # pylint: disable=no-self-use
20 # pylint: disable=wrong-import-order
22 sys.path.append('transportpce_tests/common/')
23 # pylint: disable=wrong-import-position
24 # pylint: disable=import-error
25 import test_utils_rfc8040 # nopep8
28 class TransportPCEtesting(unittest.TestCase):
31 NODE_VERSION = '1.2.1'
35 cls.processes = test_utils_rfc8040.start_tpce()
36 cls.processes = test_utils_rfc8040.start_sims([('xpdra', cls.NODE_VERSION), ('roadma', cls.NODE_VERSION)])
39 def tearDownClass(cls):
40 # pylint: disable=not-an-iterable
41 for process in cls.processes:
42 test_utils_rfc8040.shutdown_process(process)
43 print("all processes killed")
49 def test_01_connect_rdm(self):
50 response = test_utils_rfc8040.mount_device("ROADMA01", ('roadma', self.NODE_VERSION))
51 self.assertEqual(response.status_code, requests.codes.created, test_utils_rfc8040.CODE_SHOULD_BE_201)
53 # Verify the termination points of the ROADMA
54 def test_02_compare_Openroadm_topology_portmapping_rdm(self):
55 resTopo = test_utils_rfc8040.get_ietf_network_request('openroadm-topology', 'config')
56 self.assertEqual(resTopo['status_code'], requests.codes.ok)
57 for val in resTopo['network'][0]['node']:
58 nodeId = val['node-id']
59 nodeMapId = nodeId.split("-")[0]
60 response = test_utils_rfc8040.get_portmapping_node_info(nodeMapId)
61 self.assertEqual(response['status_code'], requests.codes.ok)
62 for val2 in val['ietf-network-topology:termination-point']:
64 if (not "CP" in tpId) and (not "CTP" in tpId):
65 response2 = test_utils_rfc8040.portmapping_request(nodeMapId, tpId)
66 self.assertEqual(response2['status_code'], requests.codes.ok)
68 # Disconnect the ROADMA
69 def test_03_disconnect_rdm(self):
70 response = test_utils_rfc8040.unmount_device("ROADMA01")
71 self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content))
74 def test_04_connect_xpdr(self):
75 response = test_utils_rfc8040.mount_device("XPDRA01", ('xpdra', self.NODE_VERSION))
76 self.assertEqual(response.status_code, requests.codes.created, test_utils_rfc8040.CODE_SHOULD_BE_201)
78 # #Verify the termination points related to XPDR
79 def test_05_compare_Openroadm_topology_portmapping_xpdr(self):
80 self.test_02_compare_Openroadm_topology_portmapping_rdm()
82 # Disconnect the XPDRA
83 def test_06_disconnect_device(self):
84 response = test_utils_rfc8040.unmount_device("XPDRA01")
85 self.assertIn(response.status_code, (requests.codes.ok, requests.codes.no_content))
88 if __name__ == "__main__":
89 # logging.basicConfig(filename='./transportpce_tests/log/response.log',filemode='w',level=logging.DEBUG)
90 #logging.debug('I am there')
91 unittest.main(verbosity=2)