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 from common import test_utils
23 class TransportPCEtesting(unittest.TestCase):
29 cls.processes = test_utils.start_tpce()
30 cls.processes = test_utils.start_sims(['xpdra', 'roadma'])
33 def tearDownClass(cls):
34 # pylint: disable=not-an-iterable
35 for process in cls.processes:
36 test_utils.shutdown_process(process)
37 print("all processes killed")
43 def test_01_connect_rdm(self):
44 response = test_utils.mount_device("ROADMA01", 'roadma')
45 self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
47 # Verify the termination points of the ROADMA
48 def test_02_compare_Openroadm_topology_portmapping_rdm(self):
49 responseTopo = test_utils.get_ordm_topo_request("")
50 resTopo = responseTopo.json()
51 nbNode = len(resTopo['network'][0]['node'])
52 for i in range(0, nbNode):
53 nodeId = resTopo['network'][0]['node'][i]['node-id']
54 nodeMapId = nodeId.split("-")[0]
55 test_utils.portmapping_request(nodeMapId)
56 nbTp = len(resTopo['network'][0]['node'][i]['ietf-network-topology:termination-point'])
57 for j in range(0, nbTp):
58 tpId = resTopo['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]['tp-id']
59 if((not "CP" in tpId) and (not "CTP" in tpId)):
60 test_utils.portmapping_request(nodeMapId+"/mapping/"+tpId)
62 # Disconnect the ROADMA
63 def test_03_disconnect_rdm(self):
64 response = test_utils.unmount_device("ROADMA01")
65 self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
68 def test_04_connect_xpdr(self):
69 response = test_utils.mount_device("XPDRA01", 'xpdra')
70 self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
72 # #Verify the termination points related to XPDR
73 def test_05_compare_Openroadm_topology_portmapping_xpdr(self):
74 self.test_02_compare_Openroadm_topology_portmapping_rdm()
76 # Disconnect the XPDRA
77 def test_06_disconnect_device(self):
78 response = test_utils.unmount_device("XPDRA01")
79 self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
82 if __name__ == "__main__":
83 # logging.basicConfig(filename='./transportpce_tests/log/response.log',filemode='w',level=logging.DEBUG)
84 #logging.debug('I am there')
85 unittest.main(verbosity=2)