Merge "Update tests to cover the admin interface bonding"

This commit is contained in:
Jenkins 2015-07-23 09:54:50 +00:00 committed by Gerrit Code Review
commit 9e47320d94
2 changed files with 128 additions and 137 deletions

View File

@ -1182,16 +1182,24 @@ class FuelWebClient(object):
def update_node_networks(self, node_id, interfaces_dict,
raw_data=None,
override_ifaces_params=None):
# fuelweb_admin is always on eth0
interfaces_dict['eth0'] = interfaces_dict.get('eth0', [])
if 'fuelweb_admin' not in interfaces_dict['eth0']:
interfaces_dict['eth0'].append('fuelweb_admin')
interfaces = self.client.get_node_interfaces(node_id)
if raw_data is not None:
interfaces.extend(raw_data)
def get_bond_ifaces():
# Filter out all interfaces to be bonded
ifaces = []
for bond in [i for i in interfaces if i['type'] == 'bond']:
ifaces.extend(s['name'] for s in bond['slaves'])
return ifaces
# fuelweb_admin is always on eth0 unless the interface is not bonded
if 'eth0' not in get_bond_ifaces():
interfaces_dict['eth0'] = interfaces_dict.get('eth0', [])
if 'fuelweb_admin' not in interfaces_dict['eth0']:
interfaces_dict['eth0'].append('fuelweb_admin')
def get_iface_by_name(ifaces, name):
iface = filter(lambda iface: iface['name'] == name, ifaces)
assert_true(len(iface) > 0,

View File

@ -12,7 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from copy import deepcopy
from urllib2 import HTTPError
from proboscis.asserts import assert_equal
from proboscis.asserts import assert_raises
from proboscis import test
from fuelweb_test.helpers.decorators import log_snapshot_after_test
@ -21,10 +25,53 @@ from fuelweb_test.tests.base_test_case import SetupEnvironment
from fuelweb_test.tests.base_test_case import TestBasic
BOND_CONFIG = [
{
'mac': None,
'mode': 'active-backup',
'name': 'lnx-bond0',
'slaves': [
{'name': 'eth5'},
{'name': 'eth4'},
{'name': 'eth3'},
{'name': 'eth2'}
],
'state': None,
'type': 'bond',
'assigned_networks': []
},
{
'mac': None,
'mode': 'active-backup',
'name': 'lnx-bond1',
'slaves': [
{'name': 'eth1'},
{'name': 'eth0'}
],
'state': None,
'type': 'bond',
'assigned_networks': []
}
]
INTERFACES = {
'lnx-bond0': [
'public',
'management',
'storage'
],
'lnx-bond1': ['fuelweb_admin']
}
@test(groups=["bonding_nova", "bonding_ha_one_controller", "bonding"])
class BondingHAOneController(TestBasic):
"""BondingHAOneController.""" # TODO documentation
NOVANET_BOND_CONFIG = deepcopy(BOND_CONFIG)
NOVANET_INTERFACES = deepcopy(INTERFACES)
NOVANET_INTERFACES['lnx-bond0'].append('fixed')
@test(depends_on=[SetupEnvironment.prepare_slaves_3],
groups=["deploy_bonding_nova_flat"])
@log_snapshot_after_test
@ -34,8 +81,9 @@ class BondingHAOneController(TestBasic):
Scenario:
1. Create cluster
2. Add 1 node with controller role
3. Add 1 node with compute role
4. Setup bonding for all interfaces except admin/pxe
3. Add 1 node with compute role and 1 node with cinder role
4. Setup bonding for all interfaces (including admin interface
bonding)
5. Run network verification
6. Deploy the cluster
7. Run network verification
@ -43,7 +91,6 @@ class BondingHAOneController(TestBasic):
Duration 30m
Snapshot deploy_bonding_nova_flat
"""
self.env.revert_snapshot("ready_with_3_slaves")
@ -61,43 +108,17 @@ class BondingHAOneController(TestBasic):
}
)
raw_data = [{
'mac': None,
'mode': 'active-backup',
'name': 'lnx-bond0',
'slaves': [
{'name': 'eth4'},
{'name': 'eth3'},
{'name': 'eth2'},
{'name': 'eth1'}
],
'state': None,
'type': 'bond',
'assigned_networks': []
}, ]
interfaces = {
'eth0': ['fuelweb_admin'],
'lnx-bond0': [
'public',
'management',
'fixed',
'storage'
]
}
nailgun_nodes = self.fuel_web.client.list_cluster_nodes(cluster_id)
for node in nailgun_nodes:
self.fuel_web.update_node_networks(
node['id'], interfaces_dict=interfaces,
raw_data=raw_data
node['id'], interfaces_dict=self.NOVANET_INTERFACES,
raw_data=self.NOVANET_BOND_CONFIG
)
self.fuel_web.verify_network(cluster_id)
self.fuel_web.deploy_cluster_wait(cluster_id)
self.fuel_web.deploy_cluster_wait(cluster_id, check_services=False)
self.fuel_web.verify_network(cluster_id)
self.fuel_web.run_ostf(
cluster_id=cluster_id)
self.fuel_web.run_ostf(cluster_id=cluster_id)
self.env.make_snapshot("deploy_bonding_nova_flat")
@ -111,7 +132,8 @@ class BondingHAOneController(TestBasic):
1. Create cluster
2. Add 1 node with controller role
3. Add 1 node with compute role and 1 node with cinder role
4. Setup bonding for all interfaces except admin/pxe
4. Setup bonding for all interfaces (including admin interface
bonding)
5. Run network verification
6. Deploy the cluster
7. Run network verification
@ -120,7 +142,6 @@ class BondingHAOneController(TestBasic):
Duration 30m
Snapshot deploy_bonding_nova_vlan
"""
self.env.revert_snapshot("ready_with_3_slaves")
@ -137,54 +158,70 @@ class BondingHAOneController(TestBasic):
}
)
bond_config = [{
'mac': None,
'mode': 'active-backup',
'name': 'lnx-bond0',
'slaves': [
{'name': 'eth4'},
{'name': 'eth3'},
{'name': 'eth2'},
{'name': 'eth1'}
],
'state': None,
'type': 'bond',
'assigned_networks': []
}, ]
interfaces = {
'eth0': ['fuelweb_admin'],
'lnx-bond0': [
'public',
'management',
'storage',
'fixed'
]
}
nailgun_nodes = self.fuel_web.client.list_cluster_nodes(cluster_id)
for node in nailgun_nodes:
self.fuel_web.update_node_networks(
node['id'], interfaces_dict=interfaces,
raw_data=bond_config
node['id'], interfaces_dict=self.NOVANET_INTERFACES,
raw_data=self.NOVANET_BOND_CONFIG
)
self.fuel_web.update_vlan_network_fixed(
cluster_id, amount=8, network_size=32)
self.fuel_web.verify_network(cluster_id)
self.fuel_web.deploy_cluster_wait(cluster_id)
self.fuel_web.deploy_cluster_wait(cluster_id, check_services=False)
self.fuel_web.verify_network(cluster_id)
self.fuel_web.run_ostf(
cluster_id=cluster_id)
self.fuel_web.run_ostf(cluster_id=cluster_id)
self.env.make_snapshot("deploy_bonding_nova_vlan")
@test(depends_on=[SetupEnvironment.prepare_slaves_3],
groups=["negative_admin_bonding_in_lacp_mode"])
@log_snapshot_after_test
def negative_admin_bonding_in_lacp_mode(self):
"""Verify that lacp mode cannot be enabled for admin bond
Scenario:
1. Create cluster
2. Add 1 node with controller role
3. Add 1 node with compute role and 1 node with cinder role
4. Verify that lacp mode cannot be enabled for admin bond
Duration 4m
Snapshot negative_admin_bonding_in_lacp_mode
"""
self.env.revert_snapshot("ready_with_3_slaves")
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=DEPLOYMENT_MODE,
)
self.fuel_web.update_nodes(
cluster_id, {
'slave-01': ['controller'],
'slave-02': ['compute'],
'slave-03': ['cinder']
}
)
nailgun_nodes = self.fuel_web.client.list_cluster_nodes(cluster_id)
invalid_bond_conf = deepcopy(self.NOVANET_BOND_CONFIG)
invalid_bond_conf[1]['mode'] = '802.3ad'
assert_raises(
HTTPError,
self.fuel_web.update_node_networks,
nailgun_nodes[0]['id'],
interfaces_dict=self.NOVANET_INTERFACES,
raw_data=invalid_bond_conf)
@test(groups=["bonding_neutron", "bonding_ha", "bonding"])
class BondingHA(TestBasic):
"""Tests for HA bonding."""
NEUTRON_BOND_CONFIG = deepcopy(BOND_CONFIG)
NEUTRON_INTERFACES = deepcopy(INTERFACES)
NEUTRON_INTERFACES['lnx-bond0'].append('private')
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
groups=["deploy_bonding_neutron_vlan"])
@log_snapshot_after_test
@ -195,7 +232,8 @@ class BondingHA(TestBasic):
1. Create cluster
2. Add 3 nodes with controller role
3. Add 2 node with compute role
4. Setup bonding for all interfaces except admin/pxe
4. Setup bonding for all interfaces (including admin interface
bonding)
5. Run network verification
6. Deploy the cluster
7. Run network verification
@ -204,7 +242,6 @@ class BondingHA(TestBasic):
Duration 70m
Snapshot deploy_bonding_neutron_vlan
"""
self.env.revert_snapshot("ready_with_5_slaves")
@ -229,41 +266,16 @@ class BondingHA(TestBasic):
}
)
raw_data = [{
'mac': None,
'mode': 'active-backup',
'name': 'lnx-bond0',
'slaves': [
{'name': 'eth4'},
{'name': 'eth3'},
{'name': 'eth2'},
{'name': 'eth1'}
],
'state': None,
'type': 'bond',
'assigned_networks': []
}, ]
interfaces = {
'eth0': ['fuelweb_admin'],
'lnx-bond0': [
'public',
'management',
'storage',
'private'
]
}
net_params = self.fuel_web.client.get_networks(cluster_id)
nailgun_nodes = self.fuel_web.client.list_cluster_nodes(cluster_id)
for node in nailgun_nodes:
self.fuel_web.update_node_networks(
node['id'], interfaces_dict=interfaces,
raw_data=raw_data
node['id'], interfaces_dict=self.NEUTRON_INTERFACES,
raw_data=self.NEUTRON_BOND_CONFIG
)
self.fuel_web.verify_network(cluster_id)
self.fuel_web.deploy_cluster_wait(cluster_id)
self.fuel_web.deploy_cluster_wait(cluster_id, check_services=False)
cluster = self.fuel_web.client.get_cluster(cluster_id)
assert_equal(str(cluster['net_provider']), 'neutron')
@ -271,9 +283,7 @@ class BondingHA(TestBasic):
['segmentation_type']), segment_type)
self.fuel_web.verify_network(cluster_id)
self.fuel_web.run_ostf(
cluster_id=cluster_id)
self.fuel_web.run_ostf(cluster_id=cluster_id)
self.env.make_snapshot("deploy_bonding_neutron_vlan")
@ -287,7 +297,8 @@ class BondingHA(TestBasic):
1. Create cluster
2. Add 3 nodes with controller role
3. Add 2 node with compute role
4. Setup bonding for all interfaces
4. Setup bonding for all interfaces (including admin interface
bonding)
5. Run network verification
6. Deploy the cluster
7. Run network verification
@ -295,7 +306,6 @@ class BondingHA(TestBasic):
Duration 70m
Snapshot deploy_bonding_neutron_gre
"""
self.env.revert_snapshot("ready_with_5_slaves")
@ -320,41 +330,16 @@ class BondingHA(TestBasic):
}
)
raw_data = [{
'mac': None,
'mode': 'active-backup',
'name': 'lnx-bond0',
'slaves': [
{'name': 'eth4'},
{'name': 'eth3'},
{'name': 'eth2'},
{'name': 'eth1'}
],
'state': None,
'type': 'bond',
'assigned_networks': []
}, ]
interfaces = {
'eth0': ['fuelweb_admin'],
'lnx-bond0': [
'public',
'management',
'private',
'storage'
]
}
net_params = self.fuel_web.client.get_networks(cluster_id)
nailgun_nodes = self.fuel_web.client.list_cluster_nodes(cluster_id)
for node in nailgun_nodes:
self.fuel_web.update_node_networks(
node['id'], interfaces_dict=interfaces,
raw_data=raw_data
node['id'], interfaces_dict=self.NEUTRON_INTERFACES,
raw_data=self.NEUTRON_BOND_CONFIG
)
self.fuel_web.verify_network(cluster_id)
self.fuel_web.deploy_cluster_wait(cluster_id)
self.fuel_web.deploy_cluster_wait(cluster_id, check_services=False)
cluster = self.fuel_web.client.get_cluster(cluster_id)
assert_equal(str(cluster['net_provider']), 'neutron')
@ -362,8 +347,6 @@ class BondingHA(TestBasic):
['segmentation_type']), segment_type)
self.fuel_web.verify_network(cluster_id)
self.fuel_web.run_ostf(
cluster_id=cluster_id)
self.fuel_web.run_ostf(cluster_id=cluster_id)
self.env.make_snapshot("deploy_bonding_neutron_gre")