Add test for applying of config for list of nodes

Change-Id: Iefc271503e2d0dd73a1f6ffb1cd802b940a7c139
Closes-Bug: #1561482
(cherry picked from commit ce650857f7)
This commit is contained in:
Alice 2016-05-13 17:59:21 +03:00 committed by Alisa Tselovalnikova
parent 28da80608a
commit 10d514e22d
2 changed files with 65 additions and 1 deletions

View File

@ -563,13 +563,14 @@ class NailgunClient(object):
@logwrap
@json_parse
def upload_configuration(self, config, cluster_id, role=None,
node_id=None):
node_id=None, node_ids=None):
"""Upload configuration.
:param config: a dictionary of configuration to upload.
:param cluster_id: An integer number of cluster id.
:param role: a string of role name.
:param node_id: An integer number of node id.
:param node_ids: a list of node ids
:return: a decoded JSON response.
"""
data = {'cluster_id': cluster_id, 'configuration': config}
@ -577,6 +578,8 @@ class NailgunClient(object):
data['node_role'] = role
if node_id is not None:
data['node_id'] = node_id
if node_ids is not None:
data['node_ids'] = node_ids
url = '/api/openstack-config/'
return self.client.post(url, data=data)

View File

@ -1408,3 +1408,64 @@ class ServicesReconfiguration(TestBasic):
self.show_step(11)
self.check_config_on_remote(computes, structured_config)
self.env.make_snapshot("reconfigure_with_new_fields")
@test(depends_on_groups=['basic_env_for_reconfiguration'],
groups=["services_reconfiguration_thread_2",
"reconfigure_ml2_vlan_range_for_suite_of_nodes"])
@log_snapshot_after_test
def reconfigure_ml2_vlan_range_for_suite_of_nodes(self):
"""Reconfigure neutron ml2 VLAN range for suite of controller nodes
Scenario:
1. Revert snapshot "basic_env_for_reconfiguration"
2. Upload a new VLAN range(minimal range) for suite of controller
nodes
3. Get uptime of process "neutron-server" on each controller
4. Apply a new openstack configuration to all controller nodes
5. Wait for configuration applying
6. Check that service "neutron-server" was restarted
7. Verify ml2 plugin settings
8. Try to create two private networks, check that the second
network is failed to create
Snapshot: reconfigure_ml2_vlan_range_for_suite_of_nodes
"""
self.show_step(1)
self.env.revert_snapshot("basic_env_for_reconfiguration")
cluster_id = self.fuel_web.get_last_created_cluster()
controllers = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
cluster_id, ['controller'])
controller_ids = [int(ctrl['id']) for ctrl in controllers]
self.show_step(2)
config = utils.get_config_template('neutron')
structured_config = get_structured_config_dict(config)
self.fuel_web.client.upload_configuration(config,
cluster_id,
node_ids=controller_ids)
self.show_step(3)
service_name = 'neutron-server'
uptimes = self.get_service_uptime(controllers, service_name)
self.show_step(4)
task = self.fuel_web.client.apply_configuration(cluster_id)
self.show_step(5)
self.fuel_web.assert_task_success(task, timeout=480, interval=5)
self.show_step(6)
self.check_service_was_restarted(controllers, uptimes, service_name)
self.show_step(7)
self.check_config_on_remote(controllers, structured_config)
self.show_step(8)
os_conn = os_actions.OpenStackActions(
self.fuel_web.get_public_vip(cluster_id))
self.check_ml2_vlan_range(os_conn)
snapshotname = "reconfigure_ml2_vlan_range_for_suite_of_nodes"
self.env.make_snapshot(snapshotname)