blob: c81e22d5b9a85b95daed30150676ebf29e2b0643 [file] [log] [blame]
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +03001# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040013from heat_integrationtests.scenario import scenario_base
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030014
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030015
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040016class NeutronAutoscalingTest(scenario_base.ScenarioTestsBase):
Tetiana Lashchovad2f4a5a2015-02-06 13:55:34 +020017 """
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030018 The class is responsible for testing of neutron resources autoscaling.
19 """
20
21 def setUp(self):
22 super(NeutronAutoscalingTest, self).setUp()
Angus Salkelde2996362015-07-31 16:22:42 +100023 raise self.skipException("Skipping until bug #1479869 is fixed.")
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030024 if not self.conf.fixed_subnet_name:
25 raise self.skipException("No sub-network configured to test")
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040026 self.template_name = 'test_neutron_autoscaling.yaml'
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030027
28 def test_neutron_autoscaling(self):
29 """
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040030 Check autoscaling of load balancer members in Heat.
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030031
32 The alternative scenario is the following:
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040033 1. Launch a stack with a load balancer.
34 2. Check that the load balancer created
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030035 one load balancer member for stack.
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040036 3. Update stack definition: increase desired capacity of stack.
37 4. Check that number of members in load balancer was increased.
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030038 """
39
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040040 parameters = {
41 "image_id": self.conf.minimal_image_ref,
42 "capacity": "1",
Pavlo Shchelokovskyy46e5cb22015-03-23 12:01:25 +000043 "instance_type": self.conf.minimal_instance_type,
Rabi Mishraec4b03b2015-05-23 02:20:47 +053044 "fixed_subnet": self.net['subnets'][0],
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040045 }
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030046
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040047 # Launch stack
48 stack_id = self.launch_stack(
49 template_name=self.template_name,
50 parameters=parameters
51 )
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030052
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040053 # Check number of members
Sirushti Murugesan203c63a2015-04-18 23:47:38 +053054 pool_resource = self.client.resources.get(stack_id, 'test_pool')
55 pool_members = self.network_client.list_members(
56 pool_id=pool_resource.physical_resource_id)['members']
57 self.assertEqual(1, len(pool_members))
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030058
59 # Increase desired capacity and update the stack
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040060 template = self._load_template(
61 __file__, self.template_name, self.sub_dir
62 )
63 parameters["capacity"] = "2"
64 self.update_stack(
65 stack_id,
66 template=template,
67 parameters=parameters
68 )
kairat_kushaev0ab3d7c2015-01-27 21:48:46 +030069
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040070 # Check number of members
Sirushti Murugesan203c63a2015-04-18 23:47:38 +053071 pool_members = self.network_client.list_members(
72 pool_id=pool_resource.physical_resource_id)['members']
73 self.assertEqual(2, len(pool_members))