Return the salt_interface type to connect to. Either 'public_ips' (default)
    or 'private_ips'.
764706
def get_salt_interface(vm_, opts):
    '''
    
    '''
    salt_host = salt.config.get_cloud_config_value(
        'salt_interface', vm_, opts, default=False,
        search_global=False
    )

    if salt_host is False:
        salt_host = salt.config.get_cloud_config_value(
            'ssh_interface', vm_, opts, default='public_ips',
            search_global=False
        )

    return salt_host
364152
def ip_fqdn():
    '''
    
    '''
    if salt.utils.platform.is_proxy():
        return {}

    ret = {}
    ret['ipv4'] = salt.utils.network.ip_addrs(include_loopback=True)
    ret['ipv6'] = salt.utils.network.ip_addrs6(include_loopback=True)

    _fqdn = hostname()['fqdn']
    for socket_type, ipv_num in ((socket.AF_INET, '4'), (socket.AF_INET6, '6')):
        key = 'fqdn_ip' + ipv_num
        if not ret['ipv' + ipv_num]:
            ret[key] = []
        else:
            try:
                start_time = datetime.datetime.utcnow()
                info = socket.getaddrinfo(_fqdn, None, socket_type)
                ret[key] = list(set(item[4][0] for item in info))
            except socket.error:
                timediff = datetime.datetime.utcnow() - start_time
                if timediff.seconds > 5 and __opts__['__role'] == 'master':
                    log.warning(
                        'Unable to find IPv%s record for "%s" causing a %s '
                        'second timeout when rendering grains. Set the dns or '
                        '/etc/hosts for IPv%s to clear this.',
                        ipv_num, _fqdn, timediff, ipv_num
                    )
                ret[key] = []

    return ret
189319
def GetEnabledInterfaces():
  
  interfaces = []
  show_args = ['/c', 'netsh', 'show', 'interface']
  # pylint: disable=undefined-variable
  res = client_utils_common.Execute(
      'cmd', show_args, time_limit=-1, bypass_whitelist=True)
  pattern = re.compile(r'\s*')
  for line in res[0].split('\r\n'):  # res[0] is stdout.
    interface_info = pattern.split(line)
    if 'Enabled' in interface_info:
      interfaces.extend(interface_info[-1:])
  return interfaces
1194848
def interface(self):
        
        nics = set([nic.get('nicid') for nic in \
            getattr(self.engine, 'snmp_interface', [])])
        return [self.engine.interface.get(nic) for nic in nics]
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
97757
def _get_interface_ip(self, interface_name):
        
        ios_cfg = self._get_running_config()
        parse = HTParser(ios_cfg)
        children = parse.find_children("^interface %s" % interface_name)
        for line in children:
            if 'ip address' in line:
                ip_address = line.strip().split(' ')[2]
                LOG.debug("IP Address:%s", ip_address)
                return ip_address
        LOG.warning("Cannot find interface: %s", interface_name)
        return None
1236241
def _get_transport_type(self):
        ''''''
        transport_str = ''
        ip_type = 'unicast' #if IPAddress(DEST_IP).is_unicast() else 'multicast'
        for t in TRANSPORT_TYPE_LIST:
            if t not in TRANSPORT_TYPE_MAP:
                PRINT('Error param: %s'%t,RED)
                sys.exit(1)
            if t.endswith('tcp'):
                transport_str += TRANSPORT_TYPE_MAP[t]%ip_type
            else:
                transport_str += TRANSPORT_TYPE_MAP[t]%(ip_type,DEST_IP,CLIENT_PORT_RANGE)
        return transport_str
744240
def version(family='ipv4'):
    '''
    
    '''
    cmd = '{0} --version' . format(_iptables_cmd(family))
    out = __salt__['cmd.run'](cmd).split()
    return out[1]
954346
def _get_ipv4_addrs(self):
        
        addrs = self._get_addrs()
        ipv4addrs = addrs.get(netifaces.AF_INET)
        if not ipv4addrs:
            return {}
        return ipv4addrs[0]
983666
def _get_interface_info(interface):
    '''
    
    '''
    adapter_mode = _get_adapter_mode_info(interface.name)
    if adapter_mode == 'disabled':
        return _get_base_interface_info(interface)
    elif adapter_mode == 'ethercat':
        return _get_ethercat_interface_info(interface)
    return _get_tcpip_interface_info(interface)
38414
def get_interface(iface):
    '''
    
    '''
    _interfaces = get_interfaces_details()
    for _interface in _interfaces['interfaces']:
        if _interface['connectionid'] == iface:
            return _dict_to_string(_interface)
    return None
1104386
def PublicIPs(self):
		
		if not self.public_ips:  self.public_ips = clc.v2.PublicIPs(server=self,public_ips_lst=self.ip_addresses,session=self.session)

		return(self.public_ips)
1284517
def _get_network_interface(name, resource_group):
    '''
    
    '''
    public_ips = []
    private_ips = []
    netapi_versions = get_api_versions(kwargs={
        'resource_provider': 'Microsoft.Network',
        'resource_type': 'publicIPAddresses'
        }
    )
    netapi_version = netapi_versions[0]
    netconn = get_conn(client_type='network')
    netiface_query = netconn.network_interfaces.get(
        resource_group_name=resource_group,
        network_interface_name=name
    )

    netiface = netiface_query.as_dict()
    for index, ip_config in enumerate(netiface['ip_configurations']):
        if ip_config.get('private_ip_address') is not None:
            private_ips.append(ip_config['private_ip_address'])
        if 'id' in ip_config.get('public_ip_address', {}):
            public_ip_name = get_resource_by_id(
                ip_config['public_ip_address']['id'],
                netapi_version,
                'name'
            )
            public_ip = _get_public_ip(public_ip_name, resource_group)
            public_ips.append(public_ip['ip_address'])
            netiface['ip_configurations'][index]['public_ip_address'].update(public_ip)

    return netiface, public_ips, private_ips
489431
def get_ip(data):
    '''
    
    '''
    try:
        ip = data.public_ips[0]
    except Exception:
        ip = data.private_ips[0]
    return ip
420010
def get_interface_by_instance_name(self, name):
        ''''''
        with self._mutex:
            for intf in self.interfaces:
                if intf.instance_name == name:
                    return intf
            return None
133390
def get_default_gateway():
    '''
    
    '''
    try:
        return next(iter(
            x.split()[-1] for x in __salt__['cmd.run'](
                ['netsh', 'interface', 'ip', 'show', 'config'],
                python_shell=False
            ).splitlines()
            if 'Default Gateway:' in x
        ))
    except StopIteration:
        raise CommandExecutionError('Unable to find default gateway')
1202952
def interface_type(self):
        
        value = "if="
        lst = self._attributes.get("if")
        if lst is None:
            value = ""
        else:
            value += "\"" + str(lst) + "\""
        return value