Merge "Add ObjectStorageClient for cleanup"
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index 15c5421..5643c88 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -60,7 +60,7 @@
         body = self.client.list_ports()
         ports = body['ports']
         for port in ports:
-            if (port['device_owner'] == 'network:router_interface'
+            if (port['device_owner'].startswith('network:router_interface')
                 and port['device_id'] in [r['id'] for r in self.routers]):
                 self.client.remove_router_interface_with_port_id(
                     port['device_id'], port['id']
@@ -371,7 +371,6 @@
         for ra_mode, add_mode in (
                 ('dhcpv6-stateful', 'dhcpv6-stateful'),
                 ('dhcpv6-stateful', None),
-                (None, 'dhcpv6-stateful'),
         ):
             kwargs = {'ipv6_ra_mode': ra_mode,
                       'ipv6_address_mode': add_mode}
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index fa1f6ee..fb51e30 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -193,3 +193,22 @@
 class NegativeSecGroupIPv6Test(NegativeSecGroupTest):
     _ip_version = 6
     _tenant_network_cidr = CONF.network.tenant_network_v6_cidr
+
+    @test.attr(type=['negative', 'gate'])
+    def test_create_security_group_rule_wrong_ip_prefix_version(self):
+        group_create_body, _ = self._create_security_group()
+
+        # Create rule with bad remote_ip_prefix
+        pairs = ({'ethertype': 'IPv6',
+                  'ip_prefix': CONF.network.tenant_network_cidr},
+                 {'ethertype': 'IPv4',
+                  'ip_prefix': CONF.network.tenant_network_v6_cidr})
+        for pair in pairs:
+            self.assertRaisesRegexp(
+                exceptions.BadRequest,
+                "Conflicting value ethertype",
+                self.client.create_security_group_rule,
+                security_group_id=group_create_body['security_group']['id'],
+                protocol='tcp', direction='ingress',
+                ethertype=pair['ethertype'],
+                remote_ip_prefix=pair['ip_prefix'])
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 21d0a86..b7e9422 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -70,11 +70,14 @@
         self.addCleanup(self.servers_client.delete_server, server['id'])
         self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
         mountpoint = '/dev/%s' % CONF.compute.volume_device_name
-        _, body = self.volumes_client.attach_volume(
-            self.volume_origin['id'], server['id'], mountpoint)
+        _, body = self.servers_client.attach_volume(
+            server['id'], self.volume_origin['id'], mountpoint)
         self.volumes_client.wait_for_volume_status(self.volume_origin['id'],
                                                    'in-use')
-        self.addCleanup(self._detach, self.volume_origin['id'])
+        self.addCleanup(self.volumes_client.wait_for_volume_status,
+                        self.volume_origin['id'], 'available')
+        self.addCleanup(self.servers_client.detach_volume, server['id'],
+                        self.volume_origin['id'])
         # Snapshot a volume even if it's attached to an instance
         snapshot = self.create_snapshot(self.volume_origin['id'],
                                         force=True)
diff --git a/tempest/auth.py b/tempest/auth.py
index 022a450..2550cfb 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -561,7 +561,10 @@
             raise exceptions.InvalidCredentials()
         creds = cls._get_default(credentials_type)
         if not creds.is_valid():
-            raise exceptions.InvalidConfiguration()
+            msg = ("The %s credentials are incorrectly set in the config file."
+                   " Double check that all required values are assigned" %
+                   credentials_type)
+            raise exceptions.InvalidConfiguration(msg)
         return creds
 
     @classmethod
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index 00b17d9..707590e 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -157,19 +157,24 @@
             instance.add_tag('key1', value='value1')
 
         tags = self.ec2_client.get_all_tags()
-        self.assertEqual(tags[0].name, 'key1')
-        self.assertEqual(tags[0].value, 'value1')
+        td = {item.name: item.value for item in tags}
+
+        self.assertIn('key1', td)
+        self.assertEqual('value1', td['key1'])
 
         tags = self.ec2_client.get_all_tags(filters={'key': 'key1'})
-        self.assertEqual(tags[0].name, 'key1')
-        self.assertEqual(tags[0].value, 'value1')
+        td = {item.name: item.value for item in tags}
+        self.assertIn('key1', td)
+        self.assertEqual('value1', td['key1'])
 
         tags = self.ec2_client.get_all_tags(filters={'value': 'value1'})
-        self.assertEqual(tags[0].name, 'key1')
-        self.assertEqual(tags[0].value, 'value1')
+        td = {item.name: item.value for item in tags}
+        self.assertIn('key1', td)
+        self.assertEqual('value1', td['key1'])
 
         tags = self.ec2_client.get_all_tags(filters={'key': 'value2'})
-        self.assertEqual(len(tags), 0, str(tags))
+        td = {item.name: item.value for item in tags}
+        self.assertNotIn('key1', td)
 
         for instance in reservation.instances:
             instance.remove_tag('key1', value='value1')