# Copyright 2013 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from proboscis.asserts import assert_equal from proboscis import test from fuelweb_test.helpers import checkers from fuelweb_test.helpers import os_actions from fuelweb_test.helpers.decorators import log_snapshot_after_test from fuelweb_test.settings import DEPLOYMENT_MODE from fuelweb_test.settings import NEUTRON_SEGMENT from fuelweb_test.tests.base_test_case import SetupEnvironment from fuelweb_test.tests.base_test_case import TestBasic from fuelweb_test import logger @test(groups=["thread_1", "neutron"]) class NeutronVlan(TestBasic): """NeutronVlan.""" # TODO documentation @test(depends_on=[SetupEnvironment.prepare_slaves_3], groups=["deploy_neutron_vlan", "ha_one_controller_neutron_vlan", "deployment", "nova", "nova-compute"]) @log_snapshot_after_test def deploy_neutron_vlan(self): """Deploy cluster in ha mode with 1 controller and Neutron VLAN Scenario: 1. Create cluster 2. Add 1 node with controller role 3. Add 2 nodes with compute role 4. Deploy the cluster 5. Run network verification 6. Run OSTF Duration 35m Snapshot deploy_neutron_vlan """ self.env.revert_snapshot("ready_with_3_slaves") cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={ "net_provider": 'neutron', "net_segment_type": NEUTRON_SEGMENT['vlan'], 'tenant': 'simpleVlan', 'user': 'simpleVlan', 'password': 'simpleVlan' } ) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['compute'], 'slave-03': ['compute'] } ) self.fuel_web.deploy_cluster_wait(cluster_id) cluster = self.fuel_web.client.get_cluster(cluster_id) assert_equal(str(cluster['net_provider']), 'neutron') # assert_equal(str(cluster['net_segment_type']), segment_type) self.fuel_web.verify_network(cluster_id) self.fuel_web.run_ostf( cluster_id=cluster_id) self.env.make_snapshot("deploy_neutron_vlan", is_make=True) @test(groups=["neutron", "ha", "ha_neutron", "classic_provisioning"]) class NeutronGreHa(TestBasic): """NeutronGreHa.""" # TODO documentation @test(depends_on=[SetupEnvironment.prepare_slaves_5], groups=["deploy_neutron_gre_ha", "ha_neutron_gre"]) @log_snapshot_after_test def deploy_neutron_gre_ha(self): """Deploy cluster in HA mode with Neutron GRE (DEPRECATED) Scenario: 1. Create cluster 2. Add 3 nodes with controller role 3. Add 2 nodes with compute role 4. Deploy the cluster 5. Run network verification 6. Run OSTF Duration 80m Snapshot deploy_neutron_gre_ha """ self.env.revert_snapshot("ready_with_5_slaves") cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={ "net_provider": 'neutron', "net_segment_type": NEUTRON_SEGMENT['gre'], 'tenant': 'haGre', 'user': 'haGre', 'password': 'haGre' } ) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['controller'], 'slave-03': ['controller'], 'slave-04': ['compute'], 'slave-05': ['compute'] } ) self.fuel_web.deploy_cluster_wait(cluster_id) cluster = self.fuel_web.client.get_cluster(cluster_id) assert_equal(str(cluster['net_provider']), 'neutron') self.fuel_web.verify_network(cluster_id) devops_node = self.fuel_web.get_nailgun_primary_node( self.env.d_env.nodes().slaves[0]) logger.debug("devops node name is {0}".format(devops_node.name)) _ip = self.fuel_web.get_nailgun_node_by_name(devops_node.name)['ip'] with self.env.d_env.get_ssh_to_remote(_ip) as remote: for i in range(5): try: checkers.check_swift_ring(remote) break except AssertionError: result = remote.execute( "/usr/local/bin/swift-rings-rebalance.sh") logger.debug("command execution result is {0}" .format(result)) else: checkers.check_swift_ring(remote) self.fuel_web.run_ostf( cluster_id=cluster_id, test_sets=['ha', 'smoke', 'sanity']) self.env.make_snapshot("deploy_neutron_gre_ha") @test(groups=["neutron", "ha", "ha_neutron"]) class NeutronVlanHa(TestBasic): """NeutronVlanHa.""" # TODO documentation @test(depends_on=[SetupEnvironment.prepare_slaves_5], groups=["deploy_neutron_vlan_ha", "neutron_vlan_ha"]) @log_snapshot_after_test def deploy_neutron_vlan_ha(self): """Deploy cluster in HA mode with Neutron VLAN Scenario: 1. Create cluster 2. Add 3 nodes with controller role 3. Add 2 nodes with compute role 4. Deploy the cluster 5. Run network verification 6. Run OSTF Duration 80m Snapshot deploy_neutron_vlan_ha """ self.env.revert_snapshot("ready_with_5_slaves") cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={ "net_provider": 'neutron', "net_segment_type": NEUTRON_SEGMENT['vlan'] } ) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['controller'], 'slave-03': ['controller'], 'slave-04': ['compute'], 'slave-05': ['compute'] } ) self.fuel_web.update_internal_network(cluster_id, '192.168.196.0/22', '192.168.196.1') self.fuel_web.deploy_cluster_wait(cluster_id) cluster = self.fuel_web.client.get_cluster(cluster_id) assert_equal(str(cluster['net_provider']), 'neutron') os_conn = os_actions.OpenStackActions( self.fuel_web.get_public_vip(cluster_id)) # assert_equal(str(cluster['net_segment_type']), segment_type) self.fuel_web.check_fixed_network_cidr( cluster_id, os_conn) self.fuel_web.verify_network(cluster_id) devops_node = self.fuel_web.get_nailgun_primary_node( self.env.d_env.nodes().slaves[0]) logger.debug("devops node name is {0}".format(devops_node.name)) _ip = self.fuel_web.get_nailgun_node_by_name(devops_node.name)['ip'] with self.env.d_env.get_ssh_to_remote(_ip) as remote: for i in range(5): try: checkers.check_swift_ring(remote) break except AssertionError: result = remote.execute( "/usr/local/bin/swift-rings-rebalance.sh") logger.debug("command execution result is {0}" .format(result)) else: checkers.check_swift_ring(remote) self.fuel_web.run_ostf( cluster_id=cluster_id, test_sets=['ha', 'smoke', 'sanity']) self.env.make_snapshot("deploy_neutron_vlan_ha")