blob: 0e234fba8327ee6bab0b84695398fc78b836b72d [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):
Attila Fazekas19044d52013-02-16 07:35:06 +010021 _interface = 'json'
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053022
Attila Fazekas19044d52013-02-16 07:35:06 +010023 @classmethod
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053024 def setUpClass(cls):
Attila Fazekas19044d52013-02-16 07:35:06 +010025 super(AbsoluteLimitsTestJSON, cls).setUpClass()
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053026 cls.client = cls.limits_client
27
Hoisaleshwara Madan V Sf2203df2013-12-26 10:15:33 +053028 @test.attr(type='gate')
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053029 def test_absLimits_get(self):
Sean Dague4dd2c0b2013-01-03 17:50:28 -050030 # To check if all limits are present in the response
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053031 resp, absolute_limits = self.client.get_absolute_limits()
32 expected_elements = ['maxImageMeta', 'maxPersonality',
33 'maxPersonalitySize',
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053034 'maxServerMeta', 'maxTotalCores',
35 'maxTotalFloatingIps', 'maxSecurityGroups',
36 'maxSecurityGroupRules', 'maxTotalInstances',
37 'maxTotalKeypairs', 'maxTotalRAMSize',
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053038 'totalCoresUsed', 'totalFloatingIpsUsed',
39 'totalSecurityGroupsUsed', 'totalInstancesUsed',
Leo Toyoda0f0c14d2013-02-08 16:22:26 +090040 'totalRAMUsed']
rajalakshmi-ganesana4ab0072012-08-07 19:48:56 +053041 # check whether all expected elements exist
42 missing_elements =\
43 [ele for ele in expected_elements if ele not in absolute_limits]
44 self.assertEqual(0, len(missing_elements),
45 "Failed to find element %s in absolute limits list"
46 % ', '.join(ele for ele in missing_elements))
47
48
Attila Fazekas19044d52013-02-16 07:35:06 +010049class AbsoluteLimitsTestXML(AbsoluteLimitsTestJSON):
50 _interface = 'xml'