2 ##############################################################################
3 # Copyright (c) 2021 AT&T, Inc. and others. All rights reserved.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 # pylint: disable=no-member
12 # pylint: disable=too-many-public-methods
18 sys.path.append('transportpce_tests/common')
22 class TransportPCE400GPortMappingTesting(unittest.TestCase):
29 cls.processes = test_utils.start_tpce()
30 cls.processes = test_utils.start_sims([('xpdra2', cls.NODE_VERSION)])
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")
40 print("execution of {}".format(self.id().split(".")[-1]))
43 def test_01_xpdr_device_connection(self):
44 response = test_utils.mount_device("XPDR-A2",
45 ('xpdra2', self.NODE_VERSION))
46 self.assertEqual(response.status_code, requests.codes.created,
47 test_utils.CODE_SHOULD_BE_201)
49 # Check if the node appears in the ietf-network topology
50 def test_02_xpdr_device_connected(self):
51 response = test_utils.get_netconf_oper_request("XPDR-A2")
52 self.assertEqual(response.status_code, requests.codes.ok)
55 res['node'][0]['netconf-node-topology:connection-status'],
59 # Check node info in the port-mappings
60 def test_03_xpdr_portmapping_info(self):
61 response = test_utils.portmapping_request("XPDR-A2/node-info")
62 self.assertEqual(response.status_code, requests.codes.ok)
65 {u'node-info': {u'node-type': u'xpdr',
66 u'node-ip-address': u'1.2.3.4',
67 u'node-clli': u'NodeA',
68 u'openroadm-version': u'7.1',
69 u'node-vendor': u'vendorA',
70 u'node-model': u'model2'}},
74 # Check the if-capabilities and the other details for network
75 def test_04_xpdr_portmapping_NETWORK1(self):
76 response = test_utils.portmapping_request("XPDR-A2/mapping/XPDR1-NETWORK1")
77 self.assertEqual(response.status_code, requests.codes.ok)
80 {'supported-interface-capability':
81 ['org-openroadm-port-types:if-otsi-otsigroup'],
82 'supporting-port': 'L1',
83 'supporting-circuit-pack-name': '1/0/1-PLUG-NET',
84 'logical-connection-point': 'XPDR1-NETWORK1',
85 'port-qual': 'xpdr-network',
86 'port-direction': 'bidirectional',
87 'connection-map-lcp': 'XPDR1-CLIENT1',
88 'lcp-hash-val': 'AIGiVAQ4gDil',
89 'port-admin-state': 'InService',
90 'port-oper-state': 'InService',
91 'xponder-type': 'tpdr'
95 def test_05_xpdr_portmapping_CLIENT1(self):
96 response = test_utils.portmapping_request("XPDR-A2/mapping/XPDR1-CLIENT1")
97 self.assertEqual(response.status_code, requests.codes.ok)
100 {'supported-interface-capability': ['org-openroadm-port-types:if-400GE'],
101 'supporting-port': 'C1',
102 'supporting-circuit-pack-name': '1/0/1-PLUG-CLIENT',
103 'logical-connection-point': 'XPDR1-CLIENT1', 'port-direction': 'bidirectional',
104 'connection-map-lcp': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-client',
105 'lcp-hash-val': 'AODABTVSOHH0',
106 'port-admin-state': 'InService', 'port-oper-state': 'InService'},
109 def test_06_xpdr_device_disconnection(self):
110 response = test_utils.unmount_device("XPDR-A2")
111 self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200)
113 def test_07_xpdr_device_disconnected(self):
114 response = test_utils.get_netconf_oper_request("XPDR-A2")
115 self.assertEqual(response.status_code, requests.codes.conflict)
116 res = response.json()
118 {"error-type": "application", "error-tag": "data-missing",
119 "error-message": "Request could not be completed because the "
120 "relevant data model content does not exist"},
121 res['errors']['error'])
123 def test_08_xpdr_device_not_connected(self):
124 response = test_utils.portmapping_request("XPDR-A2")
125 self.assertEqual(response.status_code, requests.codes.conflict)
126 res = response.json()
128 {"error-type": "application", "error-tag": "data-missing",
129 "error-message": "Request could not be completed because the "
130 "relevant data model content does not exist"},
131 res['errors']['error'])
134 if __name__ == '__main__':
135 unittest.main(verbosity=2)