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