Merge "[ussuri][goal] Add CONTRIBUTING.rst"
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index 8c18a4b..bdd48f8 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -711,7 +711,7 @@
                  service['binary'] == 'manila-share' and
                  service['state'] == 'up' and
                  re.search(backends, service['host'])]
-        return zones
+        return list(set(zones))
 
     @classmethod
     def get_pools_matching_share_type(cls, share_type, client=None):
diff --git a/manila_tempest_tests/tests/scenario/manager.py b/manila_tempest_tests/tests/scenario/manager.py
index 6e8a2f6..dede47a 100644
--- a/manila_tempest_tests/tests/scenario/manager.py
+++ b/manila_tempest_tests/tests/scenario/manager.py
@@ -681,28 +681,36 @@
         return subnet
 
     def _get_server_port_id_and_ip4(self, server, ip_addr=None):
-        ports = self.os_admin.ports_client.list_ports(
-            device_id=server['id'], fixed_ip=ip_addr)['ports']
+        if ip_addr:
+            ports = self.os_admin.ports_client.list_ports(
+                device_id=server['id'],
+                fixed_ips='ip_address=%s' % ip_addr)['ports']
+        else:
+            ports = self.os_admin.ports_client.list_ports(
+                device_id=server['id'])['ports']
         # A port can have more than one IP address in some cases.
         # If the network is dual-stack (IPv4 + IPv6), this port is associated
         # with 2 subnets
-        p_status = ['ACTIVE']
-        # NOTE(vsaienko) With Ironic, instances live on separate hardware
-        # servers. Neutron does not bind ports for Ironic instances, as a
-        # result the port remains in the DOWN state.
-        # TODO(vsaienko) remove once bug: #1599836 is resolved.
-        if getattr(CONF.service_available, 'ironic', False):
-            p_status.append('DOWN')
+
+        def _is_active(port):
+            # NOTE(vsaienko) With Ironic, instances live on separate hardware
+            # servers. Neutron does not bind ports for Ironic instances, as a
+            # result the port remains in the DOWN state. This has been fixed
+            # with the introduction of the networking-baremetal plugin but
+            # it's not mandatory (and is not used on all stable branches).
+            return (port['status'] == 'ACTIVE' or
+                    port.get('binding:vnic_type') == 'baremetal')
+
         port_map = [(p["id"], fxip["ip_address"])
                     for p in ports
                     for fxip in p["fixed_ips"]
-                    if netutils.is_valid_ipv4(fxip["ip_address"])
-                    and p['status'] in p_status]
+                    if (netutils.is_valid_ipv4(fxip["ip_address"]) and
+                        _is_active(p))]
         inactive = [p for p in ports if p['status'] != 'ACTIVE']
         if inactive:
             LOG.warning("Instance has ports that are not ACTIVE: %s", inactive)
 
-        self.assertNotEqual(0, len(port_map),
+        self.assertNotEmpty(port_map,
                             "No IPv4 addresses found in: %s" % ports)
         self.assertEqual(len(port_map), 1,
                          "Found multiple IPv4 addresses: %s. "
diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py
index 1ae1b4a..eaffa35 100644
--- a/manila_tempest_tests/tests/scenario/manager_share.py
+++ b/manila_tempest_tests/tests/scenario/manager_share.py
@@ -26,7 +26,6 @@
 from tempest.common import waiters
 from tempest import config
 from tempest.lib.common.utils import data_utils
-from tempest.lib.common.utils import test_utils
 from tempest.lib import exceptions
 
 from tempfile import mkstemp
@@ -162,10 +161,9 @@
             server_ip = self._get_ipv6_server_ip(instance)
         if not server_ip:
             # Obtain a floating IP
-            floating_ip = (
-                self.compute_floating_ips_client.create_floating_ip()
-                ['floating_ip'])
+            floating_ip = self.create_floating_ip(instance)
             self.floating_ips[instance['id']] = floating_ip
+            server_ip = floating_ip['floating_ip_address']
 
             if self.storage_network:
                 storage_net_nic = instance['addresses'].get(
@@ -174,15 +172,10 @@
                     self.storage_network_nic_ips[instance['id']] = (
                         storage_net_nic[0]['addr']
                     )
-
-            self.addCleanup(
-                test_utils.call_and_ignore_notfound_exc,
-                self.compute_floating_ips_client.delete_floating_ip,
-                floating_ip['id'])
             # Attach a floating IP
             self.compute_floating_ips_client.associate_floating_ip_to_server(
-                floating_ip['ip'], instance['id'])
-            server_ip = floating_ip['ip']
+                floating_ip['floating_ip_address'], instance['id'])
+
         self.assertIsNotNone(server_ip)
         # Check ssh
         remote_client = self.get_remote_client(
@@ -337,10 +330,12 @@
             if self.ipv6_enabled and not self.storage_network:
                 server_ip = self._get_ipv6_server_ip(instance)
             else:
-                server_ip = (CONF.share.override_ip_for_nfs_access or
-                             self.storage_network_nic_ips.get(
-                                 instance['id']) or
-                             self.floating_ips[instance['id']]['ip'])
+                server_ip = (
+                    CONF.share.override_ip_for_nfs_access
+                    or self.storage_network_nic_ips.get(instance['id'])
+                    or self.floating_ips[instance['id']]['floating_ip_address']
+                )
+
             self.assertIsNotNone(server_ip)
             return self.allow_access_ip(
                 share['id'], ip=server_ip,