Return the IP address of the VM
    If the VM has  public IP as defined by libcloud module then use it
    Otherwise try to extract the private IP and use that one.
489431
def get_ip(data):
    '''
    
    '''
    try:
        ip = data.public_ips[0]
    except Exception:
        ip = data.private_ips[0]
    return ip
102219
def _check_ip(ip: str) -> bool:
    
    address = ipaddress.IPv4Address(ip)
    return address in allowed_ips
1051273
def server_show_libcloud(self, uuid):
        '''
        
        '''
        server_info = self.server_show(uuid)
        server = next(six.itervalues(server_info))
        server_name = next(six.iterkeys(server_info))
        if not hasattr(self, 'password'):
            self.password = None
        ret = NovaServer(server_name, server, self.password)

        return ret
1068152
def get_public_ip(addresses, version=4):
        
        for addr in addresses:
            if addr['public'] and addr['address_family'] == version:
                return addr.get('address')
        return None
1091238
def cli(env, volume_id, hardware_id, virtual_id, ip_address_id, ip_address):
    """"""
    block_manager = SoftLayer.BlockStorageManager(env.client)
    ip_address_id_list = list(ip_address_id)

    # Convert actual IP Addresses to their SoftLayer ids
    if ip_address is not None:
        network_manager = SoftLayer.NetworkManager(env.client)
        for ip_address_value in ip_address:
            ip_address_object = network_manager.ip_lookup(ip_address_value)
            ip_address_id_list.append(ip_address_object['id'])

    block_manager.deauthorize_host_to_volume(volume_id,
                                             hardware_id,
                                             virtual_id,
                                             ip_address_id_list)

    # If no exception was raised, the command succeeded
    click.echo('Access to %s was revoked for the specified hosts' % volume_id)
653624
def get_vm_ip(name=None, session=None, call=None):
    '''
    

    '''
    if call == 'function':
        raise SaltCloudException(
            'This function must be called with -a or --action.'
        )
    if session is None:
        log.debug('New session being created')
        session = _get_session()
    vm = _get_vm(name, session=session)
    ret = None
    # -- try to get ip from vif
    vifs = session.xenapi.VM.get_VIFs(vm)
    if vifs is not None:
        for vif in vifs:
            if session.xenapi.VIF.get_ipv4_addresses(vif):
                cidr = session.xenapi.VIF.get_ipv4_addresses(vif).pop()
                ret, subnet = cidr.split('/')
                log.debug(
                    'VM vif returned for instance: %s ip: %s', name, ret)
                return ret
    # -- try to get ip from get tools metrics
    vgm = session.xenapi.VM.get_guest_metrics(vm)
    try:
        net = session.xenapi.VM_guest_metrics.get_networks(vgm)
        if "0/ip" in net.keys():
            log.debug(
                'VM guest metrics returned for instance: %s 0/ip: %s',
                name, net["0/ip"]
            )
            ret = net["0/ip"]
    # except Exception as ex:
    except XenAPI.Failure:
        log.info('Could not get vm metrics at this time')
    return ret
531979
def get_device(self):
        
        addr = self.address
        servers = [server for server in pyrax.cloudservers.list()
                if addr in server.networks.get("private", "")]
        try:
            return servers[0]
        except IndexError:
            return None
1021498
def update_port_ip_address(self):
        
        leases = None
        req = dict(ip='0.0.0.0')
        instances = self.get_vms_for_this_req(**req)
        if instances is None:
            return

        for vm in instances:
            if not leases:
                # For the first time finding the leases file.
                leases = self._get_ip_leases()
                if not leases:
                    # File does not exist.
                    return

            for line in leases:
                if line.startswith('lease') and line.endswith('{\n'):
                    ip_addr = line.split()[1]
                if 'hardware ethernet' in line:
                    if vm.mac == line.replace(';', '').split()[2]:
                        LOG.info('Find IP address %(ip)s for %(mac)s',
                                 {'ip': ip_addr, 'mac': vm.mac})
                        try:
                            rule_info = dict(ip=ip_addr, mac=vm.mac,
                                             port=vm.port_id,
                                             status='up')
                            self.neutron_event.update_ip_rule(str(vm.host),
                                                              str(rule_info))
                        except (rpc.MessagingTimeout, rpc.RPCException,
                                rpc.RemoteError):
                            LOG.error("RPC error: Failed to update"
                                      "rules.")
                        else:
                            params = dict(columns=dict(ip=ip_addr))
                            self.update_vm_db(vm.port_id, **params)

                            # Send update to the agent.
                            vm_info = dict(status=vm.status, vm_mac=vm.mac,
                                           segmentation_id=vm.segmentation_id,
                                           host=vm.host, port_uuid=vm.port_id,
                                           net_uuid=vm.network_id,
                                           oui=dict(ip_addr=ip_addr,
                                                    vm_name=vm.name,
                                                    vm_uuid=vm.instance_id,
                                                    gw_mac=vm.gw_mac,
                                                    fwd_mod=vm.fwd_mod,
                                                    oui_id='cisco'))
                            try:
                                self.neutron_event.send_vm_info(vm.host,
                                                                str(vm_info))
                            except (rpc.MessagingTimeout, rpc.RPCException,
                                    rpc.RemoteError):
                                LOG.error('Failed to send VM info to '
                                          'agent.')
1354704
def get_ip
      begin
        @logger.debug "Creating IP"
        ip = @compute_client.addresses.create
      rescue Fog::Compute::OpenStack::NotFound
        # If there are no more floating IP addresses, allocate a
        # new one and try again. 
        @compute_client.allocate_address(@options[:floating_ip_pool])
        ip = @compute_client.addresses.find { |ip| ip.instance_id.nil? }
      end
      raise 'Could not find or allocate an address' if not ip
      ip
    end
1017960
def get_ips(self, instance_id):
        
        self._init_os_api()
        instance = self._load_instance(instance_id)
        try:
            ip_addrs = set([self.floating_ip])
        except AttributeError:
            ip_addrs = set([])
        for ip_addr in sum(instance.networks.values(), []):
            ip_addrs.add(ip_addr)
        log.debug("VM `%s` has IP addresses %r", instance_id, ip_addrs)
        return list(ip_addrs)
261793
def maybe_ip_addr(addr):
    

    if six.PY2 and isinstance(addr, str):
        addr = unicode(addr)  # noqa
    try:
        return ipaddress.ip_address(addr)
    except ValueError:
        pass
    return str(addr)
1210866
def get_public_keys(vm_):
    '''
    
    '''
    key_filename = config.get_cloud_config_value(
        'ssh_public_key', vm_, __opts__, search_global=False, default=None
    )
    if key_filename is not None:
        key_filename = os.path.expanduser(key_filename)
        if not os.path.isfile(key_filename):
            raise SaltCloudConfigError(
                'The defined ssh_public_key \'{0}\' does not exist'.format(
                    key_filename
                )
            )
        ssh_keys = []
        with salt.utils.files.fopen(key_filename) as rfh:
            for key in rfh.readlines():
                ssh_keys.append(salt.utils.stringutils.to_unicode(key))

        return ssh_keys
937097
def get_ips(self, instance_id):
        
        self._init_az_api()
        cluster_name, node_name = instance_id
        # XXX: keep in sync with contents of `vm_deployment_template`
        ip_name = ('{node_name}-public-ip'.format(node_name=node_name))
        ip = self._network_client.public_ip_addresses.get(cluster_name, ip_name)
        if (ip.provisioning_state == 'Succeeded' and ip.ip_address):
            return [ip.ip_address]
        else:
            return []
321144
def get_ip(self, address):
        
        res = self.get_request('/ip_address/' + address)
        return IPAddress(cloud_manager=self, **res['ip_address'])
448872
def ip_address(self):
        
        networks = self.get("networks", {})
        v4nets = networks.get("v4", [])
        v6nets = networks.get("v6", [])
        try:
            return (v4nets + v6nets)[0].ip_address
        except IndexError:
            return None
479841
def get_host(self):
        
        host = self.get_as_nullable_string("host")
        host = host if host != None else self.get_as_nullable_string("ip")
        return host
1177430
def Get(self,key):
		""""""

		for public_ip in self.public_ips:
			if public_ip.id == key:  return(public_ip)
			elif key == public_ip.internal:  return(public_ip)