Ejemplo n.º 1
0
def bondings_caps(running_config):
    ovs_bonding_caps = {}
    dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces()
    routes = netinfo._get_routes()
    for bonding, attrs in iter_ovs_bonds(running_config.bonds):
        options = get_bond_options(attrs.get('options'), keep_custom=True)
        net_info = _get_net_info(attrs, bonding, dhcpv4ifaces, dhcpv6ifaces,
                                 routes)
        net_info['slaves'] = attrs.get('nics')
        net_info['active_slave'] = _get_active_slave(bonding)
        net_info['opts'] = options
        ovs_bonding_caps[bonding] = net_info
    return ovs_bonding_caps
Ejemplo n.º 2
0
def bondings_caps(running_config):
    ovs_bonding_caps = {}
    dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces()
    routes = netinfo._get_routes()
    for bonding, attrs in iter_ovs_bonds(running_config.bonds):
        options = get_bond_options(attrs.get('options'), keep_custom=True)
        net_info = _get_net_info(attrs, bonding, dhcpv4ifaces, dhcpv6ifaces,
                                 routes)
        net_info['slaves'] = attrs.get('nics')
        net_info['active_slave'] = _get_active_slave(bonding)
        net_info['opts'] = options
        ovs_bonding_caps[bonding] = net_info
    return ovs_bonding_caps
Ejemplo n.º 3
0
def bondings_caps(running_config):
    ovs_bonding_caps = {}
    dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces()
    routes = netinfo._get_routes()
    for bonding, attrs in running_config.bonds.items():
        if is_ovs_bond(attrs):
            options = get_bond_options(attrs.get("options"), keep_custom=True)
            net_info = _get_net_info(attrs, bonding, dhcpv4ifaces, dhcpv6ifaces, routes)
            net_info["slaves"] = attrs.get("nics")
            net_info["active_slave"] = _get_active_slave(bonding)
            net_info["opts"] = options
            ovs_bonding_caps[bonding] = net_info
    return ovs_bonding_caps
Ejemplo n.º 4
0
def networks_caps(running_config):
    ovs_networks_caps = {}
    dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces()
    routes = netinfo._get_routes()
    for network, attrs in iter_ovs_nets(running_config.networks):
        interface = network if 'vlan' in attrs else BRIDGE_NAME
        net_info = _get_net_info(attrs, interface, dhcpv4ifaces, dhcpv6ifaces,
                                 routes)
        net_info['iface'] = network
        net_info['bridged'] = True
        net_info['ports'] = _list_ports(interface)
        net_info['stp'] = _get_stp(interface)
        ovs_networks_caps[network] = net_info
    return ovs_networks_caps
Ejemplo n.º 5
0
def networks_caps(running_config):
    ovs_networks_caps = {}
    dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces()
    routes = netinfo._get_routes()
    for network, attrs in iter_ovs_nets(running_config.networks):
        interface = network if 'vlan' in attrs else BRIDGE_NAME
        net_info = _get_net_info(attrs, interface, dhcpv4ifaces, dhcpv6ifaces,
                                 routes)
        net_info['iface'] = network
        net_info['bridged'] = True
        net_info['ports'] = _list_ports(interface)
        net_info['stp'] = _get_stp(interface)
        ovs_networks_caps[network] = net_info
    return ovs_networks_caps
Ejemplo n.º 6
0
def bridges_caps(running_config):
    ovs_bridges_caps = {}
    dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces()
    routes = netinfo._get_routes()
    for network, attrs in running_config.networks.items():
        if is_ovs_network(attrs):
            interface = network if "vlan" in attrs else BRIDGE_NAME
            net_info = _get_net_info(attrs, interface, dhcpv4ifaces, dhcpv6ifaces, routes)
            net_info["bridged"] = True
            net_info["ports"] = []  # TODO attached nics + vms nets
            net_info["opts"] = {}  # TODO netinfo.bridgeOpts does not work here
            net_info["stp"] = _get_stp(interface)
            ovs_bridges_caps[network] = net_info
    return ovs_bridges_caps
Ejemplo n.º 7
0
def vlans_caps(running_config):
    ovs_vlans_caps = {}
    dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces()
    routes = netinfo._get_routes()
    for network, attrs in iter_ovs_nets(running_config.networks):
        vlan = attrs.get('vlan')
        if vlan is not None:
            net_info = _get_net_info(attrs, network, dhcpv4ifaces,
                                     dhcpv6ifaces, routes)
            iface = attrs.get('bonding') or attrs.get('nic')
            net_info['iface'] = iface
            net_info['bridged'] = True
            net_info['vlanid'] = vlan
            ovs_vlans_caps['%s.%s' % (iface, vlan)] = net_info
    return ovs_vlans_caps
Ejemplo n.º 8
0
def vlans_caps(running_config):
    ovs_vlans_caps = {}
    dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces()
    routes = netinfo._get_routes()
    for network, attrs in iter_ovs_nets(running_config.networks):
        vlan = attrs.get('vlan')
        if vlan is not None:
            net_info = _get_net_info(attrs, network, dhcpv4ifaces,
                                     dhcpv6ifaces, routes)
            iface = attrs.get('bonding') or attrs.get('nic')
            net_info['iface'] = iface
            net_info['bridged'] = True
            net_info['vlanid'] = vlan
            ovs_vlans_caps['%s.%s' % (iface, vlan)] = net_info
    return ovs_vlans_caps
Ejemplo n.º 9
0
def vlans_caps(running_config):
    ovs_vlans_caps = {}
    dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces()
    routes = netinfo._get_routes()
    for network, attrs in running_config.networks.items():
        if is_ovs_network(attrs):
            vlan = attrs.get("vlan")
            if vlan is not None:
                net_info = _get_net_info(attrs, network, dhcpv4ifaces, dhcpv6ifaces, routes)
                iface = attrs.get("bonding") or attrs.get("nic")
                net_info["iface"] = iface
                net_info["bridged"] = True
                net_info["vlanid"] = vlan
                ovs_vlans_caps["%s.%s" % (iface, vlan)] = net_info
    return ovs_vlans_caps
Ejemplo n.º 10
0
def bridges_caps(running_config):
    ovs_bridges_caps = {}
    dhcpv4ifaces, dhcpv6ifaces = netinfo._get_dhclient_ifaces()
    routes = netinfo._get_routes()
    for network, attrs in iter_ovs_nets(running_config.networks):
        interface = network if 'vlan' in attrs else BRIDGE_NAME
        net_info = _get_net_info(attrs, interface, dhcpv4ifaces, dhcpv6ifaces,
                                 routes)
        net_info['bridged'] = True
        net_info['ports'] = _get_ports(network, attrs)
        # TODO netinfo._bridge_options does not work here
        net_info['opts'] = {}
        net_info['stp'] = _get_stp(interface)
        ovs_bridges_caps[network] = net_info
    return ovs_bridges_caps