Merge "Remove test_rule_create_fail_for_direction_ingress"
diff --git a/.zuul.yaml b/.zuul.yaml
index 1063efa..8c6072a 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -129,9 +129,11 @@
       devstack_localrc:
         PHYSICAL_NETWORK: default
         DOWNLOAD_DEFAULT_IMAGES: false
-        IMAGE_URLS: http://cloud-images.ubuntu.com/releases/16.04/release-20180622/ubuntu-16.04-server-cloudimg-amd64-disk1.img,
-        DEFAULT_INSTANCE_TYPE: ds512M
-        DEFAULT_INSTANCE_USER: ubuntu
+        IMAGE_URLS: "http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-disk.img,http://cloud-images.ubuntu.com/releases/16.04/release-20180622/ubuntu-16.04-server-cloudimg-amd64-disk1.img"
+        DEFAULT_IMAGE_NAME: cirros-0.3.4-i386-disk
+        ADVANCED_IMAGE_NAME: ubuntu-16.04-server-cloudimg-amd64-disk1
+        ADVANCED_INSTANCE_TYPE: ds512M
+        ADVANCED_INSTANCE_USER: ubuntu
         BUILD_TIMEOUT: 784
       devstack_services:
         cinder: true
@@ -203,9 +205,11 @@
         NETWORK_API_EXTENSIONS: "address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-integration,dvr,empty-string-filtering,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,fip-port-details,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-segment,standard-attr-timestamp,standard-attr-tag,subnet_allocation,trunk,trunk-details"
         PHYSICAL_NETWORK: default
         DOWNLOAD_DEFAULT_IMAGES: false
-        IMAGE_URLS: http://cloud-images.ubuntu.com/releases/16.04/release-20180622/ubuntu-16.04-server-cloudimg-amd64-disk1.img,
-        DEFAULT_INSTANCE_TYPE: ds512M
-        DEFAULT_INSTANCE_USER: ubuntu
+        IMAGE_URLS: "http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-disk.img,http://cloud-images.ubuntu.com/releases/16.04/release-20180622/ubuntu-16.04-server-cloudimg-amd64-disk1.img"
+        DEFAULT_IMAGE_NAME: cirros-0.3.4-i386-disk
+        ADVANCED_IMAGE_NAME: ubuntu-16.04-server-cloudimg-amd64-disk1
+        ADVANCED_INSTANCE_TYPE: ds512M
+        ADVANCED_INSTANCE_USER: ubuntu
         BUILD_TIMEOUT: 784
       devstack_plugins:
         neutron: git://git.openstack.org/openstack/neutron.git
@@ -330,6 +334,11 @@
       devstack_localrc:
         TEMPEST_PLUGINS: '"/opt/stack/designate-tempest-plugin /opt/stack/neutron-tempest-plugin"'
         DESIGNATE_BACKEND_DRIVER: bind9
+        DOWNLOAD_DEFAULT_IMAGES: false
+        IMAGE_URLS: http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-disk.img,
+        # In this job advanced image is not needed, so it's name should be
+        # empty
+        ADVANCED_IMAGE_NAME: ""
       devstack_plugins:
         designate: git://git.openstack.org/openstack/designate.git
       devstack_services:
diff --git a/devstack/functions.sh b/devstack/functions.sh
index 026f527..8d8a4bf 100644
--- a/devstack/functions.sh
+++ b/devstack/functions.sh
@@ -30,3 +30,58 @@
     # Restore xtrace
     $_XTRACE_FUNCTIONS
 }
+
+#Add advanced image config to tempest.conf
+function configure_advanced_image {
+    local advanced_image_uuid
+
+    if ! is_service_enabled glance; then
+        # if glance is not enabled, there is no image for to configure
+        return 0
+    fi
+
+    if [[ -z "$ADVANCED_IMAGE_NAME" ]]; then
+        # if name of advanced image is not provided, there is no image to
+        # configure
+        return 0
+    fi
+
+    while read -r IMAGE_NAME IMAGE_UUID; do
+        if [ "$IMAGE_NAME" = "$ADVANCED_IMAGE_NAME" ]; then
+            advanced_image_uuid="$IMAGE_UUID"
+            break
+        fi
+    done < <(openstack image list --property status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
+
+    if [[ -z "$advanced_image_uuid" ]]; then
+        echo "No image with name $ADVANCED_IMAGE_NAME found."
+        return 1
+    fi
+
+    iniset $TEMPEST_CONFIG neutron_plugin_options advanced_image_ref $advanced_image_uuid
+    iniset $TEMPEST_CONFIG neutron_plugin_options advanced_image_ssh_user $ADVANCED_INSTANCE_USER
+}
+
+
+function configure_flavor_for_advanced_image {
+    local flavor_ref
+
+    if ! is_service_enabled nova; then
+        # if nova is not enabled, there is no flavor to configure
+        return 0
+    fi
+
+    if [[ -z "$ADVANCED_INSTANCE_TYPE" ]]; then
+        # if name of flavor for advanced image is not provided, there is no
+        # flavor to configure
+        return 0
+    fi
+
+    flavor_ref=$(openstack flavor show $ADVANCED_INSTANCE_TYPE -f value -c id)
+    if [[ -z "$flavor_ref" ]]; then
+        echo "Found no valid flavors to use for $ADVANCED_IMAGE_NAME !"
+        echo "Fallback to use $DEFAULT_INSTANCE_TYPE"
+        flavor_ref=$(iniget $TEMPEST_CONFIG compute flavor_ref)
+    fi
+    iniset $TEMPEST_CONFIG neutron_plugin_options advanced_image_flavor_ref $flavor_ref
+}
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index e7e30a9..25cfba6 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -15,5 +15,9 @@
             echo_summary "Installing neutron-tempest-plugin"
             install_neutron_tempest_plugin
             ;;
+        test-config)
+            echo_summary "Configuring neutron-tempest-plugin tempest options"
+            configure_advanced_image
+            configure_flavor_for_advanced_image
     esac
 fi
diff --git a/devstack/settings b/devstack/settings
index 614376f..6804a47 100644
--- a/devstack/settings
+++ b/devstack/settings
@@ -1,3 +1,7 @@
 GITREPO["neutron-tempest-plugin"]=${NEUTRON_TEMPEST_REPO:-${GIT_BASE}/openstack/neutron-tempest-plugin.git}
 GITDIR["neutron-tempest-plugin"]=$DEST/neutron-tempest-plugin
 GITBRANCH["neutron-tempest-plugin"]=master
+
+ADVANCED_IMAGE_NAME=${ADVANCED_IMAGE_NAME:-""}
+ADVANCED_INSTANCE_TYPE=${ADVANCED_INSTANCE_TYPE:-$DEFAULT_INSTANCE_TYPE}
+ADVANCED_INSTANCE_USER=${ADVANCED_INSTANCE_USER:-$DEFAULT_INSTANCE_USER}
diff --git a/neutron_tempest_plugin/api/admin/test_agent_availability_zone.py b/neutron_tempest_plugin/api/admin/test_agent_availability_zone.py
index 245715f..c69c63d 100644
--- a/neutron_tempest_plugin/api/admin/test_agent_availability_zone.py
+++ b/neutron_tempest_plugin/api/admin/test_agent_availability_zone.py
@@ -40,9 +40,10 @@
     @testtools.skipUnless(CONF.neutron_plugin_options.agent_availability_zone,
                           "Need a single availability_zone assumption.")
     def test_agents_availability_zone(self):
-        """
-        Test list agents availability_zone, only L3 and DHCP agent support
-        availability_zone, default availability_zone is "nova".
+        """Test list agents availability_zone
+
+        Only L3 and DHCP agent support availability_zone, default
+        availability_zone is "nova".
         """
         body = self.admin_client.list_agents()
         agents = body['agents']
diff --git a/neutron_tempest_plugin/api/admin/test_agent_management.py b/neutron_tempest_plugin/api/admin/test_agent_management.py
index 72cba62..ad0368a 100644
--- a/neutron_tempest_plugin/api/admin/test_agent_management.py
+++ b/neutron_tempest_plugin/api/admin/test_agent_management.py
@@ -81,9 +81,7 @@
         self.assertEqual(updated_description, description)
 
     def _restore_agent(self, dyn_agent):
-        """
-        Restore the agent description after update test.
-        """
+        """Restore the agent description after update test."""
         description = dyn_agent['description']
         origin_agent = {'description': description}
         self.admin_client.update_agent(agent_id=dyn_agent['id'],
diff --git a/neutron_tempest_plugin/api/admin/test_routers_dvr.py b/neutron_tempest_plugin/api/admin/test_routers_dvr.py
index 644bc38..8d80ba6 100644
--- a/neutron_tempest_plugin/api/admin/test_routers_dvr.py
+++ b/neutron_tempest_plugin/api/admin/test_routers_dvr.py
@@ -44,7 +44,8 @@
 
     @decorators.idempotent_id('08a2a0a8-f1e4-4b34-8e30-e522e836c44e')
     def test_distributed_router_creation(self):
-        """
+        """Test distributed router creation
+
         Test uses administrative credentials to creates a
         DVR (Distributed Virtual Routing) router using the
         distributed=True.
@@ -61,7 +62,8 @@
 
     @decorators.idempotent_id('8a0a72b4-7290-4677-afeb-b4ffe37bc352')
     def test_centralized_router_creation(self):
-        """
+        """Test centralized router creation
+
         Test uses administrative credentials to creates a
         CVR (Centralized Virtual Routing) router using the
         distributed=False.
@@ -84,7 +86,8 @@
 
     @decorators.idempotent_id('acd43596-c1fb-439d-ada8-31ad48ae3c2e')
     def test_centralized_router_update_to_dvr(self):
-        """
+        """Test centralized to DVR router update
+
         Test uses administrative credentials to creates a
         CVR (Centralized Virtual Routing) router using the
         distributed=False.Then it will "update" the router
diff --git a/neutron_tempest_plugin/api/admin/test_routers_ha.py b/neutron_tempest_plugin/api/admin/test_routers_ha.py
index d9aafe9..b717a10 100644
--- a/neutron_tempest_plugin/api/admin/test_routers_ha.py
+++ b/neutron_tempest_plugin/api/admin/test_routers_ha.py
@@ -40,7 +40,8 @@
 
     @decorators.idempotent_id('8abc177d-14f1-4018-9f01-589b299cbee1')
     def test_ha_router_creation(self):
-        """
+        """Test HA router creation
+
         Test uses administrative credentials to create a
         HA (High Availability) router using the ha=True.
 
@@ -53,7 +54,8 @@
 
     @decorators.idempotent_id('97b5f7ef-2192-4fa3-901e-979cd5c1097a')
     def test_legacy_router_creation(self):
-        """
+        """Test legacy router creation
+
         Test uses administrative credentials to create a
         SF (Single Failure) router using the ha=False.
 
@@ -68,7 +70,8 @@
 
     @decorators.idempotent_id('5a6bfe82-5b23-45a4-b027-5160997d4753')
     def test_legacy_router_update_to_ha(self):
-        """
+        """Test legacy to HA router update
+
         Test uses administrative credentials to create a
         SF (Single Failure) router using the ha=False.
         Then it will "update" the router ha attribute to True
diff --git a/neutron_tempest_plugin/api/base.py b/neutron_tempest_plugin/api/base.py
index df0f4fa..c4bc71d 100644
--- a/neutron_tempest_plugin/api/base.py
+++ b/neutron_tempest_plugin/api/base.py
@@ -34,8 +34,7 @@
 
 class BaseNetworkTest(test.BaseTestCase):
 
-    """
-    Base class for the Neutron tests that use the Tempest Neutron REST client
+    """Base class for Neutron tests that use the Tempest Neutron REST client
 
     Per the Neutron API Guide, API v1.x was removed from the source code tree
     (docs.openstack.org/api/openstack-network/2.0/content/Overview-d1e71.html)
diff --git a/neutron_tempest_plugin/api/clients.py b/neutron_tempest_plugin/api/clients.py
index ee0289c..407e694 100644
--- a/neutron_tempest_plugin/api/clients.py
+++ b/neutron_tempest_plugin/api/clients.py
@@ -29,9 +29,7 @@
 
 
 class Manager(manager.Manager):
-    """
-    Top level manager for OpenStack tempest clients
-    """
+    """Top level manager for OpenStack tempest clients"""
     default_params = {
         'disable_ssl_certificate_validation':
             CONF.identity.disable_ssl_certificate_validation,
diff --git a/neutron_tempest_plugin/api/test_allowed_address_pair.py b/neutron_tempest_plugin/api/test_allowed_address_pair.py
index f34cc5b..0137ff2 100644
--- a/neutron_tempest_plugin/api/test_allowed_address_pair.py
+++ b/neutron_tempest_plugin/api/test_allowed_address_pair.py
@@ -20,7 +20,8 @@
 
 class AllowedAddressPairTestJSON(base.BaseNetworkTest):
 
-    """
+    """AllowedAddressPairTestJSON class
+
     Tests the Neutron Allowed Address Pair API extension using the Tempest
     REST client. The following API operations are tested with this extension:
 
diff --git a/neutron_tempest_plugin/api/test_auto_allocated_topology.py b/neutron_tempest_plugin/api/test_auto_allocated_topology.py
index 0baa2a8..4d70bfc 100644
--- a/neutron_tempest_plugin/api/test_auto_allocated_topology.py
+++ b/neutron_tempest_plugin/api/test_auto_allocated_topology.py
@@ -21,8 +21,8 @@
 
 
 class TestAutoAllocatedTopology(base.BaseAdminNetworkTest):
+    """Tests Get-Me-A-Network
 
-    """
     Tests the Get-Me-A-Network operations in the Neutron API
     using the REST client for Neutron.
     """
diff --git a/neutron_tempest_plugin/api/test_dhcp_ipv6.py b/neutron_tempest_plugin/api/test_dhcp_ipv6.py
index 0fab75c..4f2e576 100644
--- a/neutron_tempest_plugin/api/test_dhcp_ipv6.py
+++ b/neutron_tempest_plugin/api/test_dhcp_ipv6.py
@@ -82,7 +82,9 @@
 
     @decorators.idempotent_id('98244d88-d990-4570-91d4-6b25d70d08af')
     def test_dhcp_stateful_fixedips_outrange(self):
-        """When port gets IP address from fixed IP range it
+        """Test DHCP Stateful fixed IPs out of range
+
+        When port gets IP address from fixed IP range it
         shall be checked if it's from subnets range.
         """
         kwargs = {'ipv6_ra_mode': 'dhcpv6-stateful',
diff --git a/neutron_tempest_plugin/api/test_extra_dhcp_options.py b/neutron_tempest_plugin/api/test_extra_dhcp_options.py
index e5f73b2..cb4dba8 100644
--- a/neutron_tempest_plugin/api/test_extra_dhcp_options.py
+++ b/neutron_tempest_plugin/api/test_extra_dhcp_options.py
@@ -20,8 +20,8 @@
 
 
 class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):
+    """Test Extra DHCP Options
 
-    """
     Tests the following operations with the Extra DHCP Options Neutron API
     extension:
 
diff --git a/neutron_tempest_plugin/api/test_flavors_extensions.py b/neutron_tempest_plugin/api/test_flavors_extensions.py
index 30f1eb6..42eb7b1 100644
--- a/neutron_tempest_plugin/api/test_flavors_extensions.py
+++ b/neutron_tempest_plugin/api/test_flavors_extensions.py
@@ -19,8 +19,8 @@
 
 
 class TestFlavorsJson(base.BaseAdminNetworkTest):
+    """Test Flavors
 
-    """
     Tests the following operations in the Neutron API using the REST client for
     Neutron:
 
diff --git a/neutron_tempest_plugin/api/test_metering_extensions.py b/neutron_tempest_plugin/api/test_metering_extensions.py
index 745a8d0..ceeb2b6 100644
--- a/neutron_tempest_plugin/api/test_metering_extensions.py
+++ b/neutron_tempest_plugin/api/test_metering_extensions.py
@@ -23,8 +23,8 @@
 
 
 class MeteringTestJSON(base.BaseAdminNetworkTest):
+    """Test Metering
 
-    """
     Tests the following operations in the Neutron API using the REST client for
     Neutron:
 
diff --git a/neutron_tempest_plugin/api/test_network_ip_availability.py b/neutron_tempest_plugin/api/test_network_ip_availability.py
index 10aee2e..1cdfc7e 100644
--- a/neutron_tempest_plugin/api/test_network_ip_availability.py
+++ b/neutron_tempest_plugin/api/test_network_ip_availability.py
@@ -37,8 +37,8 @@
 
 
 class NetworksIpAvailabilityTest(base.BaseAdminNetworkTest):
+    """Tests Networks IP Availability
 
-    """
     Tests the following operations in the Neutron API using the REST client for
     Neutron:
 
diff --git a/neutron_tempest_plugin/api/test_networks.py b/neutron_tempest_plugin/api/test_networks.py
index 63e8ae5..f9d52ba 100644
--- a/neutron_tempest_plugin/api/test_networks.py
+++ b/neutron_tempest_plugin/api/test_networks.py
@@ -22,8 +22,8 @@
 
 
 class NetworksTestJSON(base.BaseNetworkTest):
+    """Test Networks
 
-    """
     Tests the following operations in the Neutron API using the REST client for
     Neutron:
 
diff --git a/neutron_tempest_plugin/api/test_subnetpools.py b/neutron_tempest_plugin/api/test_subnetpools.py
index 25d9780..9d927cf 100644
--- a/neutron_tempest_plugin/api/test_subnetpools.py
+++ b/neutron_tempest_plugin/api/test_subnetpools.py
@@ -58,7 +58,8 @@
     new_prefix = u'10.11.15.0/24'
     larger_prefix = u'10.11.0.0/16'
 
-    """
+    """Test Subnet Pools
+
     Tests the following operations in the Neutron API using the REST client for
     Neutron:
 
@@ -327,9 +328,7 @@
     @decorators.idempotent_id('4c6963c2-f54c-4347-b288-75d18421c4c4')
     @utils.requires_ext(extension='default-subnetpools', service='network')
     def test_tenant_create_non_default_subnetpool(self):
-        """
-        Test creates a subnetpool, the "is_default" attribute is False.
-        """
+        """Test creates a subnetpool, the "is_default" attribute is False."""
         created_subnetpool = self._create_subnetpool()
         self.assertFalse(created_subnetpool['is_default'])
 
diff --git a/neutron_tempest_plugin/common/ssh.py b/neutron_tempest_plugin/common/ssh.py
index 9812f4c..4829db2 100644
--- a/neutron_tempest_plugin/common/ssh.py
+++ b/neutron_tempest_plugin/common/ssh.py
@@ -146,8 +146,7 @@
     _get_ssh_connection = connect
 
     def close(self):
-        """Closes connection to SSH server and cleanup resources.
-        """
+        """Closes connection to SSH server and cleanup resources."""
         client = self._client
         if client is not None:
             client.close()
diff --git a/neutron_tempest_plugin/common/utils.py b/neutron_tempest_plugin/common/utils.py
index c42d984..fa7bb8b 100644
--- a/neutron_tempest_plugin/common/utils.py
+++ b/neutron_tempest_plugin/common/utils.py
@@ -54,8 +54,8 @@
 
 
 def wait_until_true(predicate, timeout=60, sleep=1, exception=None):
-    """
-    Wait until callable predicate is evaluated as True
+    """Wait until callable predicate is evaluated as True
+
     :param predicate: Callable deciding whether waiting should continue.
     Best practice is to instantiate predicate with functools.partial()
     :param timeout: Timeout in seconds how long should function wait.
@@ -69,7 +69,7 @@
                 eventlet.sleep(sleep)
     except eventlet.Timeout:
         if exception is not None:
-            #pylint: disable=raising-bad-type
+            # pylint: disable=raising-bad-type
             raise exception
         raise WaitTimeout("Timed out after %d seconds" % timeout)
 
diff --git a/neutron_tempest_plugin/config.py b/neutron_tempest_plugin/config.py
index e15748d..030a126 100644
--- a/neutron_tempest_plugin/config.py
+++ b/neutron_tempest_plugin/config.py
@@ -29,10 +29,6 @@
                 default=[],
                 help='List of network types available to neutron, '
                      'e.g. vxlan,vlan,gre.'),
-    cfg.BoolOpt('image_is_advanced',
-                default=False,
-                help='Image that supports features that cirros does not, like'
-                     ' Ubuntu or CentOS supporting advanced features'),
     cfg.StrOpt('agent_availability_zone',
                help='The availability zone for all agents in the deployment. '
                     'Configure this only when the single value is used by '
@@ -75,6 +71,26 @@
     cfg.IntOpt('ssh_proxy_jump_port',
                default=22,
                help='Port used to connect to "ssh_proxy_jump_host".'),
+
+    # Options for special, "advanced" image like e.g. Ubuntu. Such image can be
+    # used in tests which require some more advanced tool than available in
+    # Cirros
+    cfg.StrOpt('advanced_image_ref',
+               default=None,
+               help='Valid advanced image uuid to be used in tests. '
+                    'It is an image that supports features that Cirros '
+                    'does not, like Ubuntu or CentOS supporting advanced '
+                    'features.'),
+    cfg.StrOpt('advanced_image_flavor_ref',
+               default=None,
+               help='Valid flavor to use with advanced image in tests. '
+                    'This is required if advanced image has to be used in '
+                    'tests.'),
+    cfg.StrOpt('advanced_image_ssh_user',
+               default=None,
+               help='Name of ssh user to use with advanced image in tests. '
+                    'This is required if advanced image has to be used in '
+                    'tests.'),
 ]
 
 # TODO(amuller): Redo configuration options registration as part of the planned
diff --git a/neutron_tempest_plugin/scenario/admin/test_floatingip.py b/neutron_tempest_plugin/scenario/admin/test_floatingip.py
index 2dc0da8..1af5502 100644
--- a/neutron_tempest_plugin/scenario/admin/test_floatingip.py
+++ b/neutron_tempest_plugin/scenario/admin/test_floatingip.py
@@ -95,7 +95,9 @@
 
     @decorators.idempotent_id('6bba729b-3fb6-494b-9e1e-82bbd89a1045')
     def test_two_vms_fips(self):
-        """This test verifies the ability of two instances
+        """Test two VMs floating IPs
+
+        This test verifies the ability of two instances
         that were created in the same compute node and same availability zone
         to reach each other.
         """
diff --git a/neutron_tempest_plugin/scenario/base.py b/neutron_tempest_plugin/scenario/base.py
index 1aaf8ce..a2c5c72 100644
--- a/neutron_tempest_plugin/scenario/base.py
+++ b/neutron_tempest_plugin/scenario/base.py
@@ -40,6 +40,7 @@
     def create_server(self, flavor_ref, image_ref, key_name, networks,
                       **kwargs):
         """Create a server using tempest lib
+
         All the parameters are the ones used in Compute API
         * - Kwargs that require admin privileges
 
@@ -134,8 +135,7 @@
     @classmethod
     def create_pingable_secgroup_rule(cls, secgroup_id=None,
                                       client=None):
-        """This rule is intended to permit inbound ping
-        """
+        """This rule is intended to permit inbound ping"""
 
         rule_list = [{'protocol': 'icmp',
                       'direction': 'ingress',
diff --git a/neutron_tempest_plugin/scenario/test_mtu.py b/neutron_tempest_plugin/scenario/test_mtu.py
index 7a9f969..941d499 100644
--- a/neutron_tempest_plugin/scenario/test_mtu.py
+++ b/neutron_tempest_plugin/scenario/test_mtu.py
@@ -47,8 +47,8 @@
 
     def create_pingable_vm(self, net, keypair, secgroup):
         server = self.create_server(
-            flavor_ref=CONF.compute.flavor_ref,
-            image_ref=CONF.compute.image_ref,
+            flavor_ref=CONF.neutron_plugin_options.advanced_image_flavor_ref,
+            image_ref=CONF.neutron_plugin_options.advanced_image_ref,
             key_name=keypair['name'],
             networks=[{'uuid': net['id']}],
             security_groups=[{'name': secgroup[
@@ -105,22 +105,23 @@
                                                 self.keypair, self.secgroup)
         server_ssh_client1 = ssh.Client(
             self.floating_ips[0]['floating_ip_address'],
-            CONF.validation.image_ssh_user,
+            CONF.neutron_plugin_options.advanced_image_ssh_user,
             pkey=self.keypair['private_key'])
         server2, fip2 = self.create_pingable_vm(self.networks[1],
                                                 self.keypair, self.secgroup)
         server_ssh_client2 = ssh.Client(
             self.floating_ips[0]['floating_ip_address'],
-            CONF.validation.image_ssh_user,
+            CONF.neutron_plugin_options.advanced_image_ssh_user,
             pkey=self.keypair['private_key'])
         for fip in (fip1, fip2):
-            self.check_connectivity(fip['floating_ip_address'],
-                                    CONF.validation.image_ssh_user,
-                                    self.keypair['private_key'])
+            self.check_connectivity(
+                fip['floating_ip_address'],
+                CONF.neutron_plugin_options.advanced_image_ssh_user,
+                self.keypair['private_key'])
         return server_ssh_client1, fip1, server_ssh_client2, fip2
 
     @testtools.skipUnless(
-          CONF.neutron_plugin_options.image_is_advanced,
+          CONF.neutron_plugin_options.advanced_image_ref,
           "Advanced image is required to run this test.")
     @decorators.idempotent_id('3d73ec1a-2ec6-45a9-b0f8-04a273d9d344')
     def test_connectivity_min_max_mtu(self):
@@ -197,22 +198,23 @@
                                                 self.keypair, self.secgroup)
         server_ssh_client1 = ssh.Client(
             self.floating_ips[0]['floating_ip_address'],
-            CONF.validation.image_ssh_user,
+            CONF.neutron_plugin_options.advanced_image_ssh_user,
             pkey=self.keypair['private_key'])
         server2, fip2 = self.create_pingable_vm(self.networks[1],
                                                 self.keypair, self.secgroup)
         server_ssh_client2 = ssh.Client(
             self.floating_ips[0]['floating_ip_address'],
-            CONF.validation.image_ssh_user,
+            CONF.neutron_plugin_options.advanced_image_ssh_user,
             pkey=self.keypair['private_key'])
         for fip in (fip1, fip2):
-            self.check_connectivity(fip['floating_ip_address'],
-                                    CONF.validation.image_ssh_user,
-                                    self.keypair['private_key'])
+            self.check_connectivity(
+                fip['floating_ip_address'],
+                CONF.neutron_plugin_options.advanced_image_ssh_user,
+                self.keypair['private_key'])
         return server_ssh_client1, fip1, server_ssh_client2, fip2
 
     @testtools.skipUnless(
-          CONF.neutron_plugin_options.image_is_advanced,
+          CONF.neutron_plugin_options.advanced_image_ref,
           "Advanced image is required to run this test.")
     @decorators.idempotent_id('bc470200-d8f4-4f07-b294-1b4cbaaa35b9')
     def test_connectivity_min_max_mtu(self):
diff --git a/neutron_tempest_plugin/scenario/test_qos.py b/neutron_tempest_plugin/scenario/test_qos.py
index 702bbaa..6febb79 100644
--- a/neutron_tempest_plugin/scenario/test_qos.py
+++ b/neutron_tempest_plugin/scenario/test_qos.py
@@ -49,8 +49,7 @@
 
 
 def _connect_socket(host, port):
-    """Try to initiate a connection to a host using an ip address
-    and a port.
+    """Try to initiate a connection to a host using an ip address and a port.
 
     Trying couple of times until a timeout is reached in case the listening
     host is not ready yet.
diff --git a/neutron_tempest_plugin/scenario/test_security_groups.py b/neutron_tempest_plugin/scenario/test_security_groups.py
index a764a49..ebdcf93 100644
--- a/neutron_tempest_plugin/scenario/test_security_groups.py
+++ b/neutron_tempest_plugin/scenario/test_security_groups.py
@@ -43,6 +43,7 @@
     def create_vm_testing_sec_grp(self, num_servers=2, security_groups=None,
                                   ports=None):
         """Create instance for security group testing
+
         :param num_servers (int): number of servers to spawn
         :param security_groups (list): list of security groups
         :param ports* (list): list of ports
@@ -260,7 +261,9 @@
 
     @decorators.idempotent_id('f07d0159-8f9e-4faa-87f5-a869ab0ad488')
     def test_multiple_ports_secgroup_inheritance(self):
-        """This test creates two ports with security groups, then
+        """Test multiple port security group inheritance
+
+        This test creates two ports with security groups, then
         boots two instances and verify that the security group was
         inherited properly and enforced in these instances.
         """
diff --git a/neutron_tempest_plugin/scenario/test_trunk.py b/neutron_tempest_plugin/scenario/test_trunk.py
index e6d8863..1903180 100644
--- a/neutron_tempest_plugin/scenario/test_trunk.py
+++ b/neutron_tempest_plugin/scenario/test_trunk.py
@@ -64,12 +64,18 @@
         return {'port': port, 'trunk': trunk, 'fip': fip,
                 'server': server}
 
-    def _create_server_with_fip(self, port_id, **server_kwargs):
+    def _create_server_with_fip(self, port_id, use_advanced_image=False,
+                                **server_kwargs):
         fip = self.create_floatingip(port_id=port_id)
+        flavor_ref = CONF.compute.flavor_ref
+        image_ref = CONF.compute.image_ref
+        if use_advanced_image:
+            flavor_ref = CONF.neutron_plugin_options.advanced_image_flavor_ref
+            image_ref = CONF.neutron_plugin_options.advanced_image_ref
         return (
             self.create_server(
-                flavor_ref=CONF.compute.flavor_ref,
-                image_ref=CONF.compute.image_ref,
+                flavor_ref=flavor_ref,
+                image_ref=image_ref,
                 key_name=self.keypair['name'],
                 networks=[{'port': port_id}],
                 security_groups=[{'name': self.secgroup[
@@ -89,7 +95,8 @@
         t = self.client.show_trunk(trunk_id)['trunk']
         return t['status'] == 'ACTIVE'
 
-    def _create_server_with_port_and_subport(self, vlan_network, vlan_tag):
+    def _create_server_with_port_and_subport(self, vlan_network, vlan_tag,
+                                             use_advanced_image=False):
         parent_port = self.create_port(self.network, security_groups=[
             self.secgroup['security_group']['id']])
         port_for_subport = self.create_port(
@@ -102,11 +109,16 @@
             'segmentation_id': vlan_tag}
         self.create_trunk(parent_port, [subport])
 
-        server, fip = self._create_server_with_fip(parent_port['id'])
+        server, fip = self._create_server_with_fip(
+            parent_port['id'], use_advanced_image=use_advanced_image)
+
+        ssh_user = CONF.validation.image_ssh_user
+        if use_advanced_image:
+            ssh_user = CONF.neutron_plugin_options.advanced_image_ssh_user
 
         server_ssh_client = ssh.Client(
             fip['floating_ip_address'],
-            CONF.validation.image_ssh_user,
+            ssh_user,
             pkey=self.keypair['private_key'])
 
         return {
@@ -116,12 +128,15 @@
             'subport': port_for_subport,
         }
 
-    def _wait_for_server(self, server):
+    def _wait_for_server(self, server, advanced_image=False):
+        ssh_user = CONF.validation.image_ssh_user
+        if advanced_image:
+            ssh_user = CONF.neutron_plugin_options.advanced_image_ssh_user
         waiters.wait_for_server_status(self.os_primary.servers_client,
                                        server['server']['id'],
                                        constants.SERVER_STATUS_ACTIVE)
         self.check_connectivity(server['fip']['floating_ip_address'],
-                                CONF.validation.image_ssh_user,
+                                ssh_user,
                                 self.keypair['private_key'])
 
     @decorators.idempotent_id('bb13fe28-f152-4000-8131-37890a40c79e')
@@ -205,7 +220,7 @@
                                 self.keypair['private_key'])
 
     @testtools.skipUnless(
-          CONF.neutron_plugin_options.image_is_advanced,
+          CONF.neutron_plugin_options.advanced_image_ref,
           "Advanced image is required to run this test.")
     @decorators.idempotent_id('a8a02c9b-b453-49b5-89a2-cce7da66aafb')
     def test_subport_connectivity(self):
@@ -215,11 +230,12 @@
         self.create_subnet(vlan_network, gateway=None)
 
         servers = [
-            self._create_server_with_port_and_subport(vlan_network, vlan_tag)
+            self._create_server_with_port_and_subport(
+                vlan_network, vlan_tag, use_advanced_image=True)
             for i in range(2)]
 
         for server in servers:
-            self._wait_for_server(server)
+            self._wait_for_server(server, advanced_image=True)
             # Configure VLAN interfaces on server
             command = CONFIGURE_VLAN_INTERFACE_COMMANDS % {'tag': vlan_tag}
             server['ssh_client'].exec_command(command)
diff --git a/neutron_tempest_plugin/services/network/json/network_client.py b/neutron_tempest_plugin/services/network/json/network_client.py
index 0d26a0e..58dfbf4 100644
--- a/neutron_tempest_plugin/services/network/json/network_client.py
+++ b/neutron_tempest_plugin/services/network/json/network_client.py
@@ -19,8 +19,8 @@
 
 
 class NetworkClientJSON(service_client.RestClient):
+    """NetworkClientJSON class
 
-    """
     Tempest REST client for Neutron. Uses v2 of the Neutron API, since the
     V1 API has been removed from the code base.
 
@@ -447,7 +447,8 @@
         return service_client.ResponseBody(resp, body)
 
     def update_agent(self, agent_id, agent_info):
-        """
+        """Update an agent
+
         :param agent_info: Agent update information.
         E.g {"admin_state_up": True}
         """
diff --git a/tox.ini b/tox.ini
index 5eb8b10..82a473c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -56,11 +56,8 @@
 # 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
-# E265 block comment should start with '# '
-# H404 multi line docstring should start with a summary
-# H405 multi line docstring summary not separated with an empty line
 # N530 direct neutron imports not allowed
-ignore = E125,E126,E128,E129,E265,H404,H405,N530
+ignore = E125,E126,E128,E129,N530
 # H106: Don't put vim configuration in source files
 # H203: Use assertIs(Not)None to check for None
 # H904: Delay string interpolations at logging calls