Add config feature verification script
This commit adds a new tool to tempest that will verify that API
queryable config options are set correctly. Right now the list of
options that are verified is very short. Later on additional checks
will be added to verify other services features when the tempest
clients for the other services get functions to query enabled
extensions.
Partially Implements: blueprint config-verification
Change-Id: Ie3b5fadd74460fb7199bff7046ec0efe37268b94
diff --git a/tools/verify_tempest_config.py b/tools/verify_tempest_config.py
new file mode 100755
index 0000000..881a7b3
--- /dev/null
+++ b/tools/verify_tempest_config.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 IBM Corp.
+#
+# 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.
+
+import sys
+
+from tempest import clients
+from tempest import config
+
+
+CONF = config.TempestConfig()
+
+#Dicts matching extension names to config options
+NOVA_EXTENSIONS = {
+ 'disk_config': 'DiskConfig',
+ 'change_password': 'ServerPassword',
+ 'flavor_extra': 'FlavorExtraSpecs'
+}
+
+
+def verify_extensions(os):
+ results = {}
+ extensions_client = os.extensions_client
+ __, resp = extensions_client.list_extensions()
+ resp = resp['extensions']
+ extensions = map(lambda x: x['name'], resp)
+ results['nova_features'] = {}
+ for extension in NOVA_EXTENSIONS.keys():
+ if NOVA_EXTENSIONS[extension] in extensions:
+ results['nova_features'][extension] = True
+ else:
+ results['nova_features'][extension] = False
+ return results
+
+
+def display_results(results):
+ for option in NOVA_EXTENSIONS.keys():
+ config_value = getattr(CONF.compute_feature_enabled, option)
+ if config_value != results['nova_features'][option]:
+ print "Config option: %s should be changed to: %s" % (
+ option, not config_value)
+
+
+def main(argv):
+ os = clients.ComputeAdminManager(interface='json')
+ results = verify_extensions(os)
+ display_results(results)
+
+
+if __name__ == "__main__":
+ main(sys.argv)