diff --git a/fuelweb_test/helpers/multiple_networks_hacks.py b/fuelweb_test/helpers/multiple_networks_hacks.py index f6f88c458..9301882a7 100644 --- a/fuelweb_test/helpers/multiple_networks_hacks.py +++ b/fuelweb_test/helpers/multiple_networks_hacks.py @@ -43,7 +43,8 @@ def configure_second_admin_dhcp(remote, interface): def configure_second_admin_firewall(remote, network, netmask, interface, master_ip): # Allow input/forwarding for nodes from the second admin network and - # enable source NAT for UDP (tftp) traffic on master node + # enable source NAT for UDP (tftp) and HTTP (proxy server) traffic + # on master node rules = [ ('-I INPUT -i {0} -m comment --comment "input from 2nd admin network" ' '-j ACCEPT').format(interface), @@ -53,7 +54,9 @@ def configure_second_admin_firewall(remote, network, netmask, interface, ("-t nat -I POSTROUTING -o {0} -d {1}/{2} -p udp -m addrtype " "--src-type LOCAL -j SNAT --to-source {3}").format(interface, network, netmask, - master_ip) + master_ip), + ("-t nat -I POSTROUTING -d {0}/{1} -p tcp --dport 8888 -j SNAT " + "--to-source {2}").format(network, netmask, master_ip) ] for rule in rules: diff --git a/fuelweb_test/models/fuel_web_client.py b/fuelweb_test/models/fuel_web_client.py index 5b45f5a16..1b38330f3 100644 --- a/fuelweb_test/models/fuel_web_client.py +++ b/fuelweb_test/models/fuel_web_client.py @@ -402,7 +402,8 @@ class FuelWebClient(object): release_name=help_data.OPENSTACK_RELEASE, mode=DEPLOYMENT_MODE_HA, port=514, - release_id=None, ): + release_id=None, + configure_ssl=True, ): """Creates a cluster :param name: :param release_name: @@ -515,13 +516,13 @@ class FuelWebClient(object): self.update_nodegroups(cluster_id, node_groups) self.update_nodegroups_network_configuration(cluster_id) - cn = self.get_public_vip(cluster_id) - change_cluster_ssl_config(attributes, cn) - logger.debug("Try to update cluster " "with next attributes {0}".format(attributes)) self.client.update_cluster_attributes(cluster_id, attributes) + if configure_ssl: + self.ssl_configure(cluster_id) + if not cluster_id: raise Exception("Could not get cluster '%s'" % name) # TODO: rw105719 @@ -530,6 +531,15 @@ class FuelWebClient(object): return cluster_id + @logwrap + def ssl_configure(self, cluster_id): + attributes = self.client.get_cluster_attributes(cluster_id) + cn = self.get_public_vip(cluster_id) + change_cluster_ssl_config(attributes, cn) + logger.debug("Try to update cluster " + "with next attributes {0}".format(attributes)) + self.client.update_cluster_attributes(cluster_id, attributes) + @logwrap def vcenter_configure(self, cluster_id, vcenter_value=None, multiclusters=None, vc_glance=None, @@ -1345,7 +1355,7 @@ class FuelWebClient(object): networks['public']['ip_range'] = [ str(static[2]), str(static[-1])] - # use the secong half of public network as floating range + # use the second half of public network as floating range net_settings[net_provider]['config']['floating_ranges'] = \ [[str(floating[0]), str(floating[-2])]] diff --git a/fuelweb_test/tests/test_multiple_networks.py b/fuelweb_test/tests/test_multiple_networks.py index 1abfd6a95..c0b3c1e52 100644 --- a/fuelweb_test/tests/test_multiple_networks.py +++ b/fuelweb_test/tests/test_multiple_networks.py @@ -12,8 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. +from ipaddr import IPAddress + from proboscis import SkipTest from proboscis import test +from proboscis.asserts import assert_true from fuelweb_test.helpers.decorators import check_fuel_statistics from fuelweb_test.helpers.decorators import log_snapshot_after_test @@ -23,6 +26,7 @@ from fuelweb_test.settings import NEUTRON_SEGMENT from fuelweb_test.settings import NODEGROUPS from fuelweb_test.tests.base_test_case import TestBasic from fuelweb_test.tests.base_test_case import SetupEnvironment +from fuelweb_test import logger @test(groups=["multiple_cluster_networks", "thread_7"]) @@ -177,3 +181,111 @@ class TestMultipleClusterNets(TestBasic): self.show_step(9) self.fuel_web.run_ostf(cluster_id=cluster_id) self.env.make_snapshot("deploy_ceph_ha_nodegroups") + + @test(depends_on=[SetupEnvironment.prepare_release], + groups=["deploy_controllers_from_custom_nodegroup", "thread_7", + "multiple_cluster_networks"]) + @log_snapshot_after_test + def deploy_controllers_from_custom_nodegroup(self): + """Assigning controllers to non-default nodegroup + + Scenario: + 1. Revert snapshot with ready master node + 2. Create environment with Neutron VXLAN and custom nodegroup + 3. Configure network floating ranges to use public network + from custom nodegroup + 4. Bootstrap slaves from custom nodegroup + 5. Bootstrap slave nodes from default nodegroup + 6. Add 3 nodes from 'custom' nodegroup as controllers + Add 2 nodes from 'default' nodegroup as compute and cinder + 7. Run network verification + 8. Check addresses allocated for VIPs belong to networks + from custom nodegroup + 9. Deploy environment + 10. Run network verification + 11. Run OSTF + + Duration 120m + Snapshot deploy_controllers_from_custom_nodegroup + + """ + + if not MULTIPLE_NETWORKS: + raise SkipTest() + + self.show_step(1) + self.env.revert_snapshot("ready") + + self.show_step(2) + cluster_id = self.fuel_web.create_cluster( + name=self.__class__.__name__, + mode=DEPLOYMENT_MODE_HA, + settings={ + "net_provider": 'neutron', + "net_segment_type": NEUTRON_SEGMENT['tun'] + }, + configure_ssl=False + ) + + self.show_step(3) + # floating range + public2_cidr = self.env.d_env.get_network(name='public2').ip + new_settings_float = { + 'floating_ranges': [[str(public2_cidr[public2_cidr.numhosts / 2]), + str(public2_cidr[-2])]] + } + self.fuel_web.client.update_network(cluster_id, new_settings_float) + + self.show_step(4) + self.env.bootstrap_nodes(self.env.d_env.nodes().slaves[1:6:2]) # 246 + + self.show_step(5) + self.env.bootstrap_nodes(self.env.d_env.nodes().slaves[0:3:2]) # 13 + + self.show_step(6) + + default_nodegroup = NODEGROUPS[0]['name'] + custom_nodegroup = NODEGROUPS[1]['name'] + self.fuel_web.update_nodes( + cluster_id, + { + 'slave-02': [['controller'], custom_nodegroup], + 'slave-04': [['controller'], custom_nodegroup], + 'slave-06': [['controller'], custom_nodegroup], + 'slave-01': [['compute'], default_nodegroup], + 'slave-03': [['cinder'], default_nodegroup] + } + ) + + # configuring ssl after nodes added to cluster due to vips in custom ng + self.fuel_web.ssl_configure(cluster_id) + + self.show_step(7) + self.fuel_web.verify_network(cluster_id) + + self.show_step(8) + current_settings = self.fuel_web.client.get_networks(cluster_id) + check = { + 'vrouter_pub': 'public2', + 'management': 'management2', + 'public': 'public2', + 'vrouter': 'management2' + } + + for k in check: + vip = IPAddress(current_settings['vips'][k]['ipaddr']) + custom_net = self.env.d_env.get_network(name=check[k]).ip + assert_true(vip in custom_net, + '{0} is not from {1} network'.format(k, check[k])) + logger.info('{0} is from {1} network'.format(k, check[k])) + + self.show_step(9) + self.fuel_web.deploy_cluster_wait(cluster_id, timeout=150 * 60) + + self.show_step(10) + self.fuel_web.verify_network(cluster_id) + + self.show_step(11) + self.fuel_web.run_ostf(cluster_id=cluster_id) + + self.env.make_snapshot("deploy_controllers_from_custom_nodegroup")