Add multiple negative test generator support

In order to support different generator styles and sets of tests
a new configuration parameter is introduced to define the negative
test generator class. This can be used to define generators that create
only random values (random fuzzy test) or pattern based values.
With this functionality it is also possible to reduce the amount
of negative tests that are automatically produced.

Change-Id: Icfad55d1eea92dc2a42642b37d34c253c26c0846
Partially-implements: bp fuzzy-test
diff --git a/tempest/test.py b/tempest/test.py
index c6e3d6e..2125047 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -27,10 +27,11 @@
 import testtools
 
 from tempest import clients
-from tempest.common import generate_json
+import tempest.common.generator.valid_generator as valid
 from tempest.common import isolated_creds
 from tempest import config
 from tempest import exceptions
+from tempest.openstack.common import importutils
 from tempest.openstack.common import log as logging
 
 LOG = logging.getLogger(__name__)
@@ -400,7 +401,8 @@
         """
         description = NegativeAutoTest.load_schema(description_file)
         LOG.debug(description)
-        generate_json.validate_negative_test_schema(description)
+        generator = importutils.import_class(CONF.negative.test_generator)()
+        generator.validate_schema(description)
         schema = description.get("json-schema", None)
         resources = description.get("resources", [])
         scenario_list = []
@@ -416,7 +418,7 @@
                                              "expected_result": expected_result
                                              }))
         if schema is not None:
-            for invalid in generate_json.generate_invalid(schema):
+            for invalid in generator.generate(schema):
                 scenario_list.append((invalid[0],
                                       {"schema": invalid[1],
                                        "expected_result": invalid[2]}))
@@ -459,11 +461,12 @@
             # Note(mkoderer): The resources list already contains an invalid
             # entry (see get_resource).
             # We just send a valid json-schema with it
-            valid = None
+            valid_schema = None
             schema = description.get("json-schema", None)
             if schema:
-                valid = generate_json.generate_valid(schema)
-            new_url, body = self._http_arguments(valid, url, method)
+                valid_schema = \
+                    valid.ValidTestGenerator().generate_valid(schema)
+            new_url, body = self._http_arguments(valid_schema, url, method)
         elif hasattr(self, "schema"):
             new_url, body = self._http_arguments(self.schema, url, method)