// HasIP provides a mock function with given fields: ctx, poolID, ipAddr
1361
func (_m *FacadeInterface) HasIP(ctx datastore.Context, poolID string, ipAddr string) (bool, error) {
	ret := _m.Called(ctx, poolID, ipAddr)

	var r0 bool
	if rf, ok := ret.Get(0).(func(datastore.Context, string, string) bool); ok {
		r0 = rf(ctx, poolID, ipAddr)
	} else {
		r0 = ret.Get(0).(bool)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(datastore.Context, string, string) error); ok {
		r1 = rf(ctx, poolID, ipAddr)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
784377
func GetIP(conn client.Connection, req IPRequest) (*IP, error) {
	logger := plog.WithFields(log.Fields{
		"hostid":    req.HostID,
		"ipaddress": req.IPAddress,
	})

	basepth := "/"
	if req.PoolID != "" {
		basepth = path.Join("/pools", req.PoolID)
	}

	// Get the current pool ip
	ppth := path.Join(basepth, "/ips", req.IPID())
	pdat := &PoolIP{}
	if err := conn.Get(ppth, pdat); err != nil {
		logger.WithError(err).Debug("Could not look up virtual ip on resource pool")
		// TODO: error
		return nil, err
	}
	logger.Debug("Found pool ip")

	// Get the current host ip
	hpth := path.Join(basepth, "/hosts", req.HostID, "ips", req.IPID())
	hdat := &HostIP{}
	if err := conn.Get(hpth, hdat); err != nil {
		logger.WithError(err).Debug("Could not look up virtual ip on host")
		// TODO: error
		return nil, err
	}
	logger.Debug("Found host ip")

	return &IP{
		PoolIP:    *pdat,
		HostIP:    *hdat,
		HostID:    req.HostID,
		IPAddress: req.IPAddress,
	}, nil
}
592366
func hasKey(pool *ConnectionPool, wildcard string, dbindex int) (bool, error) {
	conn := pool.Get(dbindex)
	result, err := redis.Values(conn.Do("KEYS", wildcard))
	if err != nil {
		return false, err
	}
	return len(result) > 0, nil
}
1169370
func (ps *PeerSet) HasIP(peerIP net.IP) bool {
	ps.mtx.Lock()
	defer ps.mtx.Unlock()

	return ps.hasIP(peerIP)
}
1111446
func (assign AddressAssignment) EqualIP(b AddressAssignment) bool {
	if assign.PoolID != b.PoolID {
		return false
	} else if assign.IPAddr == b.IPAddr {
		return false
	} else if assign.Port != b.Port {
		return false
	} else if assign.ServiceID != b.ServiceID {
		return false
	} else if assign.EndpointName != b.EndpointName {
		return false
	}
	return true
}
377547
func (r *Allocator) Has(id uint32) bool {
	ok, offset := r.netIDRange.Contains(id)
	if !ok {
		return false
	}
	return r.alloc.Has(int(offset))
}
221343
func (p *PerHost) AddIP(ip net.IP) {
	p.bypassIPs = append(p.bypassIPs, ip)
}
964007
func (lobby *Lobby) HasPlayer(player *player.Player) bool {
	var count int
	db.DB.Model(&LobbySlot{}).Where("lobby_id = ? AND player_id = ?", lobby.ID, player.ID).Count(&count)

	return count != 0
}
932665
func (c *Client) GetPoolIPs(poolID string) (*pool.PoolIPs, error) {
	var poolIPs pool.PoolIPs
	if err := c.call("GetPoolIPs", poolID, &poolIPs); err != nil {
		return nil, err
	}
	return &poolIPs, nil
}
774408
func (a *IPAllocator) ReleaseIP(network *net.IPNet, ip net.IP) error {
	if network == nil {
		return nil
	}

	a.mutex.Lock()
	defer a.mutex.Unlock()

	if allocated, exists := a.allocatedIPs[network.String()]; exists {
		delete(allocated.p, ip.String())
	}
	return nil
}
215725
func (s *TargetAddress) SetIp(v string) *TargetAddress {
	s.Ip = &v
	return s
}
169746
func (s *VPCRouterSetting) HasDHCPStaticMapping() bool {
	return s.DHCPStaticMapping != nil && len(s.DHCPStaticMapping.Config) > 0
}
120405
func (o *DeleteIPAMIPParams) bindIP(rawData []string, hasKey bool, formats strfmt.Registry) error {
	var raw string
	if len(rawData) > 0 {
		raw = rawData[len(rawData)-1]
	}

	// Required: true
	// Parameter is provided by construction from the route

	o.IP = raw

	return nil
}
343083
func (_m *ClientInterface) GetPoolIPs(poolID string) (*pool.PoolIPs, error) {
	ret := _m.Called(poolID)

	var r0 *pool.PoolIPs
	if rf, ok := ret.Get(0).(func(string) *pool.PoolIPs); ok {
		r0 = rf(poolID)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*pool.PoolIPs)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(poolID)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1040441
func (d *Driver) GetIP() (string, error) {
	ip, err := net.ChooseBindAddress(nil)
	if err != nil {
		return "", err
	}
	return ip.String(), nil
}
1210602
func (a *ArgType) hasfield(fields []*Field, name string) bool {
	for _, f := range fields {
		if f.Name == name {
			return true
		}
	}

	return false
}
324015
func AddIp(ip, iface string) error {
	link, err := netlink.LinkByName(iface)
	if err != nil {
		return err
	}

	addr, err := netlink.ParseAddr(ip)
	if err != nil {
		return err
	}

	return netlink.AddrAdd(link, addr)
}