def test_02_compareOpenroadmTopologyPortMapping_rdm(self): resTopo = test_utils_rfc8040.get_ietf_network_request( 'openroadm-topology', 'config') self.assertEqual(resTopo['status_code'], requests.codes.ok) nbMapCumul = 0 nbMappings = 0 for node in resTopo['network'][0]['node']: nodeId = node['node-id'] # pylint: disable=consider-using-f-string print("nodeId={}".format(nodeId)) nodeMapId = nodeId.split("-")[0] + "-" + nodeId.split("-")[1] print("nodeMapId={}".format(nodeMapId)) response = test_utils_rfc8040.get_portmapping_node_info(nodeMapId) self.assertEqual(response['status_code'], requests.codes.ok) responseMapList = test_utils_rfc8040.get_portmapping(nodeMapId) nbMappings = len( responseMapList['nodes'][0]['mapping']) - nbMapCumul nbMapCurrent = 0 for tp in node['ietf-network-topology:termination-point']: tpId = tp['tp-id'] if (not "CP" in tpId) and (not "CTP" in tpId): responseMap = test_utils_rfc8040.portmapping_request( nodeMapId, tpId) self.assertEqual(responseMap['status_code'], requests.codes.ok) if responseMap['status_code'] == requests.codes.ok: nbMapCurrent += 1 nbMapCumul += nbMapCurrent nbMappings -= nbMapCurrent self.assertEqual(nbMappings, 0)
def test_21_rdm_device_not_connected(self): response = test_utils_rfc8040.get_portmapping_node_info("ROADMA01") self.assertEqual(response['status_code'], requests.codes.conflict) self.assertIn(response['node-info']['error-type'], ('protocol', 'application')) self.assertEqual(response['node-info']['error-tag'], 'data-missing') self.assertEqual(response['node-info']['error-message'], 'Request could not be completed because the relevant data model content does not exist')
def test_03_xpdr_portmapping_info(self): response = test_utils_rfc8040.get_portmapping_node_info("XPDR-A2") self.assertEqual(response['status_code'], requests.codes.ok) self.assertEqual( { 'node-type': 'xpdr', 'node-ip-address': '1.2.3.4', 'node-clli': 'NodeA', 'openroadm-version': '7.1', 'node-vendor': 'vendorA', 'node-model': 'model' }, response['node-info'])
def test_03_rdm_portmapping_info(self): response = test_utils_rfc8040.get_portmapping_node_info("ROADM-A1") self.assertEqual(response['status_code'], requests.codes.ok) self.assertEqual( { 'node-type': 'rdm', 'node-ip-address': '127.0.0.11', 'node-clli': 'NodeA', 'openroadm-version': '2.2.1', 'node-vendor': 'vendorA', 'node-model': 'model2' }, response['node-info'])
def test_17_spdr_portmapping_info(self): response = test_utils_rfc8040.get_portmapping_node_info("SPDR-SA1") self.assertEqual(response['status_code'], requests.codes.ok) self.assertEqual( { 'node-type': 'xpdr', 'node-ip-address': '1.2.3.4', 'node-clli': 'NodeSA', 'openroadm-version': '2.2.1', 'node-vendor': 'vendorA', 'node-model': 'universal-switchponder' }, response['node-info'])
def test_02_compare_Openroadm_topology_portmapping_rdm(self): resTopo = test_utils_rfc8040.get_ietf_network_request('openroadm-topology', 'config') self.assertEqual(resTopo['status_code'], requests.codes.ok) for node in resTopo['network'][0]['node']: nodeId = node['node-id'] nodeMapId = nodeId.split("-")[0] response = test_utils_rfc8040.get_portmapping_node_info(nodeMapId) self.assertEqual(response['status_code'], requests.codes.ok) for tp in node['ietf-network-topology:termination-point']: tpId = tp['tp-id'] if (not "CP" in tpId) and (not "CTP" in tpId): response2 = test_utils_rfc8040.portmapping_request(nodeMapId, tpId) self.assertEqual(response2['status_code'], requests.codes.ok)