def get_port_by_display_name(clusters, lswitch, display_name):
 query = ('/ws.v1/lswitch/%s/lport?display_name=%s&fields=*' % (lswitch, display_name))
 LOG.debug(_("Looking for port with display_name '%(display_name)s' on: %(lswitch)s"), locals())
 for c in clusters:
  try:
   res_obj = do_single_request(HTTP_GET, query, cluster=c)
  except Exception as e:
   continue
  res = json.loads(res_obj)
  if (len(res['results']) == 1):
   return (res['results'][0], c)
 LOG.error(_('Port or Network not found, Error: %s'), str(e))
 raise exception.PortNotFound(port_id=display_name, net_id=lswitch)

def get_port_by_display_name ( clusters , lswitch , display_name ) : query = ( '/ws.v1/lswitch/%s/lport?display_name=%s&fields=*' % ( lswitch , display_name ) ) LOG . debug ( _ ( "Looking for port with display_name '%(display_name)s' on: %(lswitch)s" ) , locals ( ) ) for c in clusters : try : res_obj = do_single_request ( HTTP_GET , query , cluster = c ) except Exception as e : continue res = json . loads ( res_obj ) if ( len ( res [ 'results' ] ) == 1 ) : return ( res [ 'results' ] [ 0 ] , c ) LOG . error ( _ ( 'Port or Network not found, Error: %s' ) , str ( e ) ) raise exception . PortNotFound ( port_id = display_name , net_id = lswitch )
return of port or raises resourcenotfound .