Update bond tests according to new iface serialization

Change-Id: I9c3f4ffa504b582f52b510d62313b6b3b2c195b6
Closes-Bug: 1651960
Partial-Bug: 1644588
This commit is contained in:
Sergey Novikov 2016-12-22 17:38:41 +04:00
parent c8f829a8be
commit 452fe60d3d
4 changed files with 155 additions and 20 deletions

View File

@ -90,8 +90,8 @@ class TestOffloading(BondingTest):
nodes = self.fuel_web.client.list_cluster_nodes(cluster_id)
self.show_step(4)
bond0 = self.get_bond_interfaces(self.BOND_CONFIG, 'bond0')
bond1 = self.get_bond_interfaces(self.BOND_CONFIG, 'bond1')
bond0 = self.get_bond_interfaces(self.bond_config, 'bond0')
bond1 = self.get_bond_interfaces(self.bond_config, 'bond1')
offloadings_1 = []
offloadings_2 = []
for node in nodes:
@ -115,7 +115,7 @@ class TestOffloading(BondingTest):
self.fuel_web.update_node_networks(
node['id'],
interfaces_dict=deepcopy(self.INTERFACES),
raw_data=deepcopy(self.BOND_CONFIG))
raw_data=deepcopy(self.bond_config))
for offloading in modes:
self.fuel_web.update_offloads(
node['id'], deepcopy(offloading), offloading['name'])
@ -198,8 +198,8 @@ class TestOffloading(BondingTest):
nodes = self.fuel_web.client.list_cluster_nodes(cluster_id)
self.show_step(4)
bond0 = self.get_bond_interfaces(self.BOND_CONFIG, 'bond0')
bond1 = self.get_bond_interfaces(self.BOND_CONFIG, 'bond1')
bond0 = self.get_bond_interfaces(self.bond_config, 'bond0')
bond1 = self.get_bond_interfaces(self.bond_config, 'bond1')
offloadings_1 = []
offloadings_2 = []
for node in nodes:
@ -223,7 +223,7 @@ class TestOffloading(BondingTest):
self.fuel_web.update_node_networks(
node['id'],
interfaces_dict=deepcopy(self.INTERFACES),
raw_data=deepcopy(self.BOND_CONFIG))
raw_data=deepcopy(self.bond_config))
for offloading in modes:
self.fuel_web.update_offloads(
node['id'], deepcopy(offloading), offloading['name'])

View File

@ -80,7 +80,7 @@ class BondingHAOneController(BondingTest):
for node in nailgun_nodes:
self.fuel_web.update_node_networks(
node['id'], interfaces_dict=deepcopy(self.INTERFACES),
raw_data=deepcopy(self.BOND_CONFIG)
raw_data=deepcopy(self.bond_config)
)
self.show_step(5)
self.fuel_web.verify_network(cluster_id)
@ -147,7 +147,7 @@ class BondingHAOneController(BondingTest):
for node in nailgun_nodes:
self.fuel_web.update_node_networks(
node['id'], interfaces_dict=deepcopy(self.INTERFACES),
raw_data=deepcopy(self.BOND_CONFIG)
raw_data=deepcopy(self.bond_config)
)
self.show_step(5)
@ -205,9 +205,8 @@ class BondingHAOneController(BondingTest):
self.show_step(4)
nailgun_nodes = self.fuel_web.client.list_cluster_nodes(cluster_id)
invalid_bond_conf = deepcopy(self.BOND_CONFIG)
invalid_bond_conf = deepcopy(self.bond_config)
invalid_bond_conf[1]['mode'] = '802.3ad'
invalid_bond_conf[1]['bond_properties']['mode'] = '802.3ad'
interfaces_dict = deepcopy(self.INTERFACES)
exp_code = 400
@ -307,7 +306,7 @@ class BondingHA(BondingTest):
for node in nailgun_nodes:
self.fuel_web.update_node_networks(
node['id'], interfaces_dict=deepcopy(self.INTERFACES),
raw_data=deepcopy(self.BOND_CONFIG)
raw_data=deepcopy(self.bond_config)
)
self.show_step(5)
@ -330,7 +329,7 @@ class BondingHA(BondingTest):
self.show_step(9)
self.show_step(10)
self.show_step(11)
self.check_interfaces_config_after_reboot(cluster_id)
self.check_interfaces_config_after_reboot()
self.fuel_web.assert_ha_services_ready(cluster_id)
self.show_step(12)
@ -400,7 +399,7 @@ class BondingHA(BondingTest):
for node in nailgun_nodes:
self.fuel_web.update_node_networks(
node['id'], interfaces_dict=deepcopy(self.INTERFACES),
raw_data=deepcopy(self.BOND_CONFIG)
raw_data=deepcopy(self.bond_config)
)
self.show_step(5)
@ -423,7 +422,7 @@ class BondingHA(BondingTest):
self.show_step(9)
self.show_step(10)
self.show_step(11)
self.check_interfaces_config_after_reboot(cluster_id)
self.check_interfaces_config_after_reboot()
self.fuel_web.assert_ha_services_ready(cluster_id)
self.show_step(12)
@ -488,7 +487,7 @@ class BondingHA(BondingTest):
for node in nailgun_nodes:
self.fuel_web.update_node_networks(
node['id'], interfaces_dict=deepcopy(self.INTERFACES),
raw_data=deepcopy(self.BOND_CONFIG)
raw_data=deepcopy(self.bond_config)
)
self.show_step(5)

View File

@ -22,7 +22,7 @@ from fuelweb_test.tests.base_test_case import TestBasic
class BondingTest(TestBasic):
def __init__(self):
self.BOND_CONFIG = [
self.OLD_SERIALIZATION_BOND_CONFIG = [
{
'mac': None,
'mode': 'active-backup',
@ -55,6 +55,41 @@ class BondingTest(TestBasic):
}
]
self.NEW_SERIALIZATION_BOND_CONFIG = [
{
'mac': None,
'mode': 'active-backup',
'name': 'bond0',
'slaves': [
{'name': iface_alias('eth5')},
{'name': iface_alias('eth4')},
{'name': iface_alias('eth3')},
{'name': iface_alias('eth2')}
],
'state': None,
'type': 'bond',
'assigned_networks': [],
'attributes': {
'type__': {'type': 'hidden', 'value': 'linux'}
}
},
{
'mac': None,
'mode': 'active-backup',
'name': 'bond1',
'slaves': [
{'name': iface_alias('eth1')},
{'name': iface_alias('eth0')}
],
'state': None,
'type': 'bond',
'assigned_networks': [],
'attributes': {
'type__': {'type': 'hidden', 'value': 'linux'}
}
}
]
self.INTERFACES = {
'bond0': [
'public',
@ -65,6 +100,20 @@ class BondingTest(TestBasic):
'bond1': ['fuelweb_admin']
}
super(BondingTest, self).__init__()
self.__cluster_id = None
@property
def cluster_id(self):
if self.__cluster_id is None:
self.__cluster_id = self.fuel_web.get_last_created_cluster()
return self.__cluster_id
@property
def bond_config(self):
if self._is_old_interface_serialization_scheme():
return self.OLD_SERIALIZATION_BOND_CONFIG
else:
return self.NEW_SERIALIZATION_BOND_CONFIG
@staticmethod
def get_bond_interfaces(bond_config, bond_name):
@ -75,7 +124,13 @@ class BondingTest(TestBasic):
bond_slaves.append(slave['name'])
return bond_slaves
def check_interfaces_config_after_reboot(self, cluster_id):
def _is_old_interface_serialization_scheme(self):
node = self.fuel_web.client.list_cluster_nodes(self.cluster_id)[0]
interface = self.fuel_web.client.get_node_interfaces(node['id'])[0]
if 'interface_properties' in interface.keys():
return True
def check_interfaces_config_after_reboot(self):
network_settings = dict()
skip_interfaces = {
r'^pub-base$', r'^vr_pub-base$', r'^vr-base$', r'^mgmt-base$',
@ -83,7 +138,7 @@ class BondingTest(TestBasic):
r'^(tap|qr-|qg-|p_).*$', r'^v_vrouter.*$',
r'^v_(management|public)$'}
nodes = self.fuel_web.client.list_cluster_nodes(cluster_id)
nodes = self.fuel_web.client.list_cluster_nodes(self.cluster_id)
for node in nodes:
with self.env.d_env.get_ssh_to_remote(node['ip']) as remote:
@ -133,7 +188,7 @@ class BondingTest(TestBasic):
class BondingTestDPDK(BondingTest):
def __init__(self):
super(BondingTestDPDK, self).__init__()
self.BOND_CONFIG = [
self.OLD_SERIALIZATION_BOND_CONFIG = [
{
'mac': None,
'mode': 'active-backup',
@ -181,6 +236,87 @@ class BondingTestDPDK(BondingTest):
},
]
self.NEW_SERIALIZATION_BOND_CONFIG = [
{
'mac': None,
'mode': 'active-backup',
'name': 'bond0',
'slaves': [
{'name': iface_alias('eth3')},
{'name': iface_alias('eth2')}
],
'state': None,
'type': 'bond',
'assigned_networks': [],
'meta': {
'dpdk': {'available': True}
},
'attributes': {
'type__': {'type': 'hidden', 'value': 'linux'},
'dpdk': {
'enabled': {
'type': 'checkbox',
'value': False,
'weight': 10,
'label': 'DPDK enabled'},
'metadata': {'weight': 40, 'label': 'DPDK'}
}
}
},
{
'mac': None,
'mode': 'active-backup',
'name': 'bond1',
'slaves': [
{'name': iface_alias('eth1')},
{'name': iface_alias('eth0')}
],
'state': None,
'type': 'bond',
'assigned_networks': [],
'meta': {
'dpdk': {'available': True}
},
'attributes': {
'type__': {'type': 'hidden', 'value': 'linux'},
'dpdk': {
'enabled': {
'type': 'checkbox',
'value': False,
'weight': 10,
'label': 'DPDK enabled'},
'metadata': {'weight': 40, 'label': 'DPDK'}
}
}
},
{
'mac': None,
'mode': 'active-backup',
'name': 'bond2',
'slaves': [
{'name': iface_alias('eth5')},
{'name': iface_alias('eth4')}
],
'state': None,
'type': 'bond',
'assigned_networks': [],
'meta': {
'dpdk': {'available': True}
},
'attributes': {
'type__': {'type': 'hidden', 'value': 'linux'},
'dpdk': {
'enabled': {
'type': 'checkbox',
'value': False,
'weight': 10,
'label': 'DPDK enabled'},
'metadata': {'weight': 40, 'label': 'DPDK'}
}
}
}
]
self.INTERFACES = {
'bond0': [
'public',

View File

@ -348,7 +348,7 @@ class SupportDPDKBond(BondingTestDPDK, TestDPDK):
for node in nailgun_nodes:
self.fuel_web.update_node_networks(
node['id'], interfaces_dict=deepcopy(self.INTERFACES),
raw_data=deepcopy(self.BOND_CONFIG)
raw_data=deepcopy(self.bond_config)
)
computes = self.fuel_web.get_nailgun_cluster_nodes_by_roles(