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
18 from common import test_utils
21 class TransportPCEtesting(unittest.TestCase):
27 cls.processes = test_utils.start_tpce()
28 cls.processes = test_utils.start_sims(['xpdra', 'roadma'])
31 def tearDownClass(cls):
32 for process in cls.processes:
33 test_utils.shutdown_process(process)
34 print("all processes killed")
40 def test_01_connect_rdm(self):
41 response = test_utils.mount_device("ROADMA01", 'roadma')
42 self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
44 # Verify the termination points of the ROADMA
45 def test_02_compareOpenroadmTopologyPortMapping_rdm(self):
46 responseTopo = test_utils.get_ordm_topo_request("")
47 resTopo = responseTopo.json()
48 nbNode = len(resTopo['network'][0]['node'])
49 for i in range(0, nbNode):
50 nodeId = resTopo['network'][0]['node'][i]['node-id']
51 nodeMapId = nodeId.split("-")[0]
52 test_utils.portmapping_request(nodeMapId)
53 nbTp = len(resTopo['network'][0]['node'][i]['ietf-network-topology:termination-point'])
54 for j in range(0, nbTp):
55 tpId = resTopo['network'][0]['node'][i]['ietf-network-topology:termination-point'][j]['tp-id']
56 if((not "CP" in tpId) and (not "CTP" in tpId)):
57 test_utils.portmapping_request(nodeMapId+"/mapping/"+tpId)
59 # Disconnect the ROADMA
60 def test_03_disconnect_rdm(self):
61 response = test_utils.unmount_device("ROADMA01")
62 self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
65 def test_04_connect_xpdr(self):
66 response = test_utils.mount_device("XPDRA01", 'xpdra')
67 self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201)
69 # #Verify the termination points related to XPDR
70 def test_05_compareOpenroadmTopologyPortMapping_xpdr(self):
71 self.test_02_compareOpenroadmTopologyPortMapping_rdm()
73 # Disconnect the XPDRA
74 def test_06_disconnect_device(self):
75 response = test_utils.unmount_device("XPDRA01")
76 self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
79 if __name__ == "__main__":
80 # logging.basicConfig(filename='./transportpce_tests/log/response.log',filemode='w',level=logging.DEBUG)
81 #logging.debug('I am there')
82 unittest.main(verbosity=2)