From 10d514e22de56b06c31f6ed4ef5f86e2e52e481f Mon Sep 17 00:00:00 2001 From: Alice Date: Fri, 13 May 2016 17:59:21 +0300 Subject: [PATCH] Add test for applying of config for list of nodes Change-Id: Iefc271503e2d0dd73a1f6ffb1cd802b940a7c139 Closes-Bug: #1561482 (cherry picked from commit ce650857f79b8985bf52efa500c0b13474c375b4) --- fuelweb_test/models/nailgun_client.py | 5 +- .../tests/test_services_reconfiguration.py | 61 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/fuelweb_test/models/nailgun_client.py b/fuelweb_test/models/nailgun_client.py index b2529c23e..7a9118e52 100644 --- a/fuelweb_test/models/nailgun_client.py +++ b/fuelweb_test/models/nailgun_client.py @@ -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) diff --git a/fuelweb_test/tests/test_services_reconfiguration.py b/fuelweb_test/tests/test_services_reconfiguration.py index 22814c87c..fc256650f 100644 --- a/fuelweb_test/tests/test_services_reconfiguration.py +++ b/fuelweb_test/tests/test_services_reconfiguration.py @@ -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)