def find_network_with_bridge(session, bridge):
 expr = ('field "name__label" = "%s" or field "bridge" = "%s"' % (bridge, bridge))
 networks = session.call_xenapi('network.get_all_records_where', expr)
 if (len(networks) == 1):
  return networks.keys()[0]
 elif (len(networks) > 1):
  raise Exception((_('Found non-unique network for bridge %s') % bridge))
 else:
  raise Exception((_('Found no network for bridge %s') % bridge))

def find_network_with_bridge ( session , bridge ) : expr = ( 'field "name__label" = "%s" or field "bridge" = "%s"' % ( bridge , bridge ) ) networks = session . call_xenapi ( 'network.get_all_records_where' , expr ) if ( len ( networks ) == 1 ) : return networks . keys ( ) [ 0 ] elif ( len ( networks ) > 1 ) : raise Exception ( ( _ ( 'Found non-unique network for bridge %s' ) % bridge ) ) else : raise Exception ( ( _ ( 'Found no network for bridge %s' ) % bridge ) )
return the network on which the bridge is attached .