def get_neutron_network(self, network):
if uuidutils.is_uuid_like(network):
networks = self.neutron.list_networks(id=network)['networks']
else:
networks = self.neutron.list_networks(name=network)['networks']
if len(networks) == 0:
raise exception.NetworkNotFound(network=network)
elif len(networks) > 1:
raise exception.Conflict(_(
'Multiple neutron networks exist with same name. '
'Please use the uuid instead.'))
network = networks[0]
return network
评论列表
文章目录