Dictionary of public and private, hostnames and ips.
        :rtype: dict
358094
def response(self):
        
        describe_request_params = {}
        if self.filter is not None:
            if type(self.filter) is not dict:
                try:
                    filters = json.loads(self.filter)
                except TypeError:
                    filters = self._parse_cli_filters(self.filter)
            else:
                filters = self.filter

            describe_request_params['Filters'] = filters
        if self.vpc_ids is not None:
            if 'Filters' not in describe_request_params:
                describe_request_params['Filters'] = []
            describe_request_params['Filters'].append({
                'Name': 'vpc-id',
                'Values': self.vpc_ids.split(',')
            })
        reservations = self.session().client('ec2').describe_instances(**describe_request_params)

        return self._process_reservations(reservations)
906495
def get_asns(self, privaddr=0):
        """"""
        ips = {}
        if privaddr:
            for k, v in self._ips.items():
                if not is_private_addr(k):
                    ips[k] = v
        else:
            ips = self._ips
        #
        # Special case for the loopback IP Address: 127.0.0.1 - Do not ASN resolve...
        if '127.0.0.1' in ips:
            del ips['127.0.0.1']
        #
        # ASN Lookup...
        asnquerylist = dict.fromkeys(map(lambda x: x.rsplit(" ", 1)[0], ips)).keys()
        if self._asres is None:
            asnlist = []
        else:
            try:
                asnlist = self._asres.resolve(*asnquerylist)
            except:
                pass
        for ip, asn, desc, in asnlist:
            if asn is None:
                continue
            iplist = self._asns.get(asn, [])  # Get previous ASN value
            iplist.append(ip)			# Append IP Address to previous ASN

            #
            # If ASN is a string Convert to a number: (i.e., 'AS3257' => 3257)
            if type(asn) == str:
                asn = asn.upper()
                asn = asn.replace('AS', '')
                try:
                    asn = int(asn)
                    self._asns[asn] = iplist
                    self._asds[asn] = desc
                except:
                    continue
            else:
                self._asns[asn] = iplist
                self._asds[asn] = desc
497202
def get_hosts_info(self):
        
        result = []
        index = 0
        while index < self.host_numbers:
            host = self.get_generic_host_entry(index)
            result.append({
                'ip': host['NewIPAddress'],
                'name': host['NewHostName'],
                'mac': host['NewMACAddress'],
                'status': host['NewActive']})
            index += 1
        return result
114550
def __IpsToServerIds(self):
    
    master_instance = self.__GetMasterInstance()
    assert(master_instance)
    retval, response = self.__RunMaprCli('node list -columns id')
    ip_to_id = {}
    for line_num, line in enumerate(response.split('\n')):
      tokens = line.split()
      if len(tokens) == 3 and tokens[0] != 'id':        
        instance_id = tokens[0]
        ip = tokens[2]
        ip_to_id[ip] = instance_id
    return ip_to_id
1374418
def hostnames_ips
      @hostnames.map do |hostname|
        ips.select { |ip, host| host == hostname }.keys
      end.flatten
    end
955030
def to_dict(self):
        
        return dict(
            host=self.host,
            port=self.port,
            database=self.database,
            username=self.username,
            password=self.password,
        )
381572
def _interface_configs():
    '''
    
    '''
    cmd = ['netsh', 'interface', 'ip', 'show', 'config']
    lines = __salt__['cmd.run'](cmd, python_shell=False).splitlines()
    ret = {}
    current_iface = None
    current_ip_list = None

    for line in lines:

        line = line.strip()
        if not line:
            current_iface = None
            current_ip_list = None
            continue

        if 'Configuration for interface' in line:
            _, iface = line.rstrip('"').split('"', 1)  # get iface name
            current_iface = {}
            ret[iface] = current_iface
            continue

        if ':' not in line:
            if current_ip_list:
                current_ip_list.append(line)
            else:
                log.warning('Cannot parse "%s"', line)
            continue

        key, val = line.split(':', 1)
        key = key.strip()
        val = val.strip()

        lkey = key.lower()
        if ('dns servers' in lkey) or ('wins servers' in lkey):
            current_ip_list = []
            current_iface[key] = current_ip_list
            current_ip_list.append(val)

        elif 'ip address' in lkey:
            current_iface.setdefault('ip_addrs', []).append({key: val})

        elif 'subnet prefix' in lkey:
            subnet, _, netmask = val.split(' ', 2)
            last_ip = current_iface['ip_addrs'][-1]
            last_ip['Subnet'] = subnet.strip()
            last_ip['Netmask'] = netmask.lstrip().rstrip(')')

        else:
            current_iface[key] = val

    return ret
1344717
def _create_ip_address_objs(ip_addresses, cloud_manager):
        
        # ip-addresses might be provided as a flat array or as a following dict:
        # {'ip_addresses': {'ip_address': [...]}} || {'ip_address': [...]}

        if 'ip_addresses' in ip_addresses:
            ip_addresses = ip_addresses['ip_addresses']

        if 'ip_address' in ip_addresses:
            ip_addresses = ip_addresses['ip_address']

        return [
            IPAddress(cloud_manager=cloud_manager, **ip_addr)
            for ip_addr in ip_addresses
        ]
723375
def get_host_info():
    
    host_info = {}
    for k, v in host_info_gatherers.items():
        try:
            host_info[k] = v()
        except IgnoreHostInfo:
            pass
    return host_info
983624
def get_hosts_dict(self) -> Dict:
        
        return {
            k: deserializer.inventory.InventoryElement.serialize(v).dict()
            for k, v in self.hosts.items()
        }
800495
def getHostOffsets(self, hosts):
        
        info_dict = {}
        output = util.exec_command([ntpdateCmd, '-u', '-q'] + list(hosts))
        for line in output.splitlines():
            mobj = re.match('server\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}),'
                            '\s*stratum\s+(\d),.*offset\s+([\d\.-]+),'
                            '.*delay\s+([\d\.]+)\s*$', line)
            if mobj:
                host_dict = {}
                host = mobj.group(1)
                host_dict['stratum'] = int(mobj.group(2))
                host_dict['delay'] = float(mobj.group(4))
                host_dict['offset'] = float(mobj.group(3))
                info_dict[host] = host_dict
        return info_dict
262858
def _process_reservations(self, reservations):
        

        reservations = reservations['Reservations']

        private_ip_addresses = []
        private_hostnames = []
        public_ips = []
        public_hostnames = []
        for reservation in reservations:
            for instance in reservation['Instances']:
                private_ip_addresses.append(instance['PrivateIpAddress'])
                private_hostnames.append(instance['PrivateDnsName'])

                if 'PublicIpAddress' in instance:
                    public_ips.append(instance['PublicIpAddress'])
                elif not self.remove_nones:
                    public_ips.append(None)

                if ('PublicDnsName' in instance) & (not self.remove_nones):
                    public_hostnames.append(instance['PublicDnsName'])
                elif not self.remove_nones:
                    public_hostnames.append(None)

        return {
            'private': {
                'ips': private_ip_addresses,
                'hostnames': private_hostnames
            },
            'public': {
                'ips': public_ips,
                'hostnames': public_hostnames
            },
            'reservations': reservations
        }
141953
def _get_ids_from_ip(self, ip):  # pylint: disable=inconsistent-return-statements
        """"""
        try:
            # Does it look like an ip address?
            socket.inet_aton(ip)
        except socket.error:
            return []

        # Find the server via ip address. First try public ip, then private
        results = self.list_hardware(public_ip=ip, mask="id")
        if results:
            return [result['id'] for result in results]

        results = self.list_hardware(private_ip=ip, mask="id")
        if results:
            return [result['id'] for result in results]
781027
def peers(self):
        

        resp = self.call('peers')

        result = {}
        peers = resp.get('peers') or {}

        for host, version in peers.items():
            result[host] = int(version)

        return result
296782
def instance_ip_grouping_key():
    """"""
    with closing(socket.socket(socket.AF_INET, socket.SOCK_DGRAM)) as s:
        s.connect(('localhost', 0))
        return {'instance': s.getsockname()[0]}
357523
def _parse_hostname(self):
        
        value = 'localhost'
        match = re.search(r'^hostname ([^\s]+)$', self.config, re.M)
        if match:
            value = match.group(1)
        return dict(hostname=value)
1194023
def dns_name(self):
        
        for scope in ['public', 'local-cloud']:
            addresses = self.safe_data['addresses'] or []
            addresses = [address for address in addresses
                         if address['scope'] == scope]
            if addresses:
                return addresses[0]['value']
        return None