blob: dbd825b45a3c3f73dc051a58ba99f03902deb9a2 [file] [log] [blame]
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +04001# 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
13from heat_integrationtests.common import test
14
15
16class ScenarioTestsBase(test.HeatIntegrationTest):
17 "This class define common parameters for scenario tests"
18
19 def setUp(self):
20 super(ScenarioTestsBase, self).setUp()
21 self.client = self.orchestration_client
22 self.sub_dir = 'templates'
23 self.assign_keypair()
Anastasia Kuznetsova673fc432015-03-12 16:41:36 +040024
25 if not self.conf.fixed_network_name:
26 raise self.skipException("No default network configured to test")
27 self.net = self._get_network()
Sergey Kraynev83ef84d2015-04-29 05:31:54 -040028 self.subnet_v4 = self._get_subnet_by_version(self.net)
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040029
30 if not self.conf.image_ref:
31 raise self.skipException("No image configured to test")
32 if not self.conf.instance_type:
33 raise self.skipException("No flavor configured to test")
34
Pavlo Shchelokovskyy46e5cb22015-03-23 12:01:25 +000035 if not self.conf.minimal_image_ref:
36 raise self.skipException("No minimal image configured to test")
37 if not self.conf.minimal_instance_type:
38 raise self.skipException("No minimal flavor configured to test")
39
Anastasia Kuznetsovae45bfff2015-02-25 12:50:34 +040040 def launch_stack(self, template_name, expected_status='CREATE_COMPLETE',
41 parameters=None, **kwargs):
42 template = self._load_template(__file__, template_name, self.sub_dir)
43
44 parameters = parameters or {}
45
46 if kwargs.get('add_parameters'):
47 parameters.update(kwargs['add_parameters'])
48
49 stack_id = self.stack_create(
50 stack_name=kwargs.get('stack_name'),
51 template=template,
52 files=kwargs.get('files'),
53 parameters=parameters,
54 environment=kwargs.get('environment'),
55 expected_status=expected_status
56 )
57
58 return stack_id