Merge "Use the admin client for the QoS tag tests"
diff --git a/neutron_tempest_plugin/api/base.py b/neutron_tempest_plugin/api/base.py
index e17cf5e..4bcc6d2 100644
--- a/neutron_tempest_plugin/api/base.py
+++ b/neutron_tempest_plugin/api/base.py
@@ -595,15 +595,11 @@
             # Generate subnet CIDRs starting from configured values
             ip_version = ip_version or cls._ip_version
             if ip_version == const.IP_VERSION_4:
-                mask_bits = mask_bits or config.safe_get_config_value(
-                    'network', 'project_network_mask_bits')
-                cidr = netaddr.IPNetwork(config.safe_get_config_value(
-                    'network', 'project_network_cidr'))
+                mask_bits = mask_bits or CONF.network.project_network_mask_bits
+                cidr = netaddr.IPNetwork(CONF.network.project_network_cidr)
             elif ip_version == const.IP_VERSION_6:
-                mask_bits = config.safe_get_config_value(
-                    'network', 'project_network_v6_mask_bits')
-                cidr = netaddr.IPNetwork(config.safe_get_config_value(
-                    'network', 'project_network_v6_cidr'))
+                mask_bits = CONF.network.project_network_v6_mask_bits
+                cidr = netaddr.IPNetwork(CONF.network.project_network_v6_cidr)
             else:
                 raise ValueError('Invalid IP version: {!r}'.format(ip_version))
 
diff --git a/neutron_tempest_plugin/api/test_routers.py b/neutron_tempest_plugin/api/test_routers.py
index 7758b1a..1430b81 100644
--- a/neutron_tempest_plugin/api/test_routers.py
+++ b/neutron_tempest_plugin/api/test_routers.py
@@ -38,9 +38,9 @@
     def resource_setup(cls):
         super(RoutersTest, cls).resource_setup()
         cls.tenant_cidr = (
-            config.safe_get_config_value('network', 'project_network_cidr')
+            CONF.network.project_network_cidr
             if cls._ip_version == 4 else
-            config.safe_get_config_value('network', 'project_network_v6_cidr'))
+            CONF.network.project_network_v6_cidr)
 
     @decorators.idempotent_id('c72c1c0c-2193-4aca-eeee-b1442640eeee')
     @tutils.requires_ext(extension="standard-attr-description",
diff --git a/neutron_tempest_plugin/api/test_security_groups.py b/neutron_tempest_plugin/api/test_security_groups.py
index 6992399..37cd80b 100644
--- a/neutron_tempest_plugin/api/test_security_groups.py
+++ b/neutron_tempest_plugin/api/test_security_groups.py
@@ -386,7 +386,7 @@
         self.admin_client.update_quotas(project_id,
                                         **{'security_group_rule': val,
                                            'force': True})
-        LOG.info('Trying to update security group rule quota {} '.format(val))
+        LOG.info('Trying to update security group rule quota %r', val)
 
     def _get_sg_rules_quota(self):
         project_id = self.client.project_id
diff --git a/neutron_tempest_plugin/common/utils.py b/neutron_tempest_plugin/common/utils.py
index 6bc290b..62191bf 100644
--- a/neutron_tempest_plugin/common/utils.py
+++ b/neutron_tempest_plugin/common/utils.py
@@ -194,29 +194,29 @@
                         sleep=self.test_sleep)
         try:
             LOG.info("Checking connectivity between server and client -"
-                    " attempt {}".format(self.test_attempt))
+                    " attempt %d", self.test_attempt)
             self.server_ssh.exec_command(
                     'grep {} output.txt'.format(self.test_str))
             self.client_ssh.exec_command(
                     'grep {} output.txt'.format(self.test_str))
             if not self.should_pass:
-                LOG.warning("attempt {} succeed while it should fail".format(
-                    self.test_attempt))
+                LOG.warning("attempt %d succeed while it should fail",
+                            self.test_attempt)
                 return False
             else:
                 if not self.connection_started:
                     self.connection_started = True
-                LOG.info("attempt {} succeed as it expected".format(
-                    self.test_attempt))
+                LOG.info("attempt %d succeed as it expected",
+                         self.test_attempt)
                 return True
         except exceptions.SSHExecCommandFailed:
             if self.should_pass:
-                LOG.warning("attempt {} failed while it should pass".format(
-                    self.test_attempt))
+                LOG.warning("attempt %d failed while it should pass",
+                            self.test_attempt)
                 return False
             else:
-                LOG.info("attempt {} failed as it expected".format(
-                    self.test_attempt))
+                LOG.info("attempt %d failed as it expected",
+                         self.test_attempt)
                 return True
         finally:
             self.test_attempt += 1
diff --git a/neutron_tempest_plugin/config.py b/neutron_tempest_plugin/config.py
index 55d9d9e..23757c1 100644
--- a/neutron_tempest_plugin/config.py
+++ b/neutron_tempest_plugin/config.py
@@ -259,19 +259,3 @@
     name='designate_feature_enabled', title='Enabled Designate Features')
 CONF.register_group(dns_feature_group)
 CONF.register_opts(DnsFeatureGroup, group="designate_feature_enabled")
-
-config_opts_translator = {
-    'project_network_cidr': 'tenant_network_cidr',
-    'project_network_v6_cidr': 'tenant_network_v6_cidr',
-    'project_network_mask_bits': 'tenant_network_mask_bits',
-    'project_network_v6_mask_bits': 'tenant_network_v6_mask_bits'}
-
-
-def safe_get_config_value(group, name):
-    """Safely get Oslo config opts from Tempest, using old and new names."""
-    conf_group = getattr(CONF, group)
-
-    try:
-        return getattr(conf_group, name)
-    except cfg.NoSuchOptError:
-        return getattr(conf_group, config_opts_translator[name])
diff --git a/neutron_tempest_plugin/fwaas/scenario/test_fwaas_v2.py b/neutron_tempest_plugin/fwaas/scenario/test_fwaas_v2.py
index 9896073..8468671 100644
--- a/neutron_tempest_plugin/fwaas/scenario/test_fwaas_v2.py
+++ b/neutron_tempest_plugin/fwaas/scenario/test_fwaas_v2.py
@@ -89,9 +89,9 @@
                                 (ssh_source, remote_ip, should_connect),
                                 msg)
             except Exception:
-                LOG.exception("Unable to access {dest} via ssh to "
-                              "floating-ip {src}".format(dest=remote_ip,
-                                                         src=floating_ip))
+                LOG.exception("Unable to access %s via ssh to "
+                              "floating-ip %s",
+                              remote_ip, floating_ip)
                 raise
 
     def _check_remote_connectivity(self, source, dest, should_succeed=True,
diff --git a/neutron_tempest_plugin/neutron_dynamic_routing/api/test_bgp_speaker_extensions.py b/neutron_tempest_plugin/neutron_dynamic_routing/api/test_bgp_speaker_extensions.py
index 5cdd524..1d089f6 100644
--- a/neutron_tempest_plugin/neutron_dynamic_routing/api/test_bgp_speaker_extensions.py
+++ b/neutron_tempest_plugin/neutron_dynamic_routing/api/test_bgp_speaker_extensions.py
@@ -177,7 +177,7 @@
         bgp_speaker = self.get_bgp_speaker(bgp_speaker_id)
         bgp_peers_list = bgp_speaker['peers']
         self.assertEqual(1, len(bgp_peers_list))
-        self.assertTrue(bgp_peer_id in bgp_peers_list)
+        self.assertIn(bgp_peer_id, bgp_peers_list)
 
     @decorators.idempotent_id('f9737708-1d79-440b-8350-779f97d882ee')
     def test_remove_bgp_peer(self):
@@ -188,7 +188,7 @@
         self.add_bgp_peer(bgp_speaker_id, bgp_peer_id)
         bgp_speaker = self.get_bgp_speaker(bgp_speaker_id)
         bgp_peers_list = bgp_speaker['peers']
-        self.assertTrue(bgp_peer_id in bgp_peers_list)
+        self.assertIn(bgp_peer_id, bgp_peers_list)
 
         bgp_speaker = self.remove_bgp_peer(bgp_speaker_id, bgp_peer_id)
         bgp_speaker = self.get_bgp_speaker(bgp_speaker_id)
@@ -206,7 +206,7 @@
         bgp_speaker = self.get_bgp_speaker(bgp_speaker_id)
         network_list = bgp_speaker['networks']
         self.assertEqual(1, len(network_list))
-        self.assertTrue(self.ext_net_id in network_list)
+        self.assertIn(self.ext_net_id, network_list)
 
     @decorators.idempotent_id('6cfc7137-0d99-4a3d-826c-9d1a3a1767b0')
     def test_remove_gateway_network(self):
@@ -218,7 +218,7 @@
         bgp_speaker = self.get_bgp_speaker(bgp_speaker_id)
         networks = bgp_speaker['networks']
 
-        self.assertTrue(self.ext_net_id in networks)
+        self.assertIn(self.ext_net_id, networks)
         self.bgp_adm_client.remove_bgp_gateway_network(bgp_speaker_id,
                                                        self.ext_net_id)
         bgp_speaker = self.get_bgp_speaker(bgp_speaker_id)
diff --git a/neutron_tempest_plugin/scenario/test_mtu.py b/neutron_tempest_plugin/scenario/test_mtu.py
index 99c5130..29ccb01 100644
--- a/neutron_tempest_plugin/scenario/test_mtu.py
+++ b/neutron_tempest_plugin/scenario/test_mtu.py
@@ -227,37 +227,37 @@
     @decorators.idempotent_id('bc470200-d8f4-4f07-b294-1b4cbaaa35b9')
     def test_connectivity_min_max_mtu(self):
         server_ssh_client, _, _, fip2 = self._create_setup()
-        log_msg = ("Ping with {mtu_size} MTU of 2 networks. Fragmentation is "
-                   "{fragmentation_state}. Expected result: ping "
-                   "{ping_status}")
+        log_msg = ("Ping with %(mtu_size)s MTU of 2 networks. "
+                   "Fragmentation is %(fragmentation_state)s. "
+                   "Expected result: ping %(ping_status)s")
 
         # ping with min mtu of 2 networks succeeds even when
         # fragmentation is disabled
-        LOG.debug(log_msg.format(mtu_size='minimal',
-                  fragmentation_state='disabled', ping_status='succeeded'))
+        LOG.debug(log_msg, mtu_size='minimal',
+                  fragmentation_state='disabled', ping_status='succeeded')
         self.check_remote_connectivity(
             server_ssh_client, fip2['fixed_ip_address'],
             mtu=self.networks[0]['mtu'], fragmentation=False)
 
         # ping with the size above min mtu of 2 networks
         # fails when fragmentation is disabled
-        LOG.debug(log_msg.format(mtu_size='size above minimal',
-                  fragmentation_state='disabled', ping_status='failed'))
+        LOG.debug(log_msg, mtu_size='size above minimal',
+                  fragmentation_state='disabled', ping_status='failed')
         self.check_remote_connectivity(
             server_ssh_client, fip2['fixed_ip_address'], should_succeed=False,
             mtu=self.networks[0]['mtu'] + 2, fragmentation=False)
 
         # ping with max mtu of 2 networks succeeds when
         # fragmentation is enabled
-        LOG.debug(log_msg.format(mtu_size='maximal',
-                  fragmentation_state='enabled', ping_status='succeeded'))
+        LOG.debug(log_msg, mtu_size='maximal',
+                  fragmentation_state='enabled', ping_status='succeeded')
         self.check_remote_connectivity(
             server_ssh_client, fip2['fixed_ip_address'],
             mtu=self.networks[1]['mtu'])
 
         # ping with max mtu of 2 networks fails when fragmentation is disabled
-        LOG.debug(log_msg.format(mtu_size='maximal',
-                  fragmentation_state='disabled', ping_status='failed'))
+        LOG.debug(log_msg, mtu_size='maximal',
+                  fragmentation_state='disabled', ping_status='failed')
         self.check_remote_connectivity(
             server_ssh_client, fip2['fixed_ip_address'], should_succeed=False,
             mtu=self.networks[1]['mtu'], fragmentation=False)
diff --git a/neutron_tempest_plugin/scenario/test_ports.py b/neutron_tempest_plugin/scenario/test_ports.py
index c661d39..56cedde 100644
--- a/neutron_tempest_plugin/scenario/test_ports.py
+++ b/neutron_tempest_plugin/scenario/test_ports.py
@@ -107,8 +107,8 @@
                 if port is not None:
                     break
             except Exception as e:
-                LOG.warning('Failed to create Port, using Fixed_IP:{}, '
-                            'the Error was:{}'.format(ip, e))
+                LOG.warning('Failed to create Port, using Fixed_IP:%s, '
+                            'the Error was:%s', ip, e)
         fip, server = self._create_instance_with_port(port)
         self.check_connectivity(fip[0]['floating_ip_address'],
                                 CONF.validation.image_ssh_user,
diff --git a/neutron_tempest_plugin/tap_as_a_service/scenario/test_traffic_impact.py b/neutron_tempest_plugin/tap_as_a_service/scenario/test_traffic_impact.py
index e70eb03..904335d 100644
--- a/neutron_tempest_plugin/tap_as_a_service/scenario/test_traffic_impact.py
+++ b/neutron_tempest_plugin/tap_as_a_service/scenario/test_traffic_impact.py
@@ -14,16 +14,15 @@
 #    under the License.
 
 from contextlib import contextmanager
-from oslo_log import log
-import testtools
 
+from oslo_log import log
 from tempest.common import utils
 from tempest import config
 from tempest.lib.common.utils import data_utils
 from tempest.lib.common.utils.linux import remote_client
 from tempest.lib.common.utils import test_utils
-
 from tempest.lib import decorators
+import testtools
 
 from neutron_tempest_plugin.tap_as_a_service.scenario import manager
 
@@ -151,7 +150,7 @@
 
         # Ensure tcpdump is up and running
         psax = self.monitor_client.exec_command("ps -ax")
-        self.assertTrue("tcpdump" in psax)
+        self.assertIn("tcpdump", psax)
 
         # Run traffic from left_vm to right_vm
         LOG.debug('Check ICMP traffic: ping %s ', right_ip)
diff --git a/roles/docker-setup/tasks/main.yml b/roles/docker-setup/tasks/main.yml
index 19d8bfb..1b0e2d7 100644
--- a/roles/docker-setup/tasks/main.yml
+++ b/roles/docker-setup/tasks/main.yml
@@ -4,6 +4,14 @@
     name: docker.io
     state: present
 
+- name: Install docker-buildx (only for Ubuntu and Debian)
+  become: yes
+  package:
+    name: docker-buildx
+    state: present
+  when:
+    - (ansible_facts['distribution'] | lower) in ['ubuntu', 'debian']
+
 - name: Copy 52_docker_for_tempest to /etc/sudoers.d
   copy:
     src: 52_docker_for_tempest
diff --git a/test-requirements.txt b/test-requirements.txt
index 0151f21..ebde755 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,7 +1,7 @@
-hacking>=3.2.0,<3.3.0 # Apache-2.0
+hacking>=6.1.0,<6.2.0 # Apache-2.0
 
 coverage>=4.4.1 # Apache-2.0
-flake8-import-order==0.12 # LGPLv3
+flake8-import-order>=0.18.0,<0.19.0 # LGPLv3
 python-subunit>=1.0.0 # Apache-2.0/BSD
 oslotest>=3.2.0 # Apache-2.0
 stestr>=1.0.0 # Apache-2.0
diff --git a/tox.ini b/tox.ini
index 2f7da5c..c8add2c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -62,9 +62,10 @@
 # E126 continuation line over-indented for hanging indent
 # E128 continuation line under-indented for visual indent
 # E129 visually indented line with same indent as next logical line
+# I202 Additional newline in a group of imports.
 # N530 direct neutron imports not allowed
 # W504 line break after binary operator
-ignore = E126,E128,E129,N530,W504
+ignore = E126,E128,E129,I202,N530,W504
 # H106: Don't put vim configuration in source files
 # H203: Use assertIs(Not)None to check for None
 # H204: Use assert(Not)Equal to check for equality