Merge "Fix H404/405 violations for remaining"
diff --git a/tempest/clients.py b/tempest/clients.py
index cab7512..3fb4c22 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -154,10 +154,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':
diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py
index a4ed064..ac67ce4 100644
--- a/tempest/cmd/init.py
+++ b/tempest/cmd/init.py
@@ -35,7 +35,9 @@
 
 
 def get_tempest_default_config_dir():
-    """Returns the correct default config dir to support both cases of
+    """Get default config directory of tempest
+
+    Returns the correct default config dir to support both cases of
     tempest being or not installed in a virtualenv.
     Cases considered:
     - no virtual env, python2: real_prefix and base_prefix not set
diff --git a/tempest/cmd/run_stress.py b/tempest/cmd/run_stress.py
index 0448589..80f1b85 100755
--- a/tempest/cmd/run_stress.py
+++ b/tempest/cmd/run_stress.py
@@ -33,8 +33,7 @@
 
 
 def discover_stress_tests(path="./", filter_attr=None, call_inherited=False):
-    """Discovers all tempest tests and create action out of them
-    """
+    """Discovers all tempest tests and create action out of them"""
     LOG.info("Start test discovery")
     tests = []
     testloader = loader.TestLoader()
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index b3d60f6..c23e70c 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -17,8 +17,7 @@
 
 
 class TempestException(Exception):
-    """
-    Base Tempest Exception
+    """Base Tempest Exception
 
     To correctly use this class, inherit from it and define
     a 'message' property. That message will get printf'd
diff --git a/tempest/manager.py b/tempest/manager.py
index b0541e8..9904aa6 100644
--- a/tempest/manager.py
+++ b/tempest/manager.py
@@ -23,16 +23,15 @@
 
 
 class Manager(object):
-
-    """
-    Base manager class
+    """Base manager class
 
     Manager objects are responsible for providing a configuration object
     and a client object for a test case to use in performing actions.
     """
 
     def __init__(self, credentials):
-        """
+        """Initialization of base manager class
+
         Credentials to be used within the various client classes managed by the
         Manager object must be defined.
 
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index 704342f..3689508 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -27,10 +27,7 @@
 
 
 class TestNetworkAdvancedServerOps(manager.NetworkScenarioTest):
-
-    """
-    This test case checks VM connectivity after some advanced
-    instance operations executed:
+    """Check VM connectivity after some advanced instance operations executed:
 
      * Stop/Start an instance
      * Reboot an instance
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index dc5ca08..8fefd9e 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -36,7 +36,8 @@
 
 class TestNetworkBasicOps(manager.NetworkScenarioTest):
 
-    """
+    """The test suite of network basic operations
+
     This smoke test suite assumes that Nova has been configured to
     boot VM's with Neutron-managed networking, and attempts to
     verify network connectivity as follows:
@@ -123,9 +124,9 @@
         self.floating_ip_tuple = Floating_IP_tuple(floating_ip, server)
 
     def check_networks(self):
-        """
-        Checks that we see the newly created network/subnet/router via
-        checking the result of list_[networks,routers,subnets]
+        """Checks that we see the newly created network/subnet/router
+
+        via checking the result of list_[networks,routers,subnets]
         """
 
         seen_nets = self._list_networks()
@@ -182,7 +183,8 @@
     def check_public_network_connectivity(
             self, should_connect=True, msg=None,
             should_check_floating_ip_status=True):
-        """Verifies connectivty to a VM via public network and floating IP,
+        """Verifies connectivty to a VM via public network and floating IP
+
         and verifies floating IP has resource status is correct.
 
         :param should_connect: bool. determines if connectivity check is
@@ -294,8 +296,8 @@
 
     def _check_network_internal_connectivity(self, network,
                                              should_connect=True):
-        """
-        via ssh check VM internal connectivity:
+        """via ssh check VM internal connectivity:
+
         - ping internal gateway and DHCP port, implying in-tenant connectivity
         pinging both, because L3 and DHCP agents might be on different nodes
         """
@@ -312,10 +314,7 @@
                                         should_connect)
 
     def _check_network_external_connectivity(self):
-        """
-        ping public network default gateway to imply external connectivity
-
-        """
+        """ping default gateway to imply external connectivity"""
         if not CONF.network.public_network_id:
             msg = 'public network not defined.'
             LOG.info(msg)
@@ -359,7 +358,8 @@
     @test.idempotent_id('f323b3ba-82f8-4db7-8ea6-6a895869ec49')
     @test.services('compute', 'network')
     def test_network_basic_ops(self):
-        """
+        """Basic network operation test
+
         For a freshly-booted VM with an IP address ("port") on a given
             network:
 
@@ -412,7 +412,8 @@
                       'Baremetal relies on a shared physical network.')
     @test.services('compute', 'network')
     def test_connectivity_between_vms_on_different_networks(self):
-        """
+        """Test connectivity between VMs on different networks
+
         For a freshly-booted VM with an IP address ("port") on a given
             network:
 
@@ -460,7 +461,8 @@
                       'vnic_type direct or macvtap')
     @test.services('compute', 'network')
     def test_hotplug_nic(self):
-        """
+        """Test hotplug network interface
+
         1. create a new network, with no gateway (to prevent overwriting VM's
             gateway)
         2. connect VM to new network
@@ -480,7 +482,8 @@
                       'network')
     @test.services('compute', 'network')
     def test_update_router_admin_state(self):
-        """
+        """Test to update admin state up of router
+
         1. Check public connectivity before updating
                 admin_state_up attribute of router to False
         2. Check public connectivity after updating
@@ -512,8 +515,9 @@
                           "DHCP client is not available.")
     @test.services('compute', 'network')
     def test_subnet_details(self):
-        """Tests that subnet's extra configuration details are affecting
-        the VMs. This test relies on non-shared, isolated tenant networks.
+        """Tests that subnet's extra configuration details are affecting VMs.
+
+         This test relies on non-shared, isolated tenant networks.
 
          NOTE: Neutron subnets push data to servers via dhcp-agent, so any
          update in subnet requires server to actively renew its DHCP lease.
@@ -567,12 +571,11 @@
                          "Failed to update subnet's nameservers")
 
         def check_new_dns_server():
-            """Server needs to renew its dhcp lease in order to get the new dns
-            definitions from subnet
-            NOTE(amuller): we are renewing the lease as part of the retry
-            because Neutron updates dnsmasq asynchronously after the
-            subnet-update API call returns.
-            """
+            # NOTE: Server needs to renew its dhcp lease in order to get new
+            # definitions from subnet
+            # NOTE(amuller): we are renewing the lease as part of the retry
+            # because Neutron updates dnsmasq asynchronously after the
+            # subnet-update API call returns.
             ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'])
             if ssh_client.get_dns_servers() != [alt_dns_server]:
                 LOG.debug("Failed to update DNS nameservers")
@@ -594,7 +597,8 @@
                           "by the test environment")
     @test.services('compute', 'network')
     def test_update_instance_port_admin_state(self):
-        """
+        """Test to update admin_state_up attribute of instance port
+
         1. Check public connectivity before updating
                 admin_state_up attribute of instance port to False
         2. Check public connectivity after updating
@@ -625,8 +629,10 @@
                           'supported in the version of Nova being tested.')
     @test.services('compute', 'network')
     def test_preserve_preexisting_port(self):
-        """Tests that a pre-existing port provided on server boot is not
-        deleted if the server is deleted.
+        """Test preserve pre-existing port
+
+        Tests that a pre-existing port provided on server boot is not deleted
+        if the server is deleted.
 
         Nova should unbind the port from the instance on delete if the port was
         not created by Nova as part of the boot request.
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 29e393f..51188d5 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -97,6 +97,7 @@
 
     class TenantProperties(object):
         """helper class to save tenant details
+
             id
             credentials
             network
@@ -298,6 +299,7 @@
 
     def _deploy_tenant(self, tenant_or_id):
         """creates:
+
             network
             subnet
             router (if public not defined)
@@ -374,8 +376,8 @@
                                  should_succeed=False)
 
     def _test_cross_tenant_allow(self, source_tenant, dest_tenant):
-        """
-        check for each direction:
+        """check for each direction:
+
         creating rule for tenant incoming traffic enables only 1way traffic
         """
         ruleset = dict(
@@ -408,10 +410,8 @@
         self._check_connectivity(access_point_ssh_2, ip)
 
     def _verify_mac_addr(self, tenant):
-        """
-        verify that VM (tenant's access point) has the same ip,mac as listed in
-        port list
-        """
+        """Verify that VM has the same ip, mac as listed in port"""
+
         access_point_ssh = self._connect_to_access_point(tenant)
         mac_addr = access_point_ssh.get_mac_address()
         mac_addr = mac_addr.strip().lower()
@@ -466,9 +466,9 @@
     @test.idempotent_id('f4d556d7-1526-42ad-bafb-6bebf48568f6')
     @test.services('compute', 'network')
     def test_port_update_new_security_group(self):
-        """
-        This test verifies the traffic after updating the vm port with new
-        security group having appropriate rule.
+        """Verifies the traffic after updating the vm port
+
+        With new security group having appropriate rule.
         """
         new_tenant = self.primary_tenant
 
@@ -517,8 +517,8 @@
     @test.idempotent_id('d2f77418-fcc4-439d-b935-72eca704e293')
     @test.services('compute', 'network')
     def test_multiple_security_groups(self):
-        """
-        This test verifies multiple security groups and checks that rules
+        """Verify multiple security groups and checks that rules
+
         provided in the both the groups is applied onto VM
         """
         tenant = self.primary_tenant
@@ -536,13 +536,11 @@
             secgroup=tenant.security_groups['default'],
             **ruleset
         )
-        """
-        Vm now has 2 security groups one with ssh rule(
-        already added in setUp() method),and other with icmp rule
-        (added in the above step).The check_vm_connectivity tests
-        -that vm ping test is successful
-        -ssh to vm is successful
-        """
+        # NOTE: Vm now has 2 security groups one with ssh rule(
+        # already added in setUp() method),and other with icmp rule
+        # (added in the above step).The check_vm_connectivity tests
+        # -that vm ping test is successful
+        # -ssh to vm is successful
         self.check_vm_connectivity(ip,
                                    username=ssh_login,
                                    private_key=private_key,
@@ -552,10 +550,7 @@
     @test.idempotent_id('7c811dcc-263b-49a3-92d2-1b4d8405f50c')
     @test.services('compute', 'network')
     def test_port_security_disable_security_group(self):
-        """
-        This test verifies port_security_enabled=False disables
-        the default security group rules.
-        """
+        """Verify the default security group rules is disabled."""
         new_tenant = self.primary_tenant
 
         # Create server
diff --git a/tempest/services/compute/json/quota_classes_client.py b/tempest/services/compute/json/quota_classes_client.py
index d55c3f1..7aac5e4 100644
--- a/tempest/services/compute/json/quota_classes_client.py
+++ b/tempest/services/compute/json/quota_classes_client.py
@@ -32,9 +32,7 @@
         return service_client.ResponseBody(resp, body)
 
     def update_quota_class_set(self, quota_class_id, **kwargs):
-        """
-        Updates the quota class's limits for one or more resources.
-        """
+        """Updates the quota class's limits for one or more resources."""
         post_body = json.dumps({'quota_class_set': kwargs})
 
         resp, body = self.put('os-quota-class-sets/%s' % quota_class_id,
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
index 4a1b909..e628b3a 100644
--- a/tempest/services/compute/json/quotas_client.py
+++ b/tempest/services/compute/json/quotas_client.py
@@ -42,9 +42,7 @@
         return service_client.ResponseBody(resp, body)
 
     def update_quota_set(self, tenant_id, user_id=None, **kwargs):
-        """
-        Updates the tenant's quota limits for one or more resources
-        """
+        """Updates the tenant's quota limits for one or more resources"""
         post_body = json.dumps({'quota_set': kwargs})
 
         if user_id:
diff --git a/tempest/services/compute/json/security_group_default_rules_client.py b/tempest/services/compute/json/security_group_default_rules_client.py
index 6e4d1e4..b31baab 100644
--- a/tempest/services/compute/json/security_group_default_rules_client.py
+++ b/tempest/services/compute/json/security_group_default_rules_client.py
@@ -23,8 +23,8 @@
 class SecurityGroupDefaultRulesClient(service_client.ServiceClient):
 
     def create_security_default_group_rule(self, **kwargs):
-        """
-        Creating security group default rules.
+        """Creating security group default rules.
+
         ip_protocol : ip_protocol (icmp, tcp, udp).
         from_port: Port at start of range.
         to_port  : Port at end of range.
diff --git a/tempest/services/compute/json/security_group_rules_client.py b/tempest/services/compute/json/security_group_rules_client.py
index 9626f60..314b1ed 100644
--- a/tempest/services/compute/json/security_group_rules_client.py
+++ b/tempest/services/compute/json/security_group_rules_client.py
@@ -22,8 +22,8 @@
 class SecurityGroupRulesClient(service_client.ServiceClient):
 
     def create_security_group_rule(self, **kwargs):
-        """
-        Creating a new security group rules.
+        """Creating a new security group rules.
+
         parent_group_id :ID of Security group
         ip_protocol : ip_proto (icmp, tcp, udp).
         from_port: Port at start of range.
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index 083d03a..c996079 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -44,8 +44,8 @@
         return service_client.ResponseBody(resp, body)
 
     def create_security_group(self, **kwargs):
-        """
-        Creates a new security group.
+        """Creates a new security group.
+
         name (Required): Name of security group.
         description (Required): Description of security group.
         """
@@ -56,8 +56,8 @@
         return service_client.ResponseBody(resp, body)
 
     def update_security_group(self, security_group_id, **kwargs):
-        """
-        Update a security group.
+        """Update a security group.
+
         security_group_id: a security_group to update
         name: new name of security group
         description: new description of security group
diff --git a/tempest/services/compute/json/server_groups_client.py b/tempest/services/compute/json/server_groups_client.py
index 7284e02..44ac015 100644
--- a/tempest/services/compute/json/server_groups_client.py
+++ b/tempest/services/compute/json/server_groups_client.py
@@ -23,8 +23,8 @@
 class ServerGroupsClient(service_client.ServiceClient):
 
     def create_server_group(self, **kwargs):
-        """
-        Create the server group
+        """Create the server group
+
         name : Name of the server-group
         policies : List of the policies - affinity/anti-affinity)
         """
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
index 6e2f320..57d0434 100644
--- a/tempest/services/compute/json/services_client.py
+++ b/tempest/services/compute/json/services_client.py
@@ -34,8 +34,8 @@
         return service_client.ResponseBody(resp, body)
 
     def enable_service(self, **kwargs):
-        """
-        Enable service on a host
+        """Enable service on a host
+
         host_name: Name of host
         binary: Service binary
         """
@@ -46,8 +46,8 @@
         return service_client.ResponseBody(resp, body)
 
     def disable_service(self, **kwargs):
-        """
-        Disable service on a host
+        """Disable service on a host
+
         host_name: Name of host
         binary: Service binary
         """
diff --git a/tempest/services/compute/json/volumes_client.py b/tempest/services/compute/json/volumes_client.py
index e799c29..69d982e 100644
--- a/tempest/services/compute/json/volumes_client.py
+++ b/tempest/services/compute/json/volumes_client.py
@@ -46,8 +46,8 @@
         return service_client.ResponseBody(resp, body)
 
     def create_volume(self, **kwargs):
-        """
-        Creates a new Volume.
+        """Creates a new Volume.
+
         size(Required): Size of volume in GB.
         Following optional keyword arguments are accepted:
         display_name: Optional Volume Name.
diff --git a/tempest/test.py b/tempest/test.py
index 4be6779..7b508ac 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -211,6 +211,7 @@
 class BaseTestCase(testtools.testcase.WithAttributes,
                    testtools.TestCase):
     """The test base class defines Tempest framework for class level fixtures.
+
     `setUpClass` and `tearDownClass` are defined here and cannot be overwritten
     by subclasses (enforced via hacking rule T105).
 
@@ -315,8 +316,10 @@
 
     @classmethod
     def skip_checks(cls):
-        """Class level skip checks. Subclasses verify in here all
-        conditions that might prevent the execution of the entire test class.
+        """Class level skip checks.
+
+        Subclasses verify in here all conditions that might prevent the
+        execution of the entire test class.
         Checks implemented here may not make use API calls, and should rely on
         configuration alone.
         In general skip checks that require an API call are discouraged.
@@ -343,6 +346,7 @@
     @classmethod
     def setup_credentials(cls):
         """Allocate credentials and the client managers from them.
+
         A test class that requires network resources must override
         setup_credentials and defined the required resources before super
         is invoked.
@@ -380,8 +384,7 @@
 
     @classmethod
     def resource_setup(cls):
-        """Class level resource setup for test cases.
-        """
+        """Class level resource setup for test cases."""
         if hasattr(cls, "os"):
             cls.validation_resources = vresources.create_validation_resources(
                 cls.os, cls.validation_resources)
@@ -392,6 +395,7 @@
     @classmethod
     def resource_cleanup(cls):
         """Class level resource cleanup for test cases.
+
         Resource cleanup must be able to handle the case of partially setup
         resources, in case a failure during `resource_setup` should happen.
         """
@@ -523,9 +527,7 @@
 
     @classmethod
     def clear_credentials(cls):
-        """
-        Clears creds if set
-        """
+        """Clears creds if set"""
         if hasattr(cls, '_creds_provider'):
             cls._creds_provider.clear_creds()
 
@@ -534,6 +536,7 @@
                                  security_group=None,
                                  security_group_rules=None):
         """Specify which ssh server validation resources should be created.
+
         Each of the argument must be set to either None, True or False, with
         None - use default from config (security groups and security group
                rules get created when set to None)
@@ -631,10 +634,11 @@
 
     @staticmethod
     def load_tests(*args):
-        """
-        Wrapper for testscenarios to set the mandatory scenarios variable
-        only in case a real test loader is in place. Will be automatically
-        called in case the variable "load_tests" is set.
+        """Wrapper for testscenarios
+
+        To set the mandatory scenarios variable only in case a real test
+        loader is in place. Will be automatically called in case the variable
+        "load_tests" is set.
         """
         if getattr(args[0], 'suiteClass', None) is not None:
             loader, standard_tests, pattern = args
@@ -649,8 +653,7 @@
 
     @staticmethod
     def generate_scenario(description):
-        """
-        Generates the test scenario list for a given description.
+        """Generates the test scenario list for a given description.
 
         :param description: A file or dictionary with the following entries:
             name (required) name for the api
@@ -694,7 +697,8 @@
         return scenario_list
 
     def execute(self, description):
-        """
+        """Execute a http call
+
         Execute a http call on an api that are expected to
         result in client errors. First it uses invalid resources that are part
         of the url, and then invalid data for queries and http request bodies.
@@ -788,7 +792,8 @@
 
     @classmethod
     def set_resource(cls, name, resource):
-        """
+        """Register a resoruce for a test
+
         This function can be used in setUpClass context to register a resoruce
         for a test.
 
@@ -799,10 +804,10 @@
         cls._resources[name] = resource
 
     def get_resource(self, name):
-        """
-        Return a valid uuid for a type of resource. If a real resource is
-        needed as part of a url then this method should return one. Otherwise
-        it can return None.
+        """Return a valid uuid for a type of resource.
+
+        If a real resource is needed as part of a url then this method should
+        return one. Otherwise it can return None.
 
         :param name: The name of the kind of resource such as "flavor", "role",
             etc.
@@ -819,9 +824,7 @@
 
 
 def SimpleNegativeAutoTest(klass):
-    """
-    This decorator registers a test function on basis of the class name.
-    """
+    """This decorator registers a test function on basis of the class name."""
     @attr(type=['negative'])
     def generic_test(self):
         if hasattr(self, '_schema'):
@@ -838,10 +841,9 @@
 
 
 def call_until_true(func, duration, sleep_for):
-    """
-    Call the given function until it returns True (and return True) or
-    until the specified duration (in seconds) elapses (and return
-    False).
+    """Call the given function until it returns True (and return True)
+
+    or until the specified duration (in seconds) elapses (and return False).
 
     :param func: A zero argument callable that returns True on success.
     :param duration: The number of seconds for which to attempt a
diff --git a/tempest/test_discover/plugins.py b/tempest/test_discover/plugins.py
index 58a9905..108b50d 100644
--- a/tempest/test_discover/plugins.py
+++ b/tempest/test_discover/plugins.py
@@ -25,14 +25,14 @@
 
 @six.add_metaclass(abc.ABCMeta)
 class TempestPlugin(object):
-    """A TempestPlugin class provides the basic hooks for an external
-    plugin to provide tempest the necessary information to run the plugin.
+    """Provide basic hooks for an external plugin
+
+    To provide tempest the necessary information to run the plugin.
     """
 
     @abc.abstractmethod
     def load_tests(self):
-        """Method to return the information necessary to load the tests in the
-        plugin.
+        """Return the information necessary to load the tests in the plugin.
 
         :return: a tuple with the first value being the test_dir and the second
                  being the top_level
@@ -42,9 +42,10 @@
 
     @abc.abstractmethod
     def register_opts(self, conf):
-        """Method to add additional configuration options to tempest. This
-        method will be run for the plugin during the register_opts() function
-        in tempest.config
+        """Add additional configuration options to tempest.
+
+        This method will be run for the plugin during the register_opts()
+        function in tempest.config
 
         :param ConfigOpts conf: The conf object that can be used to register
             additional options on.
@@ -53,7 +54,7 @@
 
     @abc.abstractmethod
     def get_opt_lists(self):
-        """Method to get a list of options for sample config generation
+        """Get a list of options for sample config generation
 
         :return option_list: A list of tuples with the group name and options
                              in that group.
diff --git a/tox.ini b/tox.ini
index 09c8626..892cfed 100644
--- a/tox.ini
+++ b/tox.ini
@@ -129,6 +129,6 @@
 # E123 skipped because it is ignored by default in the default pep8
 # E129 skipped because it is too limiting when combined with other rules
 # Skipped because of new hacking 0.9: H405
-ignore = E125,E123,E129,H404,H405
+ignore = E125,E123,E129
 show-source = True
 exclude = .git,.venv,.tox,dist,doc,openstack,*egg