Returns the bridge to which the interfaces are bond to

    CLI Example:

    .. code-block:: bash

        salt '*' bridge.find_interfaces eth0 [eth1...]
766650
def find_interfaces(*args):
    '''
    
    '''
    brs = _os_dispatch('brshow')
    if not brs:
        return None

    iflist = {}

    for iface in args:
        for br in brs:
            try:  # a bridge may not contain interfaces
                if iface in brs[br]['interfaces']:
                    iflist[iface] = br
            except Exception:
                pass

    return iflist
1041403
def ipoib_interfaces():
    """"""
    interfaces = []

    for interface in network_interfaces():
        try:
            driver = re.search('^driver: (.+)$', subprocess.check_output([
                'ethtool', '-i',
                interface]), re.M).group(1)

            if driver in IPOIB_DRIVERS:
                interfaces.append(interface)
        except Exception:
            log("Skipping interface %s" % interface, level=INFO)
            continue

    return interfaces
336527
def in6_getifaddr():
    

    # List all network interfaces
    if OPENBSD:
        try:
            f = os.popen("%s" % conf.prog.ifconfig)
        except OSError:
            log_interactive.warning("Failed to execute ifconfig.")
            return []

        # Get the list of network interfaces
        splitted_line = []
        for l in f:
            if "flags" in l:
                iface = l.split()[0].rstrip(':')
                splitted_line.append(iface)

    else:  # FreeBSD, NetBSD or Darwin
        try:
            f = os.popen("%s -l" % conf.prog.ifconfig)
        except OSError:
            log_interactive.warning("Failed to execute ifconfig.")
            return []

        # Get the list of network interfaces
        splitted_line = f.readline().rstrip().split()

    ret = []
    for i in splitted_line:
        ret += _in6_getifaddr(i)
    return ret
1261597
def get_interface(self, fullname):
        
        result = None
        [modname, iname] = fullname.split(".")
        module = self.get(modname)
        if module is not None:
            if iname in module.interfaces:
                result = module.interfaces[iname]
        return result
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
921519
def get_network_interface(name=None, network_interface_id=None, region=None,
                          key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    r = {}
    result = _get_network_interface(conn, name, network_interface_id)
    if 'error' in result:
        if result['error']['message'] == 'No ENIs found.':
            r['result'] = None
            return r
        return result
    eni = result['result']
    r['result'] = _describe_network_interface(eni)
    return r
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
1206996
def get_interfaces(zone, permanent=True):
    '''
    
    '''
    cmd = '--zone={0} --list-interfaces'.format(zone)

    if permanent:
        cmd += ' --permanent'

    return __firewall_cmd(cmd).split()
775060
def iterbridges():
    '''  '''
    net_files = os.listdir(SYSFS_NET_PATH)
    for d in net_files:
        path = os.path.join(SYSFS_NET_PATH, d)
        if not os.path.isdir(path):
            continue
        if os.path.exists(os.path.join(path, b"bridge")):
            yield Bridge(d)
866363
def _find_interfaces_ip(mac):
    '''
    
    '''
    try:
        mac = napalm_helpers.convert(napalm_helpers.mac, mac)
    except AddrFormatError:
        return ('', '', [])

    all_interfaces = _get_mine('net.interfaces')
    all_ipaddrs = _get_mine('net.ipaddrs')

    for device, device_interfaces in six.iteritems(all_interfaces):
        if not device_interfaces.get('result', False):
            continue
        for interface, interface_details in six.iteritems(device_interfaces.get('out', {})):
            try:
                interface_mac = napalm_helpers.convert(napalm_helpers.mac, interface_details.get('mac_address'))
            except AddrFormatError:
                continue
            if mac != interface_mac:
                continue
            interface_ipaddrs = all_ipaddrs.get(device, {}).get('out', {}).get(interface, {})
            ip_addresses = interface_ipaddrs.get('ipv4', {})
            ip_addresses.update(interface_ipaddrs.get('ipv6', {}))
            interface_ips = ['{0}/{1}'.format(ip_addr,
                                              addr_details.get('prefix_length', '32'))
                             for ip_addr, addr_details in six.iteritems(ip_addresses)]
            return device, interface, interface_ips

    return ('', '', [])
808717
def cmp_update_bond_intf(self, bond_interface):
        
        if bond_interface != self.bond_interface:
            self.bond_interface = bond_interface
            self.bond_member_ports = sys_utils.get_member_ports(bond_interface)
            return True
        return False
505067
def get_file_port(self):
        
        eths = self.get_ethernet_port(bond=False)
        las = self.get_link_aggregation()
        return eths + las
644518
def _parse_interfaces(self):
        
        interfaces = dict()
        names = re.findall(r'^interface (Po.+)$', self.config, re.M)
        for name in names:
            config = self.get_block('interface %s' % name)
            match = re.search(r'mlag (\d+)', config)
            if match:
                interfaces[name] = dict(mlag_id=match.group(1))
        return dict(interfaces=interfaces)
103206
def build_interface(iface, iface_type, enabled, **settings):
    '''
    
    '''
    if __grains__['lsb_distrib_id'] == 'nilrt':
        raise salt.exceptions.CommandExecutionError('Not supported in this version.')
    if iface_type != 'eth':
        raise salt.exceptions.CommandExecutionError('Interface type not supported: {0}:'.format(iface_type))

    if 'proto' not in settings or settings['proto'] == 'dhcp':  # default protocol type used is dhcp
        set_dhcp_linklocal_all(iface)
    elif settings['proto'] != 'static':
        exc_msg = 'Protocol type: {0} is not supported'.format(settings['proto'])
        raise salt.exceptions.CommandExecutionError(exc_msg)
    else:
        address = settings['ipaddr']
        netmask = settings['netmask']
        gateway = settings['gateway']
        dns = []
        for key, val in six.iteritems(settings):
            if 'dns' in key or 'domain' in key:
                dns += val
        set_static_all(iface, address, netmask, gateway, dns)

    if enabled:
        up(iface)

    return get_interface(iface)
214779
def get_method_bridges(self, name, arg_types=()):
        

        for m in self.get_methods_by_name(name):
            if ((m.is_bridge() and
                 m.get_arg_type_descriptors() == arg_types)):
                yield m
1231798
def _parse_settings_eth(opts, iface_type, enabled, iface):
    '''
    
    '''
    adapters = salt.utils.odict.OrderedDict()
    adapters[iface] = salt.utils.odict.OrderedDict()

    adapters[iface]['type'] = iface_type

    adapters[iface]['data'] = salt.utils.odict.OrderedDict()
    iface_data = adapters[iface]['data']
    iface_data['inet'] = salt.utils.odict.OrderedDict()
    iface_data['inet6'] = salt.utils.odict.OrderedDict()

    if enabled:
        adapters[iface]['enabled'] = True

    if opts.get('hotplug', False):
        adapters[iface]['hotplug'] = True

    if opts.get('enable_ipv6', None) and opts.get('iface_type', '') == 'vlan':
        iface_data['inet6']['vlan_raw_device'] = (
            re.sub(r'\.\d*', '', iface))

    for addrfam in ['inet', 'inet6']:
        if iface_type not in ['bridge']:
            tmp_ethtool = _parse_ethtool_opts(opts, iface)
            if tmp_ethtool:
                ethtool = {}
                for item in tmp_ethtool:
                    ethtool[_ETHTOOL_CONFIG_OPTS[item]] = tmp_ethtool[item]

                iface_data[addrfam]['ethtool'] = ethtool
                # return a list of sorted keys to ensure consistent order
                iface_data[addrfam]['ethtool_keys'] = sorted(ethtool)

        if iface_type == 'bridge':
            bridging = _parse_bridge_opts(opts, iface)
            if bridging:
                iface_data[addrfam]['bridging'] = bridging
                iface_data[addrfam]['bridging_keys'] = sorted(bridging)
                iface_data[addrfam]['addrfam'] = addrfam

        elif iface_type == 'bond':
            bonding = _parse_settings_bond(opts, iface)
            if bonding:
                iface_data[addrfam]['bonding'] = bonding
                iface_data[addrfam]['bonding']['slaves'] = opts['slaves']
                iface_data[addrfam]['bonding_keys'] = sorted(bonding)
                iface_data[addrfam]['addrfam'] = addrfam

        elif iface_type == 'slave':
            adapters[iface]['master'] = opts['master']

            opts['proto'] = 'manual'
            iface_data[addrfam]['master'] = adapters[iface]['master']
            iface_data[addrfam]['addrfam'] = addrfam

        elif iface_type == 'vlan':
            iface_data[addrfam]['vlan_raw_device'] = re.sub(r'\.\d*', '', iface)
            iface_data[addrfam]['addrfam'] = addrfam

        elif iface_type == 'pppoe':
            tmp_ethtool = _parse_ethtool_pppoe_opts(opts, iface)
            if tmp_ethtool:
                for item in tmp_ethtool:
                    adapters[iface]['data'][addrfam][_DEB_CONFIG_PPPOE_OPTS[item]] = tmp_ethtool[item]
            iface_data[addrfam]['addrfam'] = addrfam

    opts.pop('mode', None)

    for opt, val in opts.items():
        inet = None
        if opt.startswith('ipv4'):
            opt = opt[4:]
            inet = 'inet'
            iface_data['inet']['addrfam'] = 'inet'
        elif opt.startswith('ipv6'):
            iface_data['inet6']['addrfam'] = 'inet6'
            opt = opt[4:]
            inet = 'inet6'
        elif opt in ['ipaddr', 'address', 'ipaddresses', 'addresses', 'gateway', 'proto']:
            iface_data['inet']['addrfam'] = 'inet'
            inet = 'inet'

        _opt = SALT_ATTR_TO_DEBIAN_ATTR_MAP.get(opt, opt)
        _debopt = _opt.replace('-', '_')

        for addrfam in ['inet', 'inet6']:
            (valid, value, errmsg) = _validate_interface_option(_opt, val, addrfam=addrfam)
            if not valid:
                continue
            if inet is None and _debopt not in iface_data[addrfam]:
                iface_data[addrfam][_debopt] = value
            elif inet == addrfam:
                iface_data[addrfam][_debopt] = value

    for opt in ['up_cmds', 'pre_up_cmds', 'post_up_cmds',
                'down_cmds', 'pre_down_cmds', 'post_down_cmds']:
        if opt in opts:
            iface_data['inet'][opt] = opts[opt]
            iface_data['inet6'][opt] = opts[opt]

    # Remove incomplete/disabled inet blocks
    for (addrfam, opt) in [('inet', 'enable_ipv4'), ('inet6', 'enable_ipv6')]:
        if opts.get(opt, None) is False:
            iface_data.pop(addrfam)
        elif iface_data[addrfam].get('addrfam', '') != addrfam:
            iface_data.pop(addrfam)

    return adapters
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)