Tempest: add auto-discovery test

Add test, which delete pre-created baremetal vms, and discovers it
via 'enroll' not_found_hook with default configuration.

Note, test contains workaround for working on infra, as infra 'tempest'
user doesn't have access to virsh, for running node and whitelisting
firewall rules on existing node, inspector's inspect api is used.

Change-Id: Ib0ec63295a496229b27552cd1bcf7e763c0c3e03
diff --git a/ironic_tempest_plugin/services/introspection_client.py b/ironic_tempest_plugin/services/introspection_client.py
index 3f43bf5..cce5213 100644
--- a/ironic_tempest_plugin/services/introspection_client.py
+++ b/ironic_tempest_plugin/services/introspection_client.py
@@ -10,8 +10,6 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import json
-
 from ironic_tempest_plugin.services.baremetal import base
 from tempest import clients
 from tempest.common import credentials_factory as common_creds
@@ -47,13 +45,10 @@
         return self._delete_request('rules', uuid=None)
 
     @base.handle_errors
-    def import_rule(self, rule_path):
-        """Import introspection rules from a json file."""
-        with open(rule_path, 'r') as fp:
-            rules = json.load(fp)
-            if not isinstance(rules, list):
-                rules = [rules]
-
+    def create_rules(self, rules):
+        """Create introspection rules."""
+        if not isinstance(rules, list):
+            rules = [rules]
         for rule in rules:
             self._create_request('rules', rule)
 
@@ -68,3 +63,13 @@
         return self._show_request('introspection', uuid=uuid,
                                   uri='/%s/introspection/%s/data' %
                                       (self.uri_prefix, uuid))
+
+    @base.handle_errors
+    def start_introspection(self, uuid):
+        """Start introspection for a node."""
+        resp, _body = self.post(url=('/%s/introspection/%s' %
+                                     (self.uri_prefix, uuid)),
+                                body=None)
+        self.expected_success(202, resp.status)
+
+        return resp