Merge "Updated from global requirements"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 95a4884..ee2da40 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -359,6 +359,10 @@
 # iSCSI volumes (boolean value)
 #block_migrate_cinder_iscsi=false
 
+# Enable VNC console. This configuration value should be same
+# as [nova.vnc]->vnc_enabled in nova.conf (boolean value)
+#vnc_console=false
+
 
 [dashboard]
 
@@ -635,6 +639,9 @@
 # creating containers (string value)
 #operator_role=Member
 
+# User role that has reseller admin (string value)
+#reseller_admin_role=ResellerAdmin
+
 
 [object-storage-feature-enabled]
 
diff --git a/tempest/api/compute/v3/servers/test_server_actions.py b/tempest/api/compute/v3/servers/test_server_actions.py
index e642715..406c45a 100644
--- a/tempest/api/compute/v3/servers/test_server_actions.py
+++ b/tempest/api/compute/v3/servers/test_server_actions.py
@@ -410,3 +410,16 @@
         resp, server = self.servers_client.start(self.server_id)
         self.assertEqual(202, resp.status)
         self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
+
+    @testtools.skipUnless(CONF.compute_feature_enabled.vnc_console,
+                          'VNC Console feature is disabled')
+    @test.attr(type='gate')
+    def test_get_vnc_console(self):
+        # Get the VNC console
+        console_types = ['novnc', 'xvpvnc']
+        for console_type in console_types:
+            resp, body = self.servers_client.get_vnc_console(self.server_id,
+                                                             console_type)
+            self.assertEqual(200, resp.status)
+            self.assertEqual(console_type, body['type'])
+            self.assertNotEqual('', body['url'])
diff --git a/tempest/api/object_storage/test_account_quotas.py b/tempest/api/object_storage/test_account_quotas.py
index 788292d..b14adc0 100644
--- a/tempest/api/object_storage/test_account_quotas.py
+++ b/tempest/api/object_storage/test_account_quotas.py
@@ -17,9 +17,12 @@
 from tempest.api.object_storage import base
 from tempest import clients
 from tempest.common.utils import data_utils
+from tempest import config
 from tempest import exceptions
 from tempest import test
 
+CONF = config.CONF
+
 
 class AccountQuotasTest(base.BaseObjectTest):
 
@@ -41,7 +44,7 @@
         try:
             _, roles = cls.os_admin.identity_client.list_roles()
             reseller_role_id = next(r['id'] for r in roles if r['name']
-                                    == 'ResellerAdmin')
+                                    == CONF.object_storage.reseller_admin_role)
         except StopIteration:
             msg = "No ResellerAdmin role found"
             raise exceptions.NotFound(msg)
diff --git a/tempest/api/object_storage/test_account_quotas_negative.py b/tempest/api/object_storage/test_account_quotas_negative.py
index cab307d..402cd90 100644
--- a/tempest/api/object_storage/test_account_quotas_negative.py
+++ b/tempest/api/object_storage/test_account_quotas_negative.py
@@ -17,9 +17,12 @@
 from tempest.api.object_storage import base
 from tempest import clients
 from tempest.common.utils import data_utils
+from tempest import config
 from tempest import exceptions
 from tempest import test
 
+CONF = config.CONF
+
 
 class AccountQuotasNegativeTest(base.BaseObjectTest):
 
@@ -41,7 +44,7 @@
         try:
             _, roles = cls.os_admin.identity_client.list_roles()
             reseller_role_id = next(r['id'] for r in roles if r['name']
-                                    == 'ResellerAdmin')
+                                    == CONF.object_storage.reseller_admin_role)
         except StopIteration:
             msg = "No ResellerAdmin role found"
             raise exceptions.NotFound(msg)
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index 3e621f4..291f0d1 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -135,7 +135,7 @@
             # the cause of the server not signalling the waitcondition
             # to heat.
             resp, body = cls.client.get_resource(cls.stack_identifier,
-                                                 'SmokeServerNeutron')
+                                                 'Server')
             server_id = body['physical_resource_id']
             LOG.debug('Console output for %s', server_id)
             resp, output = cls.servers_client.get_console_output(
diff --git a/tempest/config.py b/tempest/config.py
index 05a493c..887bac3 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -263,7 +263,11 @@
     cfg.BoolOpt('block_migrate_cinder_iscsi',
                 default=False,
                 help="Does the test environment block migration support "
-                     "cinder iSCSI volumes")
+                     "cinder iSCSI volumes"),
+    cfg.BoolOpt('vnc_console',
+                default=False,
+                help='Enable VNC console. This configuration value should '
+                     'be same as [nova.vnc]->vnc_enabled in nova.conf')
 ]
 
 
@@ -472,6 +476,9 @@
                default='Member',
                help="Role to add to users created for swift tests to "
                     "enable creating containers"),
+    cfg.StrOpt('reseller_admin_role',
+               default='ResellerAdmin',
+               help="User role that has reseller admin"),
 ]
 
 object_storage_feature_group = cfg.OptGroup(
diff --git a/tempest/services/compute/v3/json/servers_client.py b/tempest/services/compute/v3/json/servers_client.py
index 840e914..819e366 100644
--- a/tempest/services/compute/v3/json/servers_client.py
+++ b/tempest/services/compute/v3/json/servers_client.py
@@ -423,3 +423,15 @@
     def restore_soft_deleted_server(self, server_id, **kwargs):
         """Restore a soft-deleted server."""
         return self.action(server_id, 'restore', None, **kwargs)
+
+    def get_vnc_console(self, server_id, type):
+        """Get URL of VNC console."""
+        post_body = json.dumps({
+            "get_vnc_console": {
+                "type": type
+            }
+        })
+        resp, body = self.post('servers/%s/action' % str(server_id),
+                               post_body)
+        body = json.loads(body)
+        return resp, body['console']