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_04_xpdr_portmapping(self): response = test_utils_rfc8040.get_portmapping("XPDR-A1") self.assertEqual(response['status_code'], requests.codes.ok) self.assertIn( { 'supported-interface-capability': ['org-openroadm-port-types:if-OCH'], 'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/1-PLUG-NET', 'logical-connection-point': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-network', 'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-CLIENT1', 'lcp-hash-val': 'AMkDwQ7xTmRI', 'xponder-type': 'tpdr', 'port-admin-state': 'InService', 'port-oper-state': 'InService' }, response['nodes'][0]['mapping']) self.assertIn( { 'supported-interface-capability': ['org-openroadm-port-types:if-100GE'], 'supporting-port': 'C1', 'supporting-circuit-pack-name': '1/0/1-PLUG-CLIENT', 'logical-connection-point': 'XPDR1-CLIENT1', 'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-client', 'lcp-hash-val': 'AJUUr6I5fALj', 'xponder-type': 'tpdr', 'port-admin-state': 'InService', 'port-oper-state': 'InService' }, response['nodes'][0]['mapping'])
def test_03_rdm_portmapping(self): response = test_utils_rfc8040.get_portmapping("ROADMA01") self.assertEqual(response['status_code'], requests.codes.ok) self.assertIn( {'supporting-port': 'L1', 'supporting-circuit-pack-name': '2/0', 'logical-connection-point': 'DEG1-TTP-TXRX', 'port-direction': 'bidirectional', 'port-admin-state': 'InService', 'port-oper-state': 'InService'}, response['nodes'][0]['mapping']) self.assertIn( {'supporting-port': 'C7', 'supporting-circuit-pack-name': '4/0', 'logical-connection-point': 'SRG1-PP7-TXRX', 'port-direction': 'bidirectional', 'port-admin-state': 'InService', 'port-oper-state': 'InService'}, response['nodes'][0]['mapping'])
def test_04_xpdr_portmapping(self): response = test_utils_rfc8040.get_portmapping("XPDRA01") self.assertEqual(response['status_code'], requests.codes.ok) self.assertIn( {'supporting-port': '1', 'supporting-circuit-pack-name': '1/0/1-PLUG-NET', 'logical-connection-point': 'XPDR1-NETWORK1', 'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-CLIENT1', 'port-qual': 'xpdr-network', 'lcp-hash-val': 'OSvMgUyP+mE=', 'xponder-type': 'tpdr', 'port-admin-state': 'InService', 'port-oper-state': 'InService'}, response['nodes'][0]['mapping']) self.assertIn( {'supporting-port': 'C1', 'supporting-circuit-pack-name': '1/0/C1-PLUG-CLIENT', 'logical-connection-point': 'XPDR1-CLIENT1', 'port-direction': 'bidirectional', 'connection-map-lcp': 'XPDR1-NETWORK1', 'port-qual': 'xpdr-client', 'lcp-hash-val': 'AO9UFkY/TLYw', 'xponder-type': 'tpdr', 'port-admin-state': 'InService', 'port-oper-state': 'InService'}, response['nodes'][0]['mapping'])
def test_21_spdr_portmapping_mappings(self): response = test_utils_rfc8040.get_portmapping("SPDR-SA1") self.assertEqual(response['status_code'], requests.codes.ok) self.assertEqual(18, len(response['nodes'][0]['mapping']))