blob: bac1a392d58ae339fe4b6cfccf39ade3f256fd38 [file] [log] [blame]
ZhiQiang Fan39f97222013-09-20 04:49:44 +08001# Copyright 2012 OpenStack Foundation
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +05302# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
Sean Dague1937d092013-05-17 16:36:38 -040016from tempest.api.compute import base
Hoisaleshwara Madan V Sf2203df2013-12-26 10:15:33 +053017from tempest import test
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053018
19
ivan-zhuf2b00502013-10-18 10:06:52 +080020class AbsoluteLimitsTestJSON(base.BaseV2ComputeTest):
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053021
Attila Fazekas19044d52013-02-16 07:35:06 +010022 @classmethod
Andrea Frittoli50bb80d2014-09-15 12:34:27 +010023 def resource_setup(cls):
24 super(AbsoluteLimitsTestJSON, cls).resource_setup()
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053025 cls.client = cls.limits_client
26
Hoisaleshwara Madan V Sf2203df2013-12-26 10:15:33 +053027 @test.attr(type='gate')
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053028 def test_absLimits_get(self):
Sean Dague4dd2c0b2013-01-03 17:50:28 -050029 # To check if all limits are present in the response
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053030 resp, absolute_limits = self.client.get_absolute_limits()
31 expected_elements = ['maxImageMeta', 'maxPersonality',
32 'maxPersonalitySize',
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053033 'maxServerMeta', 'maxTotalCores',
34 'maxTotalFloatingIps', 'maxSecurityGroups',
35 'maxSecurityGroupRules', 'maxTotalInstances',
36 'maxTotalKeypairs', 'maxTotalRAMSize',
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053037 'totalCoresUsed', 'totalFloatingIpsUsed',
38 'totalSecurityGroupsUsed', 'totalInstancesUsed',
Leo Toyoda0f0c14d2013-02-08 16:22:26 +090039 'totalRAMUsed']
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053040 # check whether all expected elements exist
41 missing_elements =\
42 [ele for ele in expected_elements if ele not in absolute_limits]
43 self.assertEqual(0, len(missing_elements),
44 "Failed to find element %s in absolute limits list"
45 % ', '.join(ele for ele in missing_elements))
46
47
Attila Fazekas19044d52013-02-16 07:35:06 +010048class AbsoluteLimitsTestXML(AbsoluteLimitsTestJSON):
49 _interface = 'xml'