Missing node driver interface validation API

This patch implements missing API test for node validation.

There are three categories of driver interfaces:

- `Core` interfaces provide the essential functionality for Ironic
   within OpenStack, and may be depended upon by other services.
   All drivers must implement these interfaces. Presently, the Core
   interfaces are "power" and "deploy".
- `Standard` interfaces provide functionality beyond the needs of
  OpenStack, but which has been standardized across all drivers and
  becomes part of Ironic's API.
  If a driver implements this interface, it must adhere to the standard.
  This is presented to encourage vendors to work together with the
  Ironic project and implement common features in a consistent way,
  thus reducing the burden on consumers of the API.
  Presently, the Standard interfaces are rescue and console.
- The `Vendor` interface allows an exemption to the API contract when
  a vendor wishes to expose unique functionality provided by their
  hardware and is unable to do so within the core or standard interfaces.
  In this case, Ironic will merely relay the message from the API service
  to the appropriate driver.

As all drivers must implement core interfaces, I am checking only
core interfaces for response body validation.

part of blueprint: missing-baremetal-api-test

Change-Id: Ib6e81c875d55fb0c86dbb0de1c9a8337831196cc
diff --git a/tempest/api/baremetal/test_nodes.py b/tempest/api/baremetal/test_nodes.py
index b6432ad..1572840 100644
--- a/tempest/api/baremetal/test_nodes.py
+++ b/tempest/api/baremetal/test_nodes.py
@@ -87,3 +87,11 @@
         resp, node = self.client.show_node(node['uuid'])
         self.assertEqual('200', resp['status'])
         self._assertExpected(new_p, node['properties'])
+
+    @test.attr(type='smoke')
+    def test_validate_driver_interface(self):
+        resp, body = self.client.validate_driver_interface(self.node['uuid'])
+        self.assertEqual('200', resp['status'])
+        core_interfaces = ['power', 'deploy']
+        for interface in core_interfaces:
+            self.assertIn(interface, body)
diff --git a/tempest/services/baremetal/base.py b/tempest/services/baremetal/base.py
index 321b08b..f98ecff 100644
--- a/tempest/services/baremetal/base.py
+++ b/tempest/services/baremetal/base.py
@@ -122,7 +122,7 @@
 
         return resp, self.deserialize(body)
 
-    def _show_request(self, resource, uuid, permanent=False):
+    def _show_request(self, resource, uuid, permanent=False, **kwargs):
         """
         Gets a specific object of the specified type.
 
@@ -130,7 +130,10 @@
         :return: Serialized object as a dictionary.
 
         """
-        uri = self._get_uri(resource, uuid=uuid, permanent=permanent)
+        if 'uri' in kwargs:
+            uri = kwargs['uri']
+        else:
+            uri = self._get_uri(resource, uuid=uuid, permanent=permanent)
         resp, body = self.get(uri)
 
         return resp, self.deserialize(body)
diff --git a/tempest/services/baremetal/v1/base_v1.py b/tempest/services/baremetal/v1/base_v1.py
index 52479b5..6f27d81 100644
--- a/tempest/services/baremetal/v1/base_v1.py
+++ b/tempest/services/baremetal/v1/base_v1.py
@@ -239,3 +239,19 @@
         target = {'target': state}
         return self._put_request('nodes/%s/states/power' % node_uuid,
                                  target)
+
+    @base.handle_errors
+    def validate_driver_interface(self, node_uuid):
+        """
+        Get all driver interfaces of a specific node.
+
+        :param uuid: Unique identifier of the node in UUID format.
+
+        """
+
+        uri = '{pref}/{res}/{uuid}/{postf}'.format(pref=self.uri_prefix,
+                                                   res='nodes',
+                                                   uuid=node_uuid,
+                                                   postf='validate')
+
+        return self._show_request('nodes', node_uuid, uri=uri)