From 094fe3aafbcc4799158adace2f55775d7e102a2f Mon Sep 17 00:00:00 2001 From: Rodion Promyshlennikov Date: Tue, 12 Jul 2016 16:50:45 +0300 Subject: [PATCH] Add tests for different Neutron configurations Add test VLAN + DVR deploy. Add test VxLAN + L2pop + DVR deploy. Add test VLAN + L3HA deploy. Add test VxLAN + L3HA deploy. Small fixes in docstring for consistency. Added controller HA configuration for cluster. Change-Id: I9f827ed4aff755088855d8ca5656ad430a85feb7 --- doc/toolchain.rst | 7 + stacklight_tests/helpers/helpers.py | 21 ++- stacklight_tests/toolchain/test_neutron.py | 169 ++++++++++++++++-- .../toolchain/test_post_install.py | 6 +- .../toolchain/toolchain_settings.py | 8 + 5 files changed, 192 insertions(+), 19 deletions(-) diff --git a/doc/toolchain.rst b/doc/toolchain.rst index 1f4ef9f..ebd917b 100644 --- a/doc/toolchain.rst +++ b/doc/toolchain.rst @@ -36,3 +36,10 @@ Network templates .. automodule:: stacklight_tests.toolchain.test_network_templates :members: + + +Neutron configuration +===================== + +.. automodule:: stacklight_tests.toolchain.test_neutron + :members: diff --git a/stacklight_tests/helpers/helpers.py b/stacklight_tests/helpers/helpers.py index 245ebf1..c6d6349 100644 --- a/stacklight_tests/helpers/helpers.py +++ b/stacklight_tests/helpers/helpers.py @@ -419,7 +419,7 @@ class PluginHelper(object): remote.check_call(cmd) def fuel_create_repositories(self, nodes): - """Start task to setup repositories on provided nodes + """Start task to setup repositories on provided nodes. :param nodes: list of nodes to run task on them :type nodes: list @@ -580,7 +580,7 @@ class PluginHelper(object): def check_pacemaker_resource(self, resource_name, role): """Check that the pacemaker resource is started on nodes with given - role + role. :param resource_name: the name of the pacemaker resource :type resource_name: str :param role: the role of node when pacemaker is running @@ -606,3 +606,20 @@ class PluginHelper(object): resource_name, pcm_nodes), config), None, 'Resource [{0}] is not properly configured'.format( resource_name)) + + def update_neutron_advanced_configuration(self, option, value): + """Method updates current cluster neutron advanced configuration option + with provided value. + + :param option: option to set + :type option: str + :param value: value to set + :type value: any + :return: None + """ + attributes = self.nailgun_client.get_cluster_attributes( + self.cluster_id) + nac_subdict = attributes['editable']['neutron_advanced_configuration'] + nac_subdict[option]['value'] = value + self.nailgun_client.update_cluster_attributes( + self.cluster_id, attributes) diff --git a/stacklight_tests/toolchain/test_neutron.py b/stacklight_tests/toolchain/test_neutron.py index 4dd3a33..de7e910 100644 --- a/stacklight_tests/toolchain/test_neutron.py +++ b/stacklight_tests/toolchain/test_neutron.py @@ -25,6 +25,36 @@ class TestToolchainNeutron(api.ToolchainApi): configurations. """ + def _deploy_with_neutron_configuration(self, caller, config=None, + advanced_options=(), is_ha=False): + self.check_run(caller) + base_snapshot_name = "ready_with_3_slaves" + nodes = self.settings.base_nodes + if is_ha: + base_snapshot_name = "ready_with_5_slaves" + nodes = self.settings.ha_controller_nodes + self.env.revert_snapshot(base_snapshot_name) + + self.prepare_plugins() + + self.helpers.create_cluster( + name=caller, + settings=config + ) + + self.activate_plugins() + + for option in advanced_options: + self.helpers.update_neutron_advanced_configuration(*option) + + self.helpers.deploy_cluster(nodes, + verify_network=True) + self.check_plugins_online() + + self.helpers.run_ostf() + + self.env.make_snapshot(caller, is_make=True) + @test(depends_on_groups=["prepare_slaves_3"], groups=["deploy_toolchain_neutron_vxlan", "deploy", "toolchain", "network_configuration"]) @@ -47,25 +77,136 @@ class TestToolchainNeutron(api.ToolchainApi): Duration 60m Snapshot deploy_toolchain_neutron_vxlan """ - self.check_run("deploy_toolchain_neutron_vxlan") - self.env.revert_snapshot("ready_with_3_slaves") - - self.prepare_plugins() - - self.helpers.create_cluster( - name="deploy_toolchain_neutron_vxlan", - settings={ + self._deploy_with_neutron_configuration( + "deploy_toolchain_neutron_vxlan", + config={ "net_provider": "neutron", "net_segment_type": settings.NEUTRON_SEGMENT["tun"] } ) - self.activate_plugins() + @test(depends_on_groups=["prepare_slaves_3"], + groups=["deploy_toolchain_neutron_vlan_dvr", "deploy", + "toolchain", "network_configuration"]) + @log_snapshot_after_test + def deploy_toolchain_neutron_vlan_dvr(self): + """Deploy a cluster with the LMA Toolchain plugins with + Neutron VLAN segmentation and DVR feature. - self.helpers.deploy_cluster(self.settings.base_nodes, - verify_network=True) - self.check_plugins_online() + Scenario: + 1. Upload the LMA Toolchain plugins to the master node + 2. Install the plugins + 3. Create the cluster using VLAN segmentation + 4. Set DVR option + 5. Add 1 node with controller role + 6. Add 1 node with compute and cinder roles + 7. Add 1 node with plugin roles + 8. Deploy the cluster + 9. Check that LMA Toolchain plugins are running + 10. Run OSTF - self.helpers.run_ostf() + Duration 60m + Snapshot deploy_toolchain_neutron_vlan_dvr + """ + options = ('neutron_dvr', True), + self._deploy_with_neutron_configuration( + "deploy_toolchain_neutron_vlan_dvr", advanced_options=options) - self.env.make_snapshot("deploy_toolchain_neutron_vxlan", is_make=True) + @test(depends_on_groups=["prepare_slaves_5"], + groups=["deploy_toolchain_neutron_vlan_l3ha", "deploy", + "toolchain", "network_configuration"]) + @log_snapshot_after_test + def deploy_toolchain_neutron_vlan_l3ha(self): + """Deploy a cluster with the LMA Toolchain plugins with + Neutron VLAN segmentation and L3HA feature. + + Scenario: + 1. Upload the LMA Toolchain plugins to the master node + 2. Install the plugins + 3. Create the cluster using VLAN segmentation + 4. Set L3HA option + 5. Add 1 node with controller role + 6. Add 1 node with compute and cinder roles + 7. Add 1 node with plugin roles + 8. Deploy the cluster + 9. Check that LMA Toolchain plugins are running + 10. Run OSTF + + Duration 60m + Snapshot deploy_toolchain_neutron_vlan_l3ha + """ + options = ('neutron_l3_ha', True), + self._deploy_with_neutron_configuration( + "deploy_toolchain_neutron_vlan_l3ha", + advanced_options=options, is_ha=True) + + @test(depends_on_groups=["prepare_slaves_3"], + groups=["deploy_toolchain_neutron_vxlan_l2pop_dvr", "deploy", + "toolchain", "network_configuration"]) + @log_snapshot_after_test + def deploy_toolchain_neutron_vxlan_l2pop_dvr(self): + """Deploy a cluster with the LMA Toolchain plugins with + Neutron VxLAN segmentation and DVR feature. + + Scenario: + 1. Upload the LMA Toolchain plugins to the master node + 2. Install the plugins + 3. Create the cluster using VxLAN segmentation + 4. Set L2pop and DVR options + 5. Add 1 node with controller role + 6. Add 1 node with compute and cinder roles + 7. Add 1 node with plugin roles + 8. Deploy the cluster + 9. Check that LMA Toolchain plugins are running + 10. Run OSTF + + Duration 60m + Snapshot deploy_toolchain_neutron_vxlan_l2pop_dvr + """ + + options = (('neutron_l2_pop', True), + ('neutron_dvr', True)) + + self._deploy_with_neutron_configuration( + "deploy_toolchain_neutron_vxlan_l2pop_dvr", + config={ + "net_provider": "neutron", + "net_segment_type": settings.NEUTRON_SEGMENT["tun"] + }, + advanced_options=options + ) + + @test(depends_on_groups=["prepare_slaves_5"], + groups=["deploy_toolchain_neutron_vxlan_l3ha", "deploy", + "toolchain", "network_configuration"]) + @log_snapshot_after_test + def deploy_toolchain_neutron_vxlan_l3ha(self): + """Deploy a cluster with the LMA Toolchain plugins with + Neutron VxLAN segmentation and L3HA feature. + + Scenario: + 1. Upload the LMA Toolchain plugins to the master node + 2. Install the plugins + 3. Create the cluster using VxLAN segmentation + 4. Set L3HA option + 5. Add 1 node with controller role + 6. Add 1 node with compute and cinder roles + 7. Add 1 node with plugin roles + 8. Deploy the cluster + 9. Check that LMA Toolchain plugins are running + 10. Run OSTF + + Duration 60m + Snapshot deploy_toolchain_neutron_vxlan_l3ha + """ + + options = ('neutron_l3_ha', True), + + self._deploy_with_neutron_configuration( + "deploy_toolchain_neutron_vxlan_l3ha", + config={ + "net_provider": "neutron", + "net_segment_type": settings.NEUTRON_SEGMENT["tun"] + }, + advanced_options=options, is_ha=True + ) diff --git a/stacklight_tests/toolchain/test_post_install.py b/stacklight_tests/toolchain/test_post_install.py index 8ae478a..5d56c47 100644 --- a/stacklight_tests/toolchain/test_post_install.py +++ b/stacklight_tests/toolchain/test_post_install.py @@ -72,9 +72,9 @@ class TestToolchainPostInstallation(api.ToolchainApi): 4. Add 3 nodes with the plugin roles 5. Deploy the cluster 6. Redeploy the nodes that existed before the last deploy (MOS 8 - only) - 6. Check that LMA Toolchain plugins are running - 7. Run OSTF + only) + 7. Check that LMA Toolchain plugins are running + 8. Run OSTF Duration 60m Snapshot deploy_toolchain_in_existing_environment diff --git a/stacklight_tests/toolchain/toolchain_settings.py b/stacklight_tests/toolchain/toolchain_settings.py index 5fa25f8..2d77b5a 100644 --- a/stacklight_tests/toolchain/toolchain_settings.py +++ b/stacklight_tests/toolchain/toolchain_settings.py @@ -33,6 +33,14 @@ base_nodes = { 'slave-03': stacklight_roles } +ha_controller_nodes = { + 'slave-01': ['controller'], + 'slave-02': ['controller'], + 'slave-03': ['controller'], + 'slave-04': ['compute', 'cinder'], + 'slave-05': stacklight_roles, +} + full_ha_nodes = { 'slave-01': ['controller'], 'slave-02': ['controller'],