Add plugin interface for appending to tempest config

This commit adds a new interface to the external plugin interface for
adding configuration options to the config file. This is accomplished
by adding a method to the abstract class which plugins can use for
registering additional opts on the tempest config object. Then on the
tempest side a method is added to the plugin manager class to call the
register function for each plugin. This is then called at the end of
tempest's normal register_opts() function.

Partially Implements: bp external-plugin-interface

Change-Id: I2a7915cd978c496091dcf2cbf9d6a89ecbd8c2aa
diff --git a/tempest/config.py b/tempest/config.py
index 7382088..c61f6dc 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -22,6 +22,8 @@
 
 from oslo_log import log as logging
 
+from tempest.test_discover import plugins
+
 
 # TODO(marun) Replace use of oslo_config's global ConfigOpts
 # (cfg.CONF) instance with a local instance (cfg.ConfigOpts()) once
@@ -1184,8 +1186,12 @@
 
 
 def register_opts():
+    ext_plugins = plugins.TempestTestPluginManager()
+    # Register in-tree tempest config options
     for g, o in _opts:
         register_opt_group(_CONF, g, o)
+    # Call external plugin config option registration
+    ext_plugins.register_plugin_opts(_CONF)
 
 
 def list_opts():
diff --git a/tempest/test_discover/plugins.py b/tempest/test_discover/plugins.py
index 197bd0c..29b719c 100644
--- a/tempest/test_discover/plugins.py
+++ b/tempest/test_discover/plugins.py
@@ -36,6 +36,17 @@
         """
         return
 
+    @abc.abstractmethod
+    def register_opts(self, conf):
+        """Method to add additional configuration options to tempest. This
+        method will be run for the plugin during the register_opts() function
+        in tempest.config
+
+        :param ConfigOpts conf: The conf object that can be used to register
+            additional options on.
+        """
+        return
+
 
 @misc.singleton
 class TempestTestPluginManager(object):
@@ -54,3 +65,7 @@
         for plug in self.ext_plugins:
             load_tests_dict[plug.name] = plug.obj.load_tests()
         return load_tests_dict
+
+    def register_plugin_opts(self, conf):
+        for plug in self.ext_plugins:
+            plug.obj.register_opts(conf)