def _diag_network(context, network, fields): if not network: return False net_driver = registry.DRIVER_REGISTRY.get_driver(network["network_plugin"]) net = v._make_network_dict(network) net['ports'] = [p.get('id') for p in network.get('ports', [])] if 'subnets' in fields: net['subnets'] = [subnets.diagnose_subnet(context, s, fields) for s in network.get('subnets', [])] if 'ports' in fields: net['ports'] = [ports.diagnose_port(context, s, fields) for s in net['ports']] if 'config' in fields or 'status' in fields: net.update(net_driver.diag_network( context, net['id'], get_status='status' in fields)) return net
def _diag_network(context, network, fields): if not network: return False net_driver = registry.DRIVER_REGISTRY.get_driver(network["network_plugin"]) net = v._make_network_dict(network) net['ports'] = [p.get('id') for p in network.get('ports', [])] if 'subnets' in fields: net['subnets'] = [ subnets.diagnose_subnet(context, s, fields) for s in network.get('subnets', []) ] if 'ports' in fields: net['ports'] = [ ports.diagnose_port(context, s, fields) for s in net['ports'] ] if 'config' in fields or 'status' in fields: net.update( net_driver.diag_network(context, net['id'], get_status='status' in fields)) return net
def diagnose_subnet(self, context, id, fields): return subnets.diagnose_subnet(context, id, fields)