def validate_network_setup(nets, bonds, net_info): kernel_nics = nics() kernel_bonds = Bond.bonds() for net, attrs in six.iteritems(nets): validate_net_configuration(net, attrs, bonds, kernel_bonds, kernel_nics) for bond, attrs in six.iteritems(bonds): validate_bond_configuration(bond, attrs, nets, net_info['networks'], kernel_nics)
def validate_network_setup(nets, bonds, net_info): kernel_nics = nics() kernel_bonds = Bond.bonds() for net, attrs in six.iteritems(nets): validate_net_configuration( net, attrs, bonds, kernel_bonds, kernel_nics) for bond, attrs in six.iteritems(bonds): validate_bond_configuration( bond, attrs, nets, net_info['networks'], kernel_nics)
def permanent_address(): paddr = {} for b in Bond.bonds(): with open('/proc/net/bonding/' + b) as f: for line in f: if line.startswith('Slave Interface: '): slave = line[len('Slave Interface: '):-1] elif line.startswith('Permanent HW addr: ') and slave: paddr[slave] = line[len('Permanent HW addr: '):-1] return paddr
def validate_network_setup(nets, bonds): ovs_networks = info.create_netinfo(info.OvsInfo())['networks'] kernel_nics = nics() kernel_bonds = Bond.bonds() for net, attrs in six.iteritems(nets): validator.validate_net_configuration( net, attrs, bonds, kernel_bonds, kernel_nics) for bond, attrs in six.iteritems(bonds): validator.validate_bond_configuration( bond, attrs, nets, ovs_networks, kernel_nics)
def validate_network_setup(nets, bonds): ovs_networks = info.create_netinfo(info.OvsInfo())['networks'] kernel_nics = nics() kernel_bonds = Bond.bonds() for net, attrs in six.iteritems(nets): validator.validate_net_configuration(net, attrs, bonds, kernel_bonds, kernel_nics) for bond, attrs in six.iteritems(bonds): validator.validate_bond_configuration(bond, attrs, nets, ovs_networks, kernel_nics)
def validate_network_setup(nets, bonds, net_info): kernel_nics = nics() kernel_bonds = Bond.bonds() current_nets = net_info['networks'] for net, attrs in six.iteritems(nets): validate_net_configuration( net, attrs, bonds, kernel_bonds, kernel_nics, current_nets, RunningConfig().networks, ) for bond, attrs in six.iteritems(bonds): validate_bond_configuration(bond, attrs, nets, current_nets, kernel_nics) validate_nic_usage( nets, bonds, _get_kernel_nets_nics(current_nets, kernel_bonds, nets), _get_kernel_bonds_slaves(kernel_bonds, bonds), )
def test_bond_list(self, bond0, bond1, bond2): actual_bond_set = set(Bond.bonds()) expected_bond_set = {b.master for b in (bond0, bond1, bond2)} assert expected_bond_set <= actual_bond_set
def _get_kernel_bonds_slaves(): kernel_bonds_slaves = set() for bond_name in Bond.bonds(): kernel_bonds_slaves |= Bond(bond_name).slaves return kernel_bonds_slaves
def test_bond_list(self): with bond_device() as b1, bond_device() as b2, bond_device() as b3: actual_bond_set = set(Bond.bonds()) expected_bond_set = set([b1.master, b2.master, b3.master]) self.assertLessEqual(expected_bond_set, actual_bond_set)