Merge "Make server action methods[m-z] use **kwargs"
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index b038c6b..fd6f105 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -130,7 +130,7 @@
     @test.idempotent_id('ee8ae470-db70-474d-b752-690b7892cab1')
     def test_reset_state_server(self):
         # Reset server's state to 'error'
-        self.client.reset_state(self.s1_id)
+        self.client.reset_state(self.s1_id, state='error')
 
         # Verify server's state
         server = self.client.show_server(self.s1_id)['server']
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index 7c5e8d0..055dc1b 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -123,7 +123,7 @@
     @test.idempotent_id('e741298b-8df2-46f0-81cb-8f814ff2504c')
     def test_reset_state_server_nonexistent_server(self):
         self.assertRaises(lib_exc.NotFound,
-                          self.client.reset_state, '999')
+                          self.client.reset_state, '999', state='error')
 
     @test.attr(type=['negative'])
     @test.idempotent_id('e84e2234-60d2-42fa-8b30-e2d3049724ac')
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index ee840be..81a02be 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -109,7 +109,7 @@
                           sg['id'])
 
         # Reboot and add the other security group
-        self.servers_client.reboot_server(server_id, 'HARD')
+        self.servers_client.reboot_server(server_id, type='HARD')
         waiters.wait_for_server_status(self.servers_client, server_id,
                                        'ACTIVE')
         self.servers_client.add_security_group(server_id, name=sg2['name'])
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index 814aec7..1367629 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -35,7 +35,7 @@
     @test.idempotent_id('77ca5cc5-9990-45e0-ab98-1de8fead201a')
     def test_list_instance_actions(self):
         # List actions of the provided server
-        self.client.reboot_server(self.server_id, 'HARD')
+        self.client.reboot_server(self.server_id, type='HARD')
         waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
 
         body = (self.client.list_instance_actions(self.server_id)
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 5c30b96..71dfd96 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -104,7 +104,7 @@
                 self.validation_resources['keypair']['private_key'])
             boot_time = linux_client.get_boot_time()
 
-        self.client.reboot_server(self.server_id, reboot_type)
+        self.client.reboot_server(self.server_id, type=reboot_type)
         waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
 
         if CONF.validation.run_validation:
@@ -373,7 +373,7 @@
         # log file is truncated and we cannot get any console log through
         # "console-log" API.
         # The detail is https://bugs.launchpad.net/nova/+bug/1251920
-        self.client.reboot_server(self.server_id, 'HARD')
+        self.client.reboot_server(self.server_id, type='HARD')
         waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
         self.wait_for(self._get_output)
 
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index 1552848..2296980 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -121,4 +121,4 @@
 
         # Delete Security group
         self.servers_client.remove_security_group(self.server_id,
-                                                  self.sg_name)
+                                                  name=self.sg_name)
diff --git a/tempest/api/compute/servers/test_server_rescue_negative.py b/tempest/api/compute/servers/test_server_rescue_negative.py
index f8567cf..65ad2f5 100644
--- a/tempest/api/compute/servers/test_server_rescue_negative.py
+++ b/tempest/api/compute/servers/test_server_rescue_negative.py
@@ -101,7 +101,7 @@
     @test.idempotent_id('db22b618-f157-4566-a317-1b6d467a8094')
     def test_rescued_vm_reboot(self):
         self.assertRaises(lib_exc.Conflict, self.servers_client.reboot_server,
-                          self.rescue_id, 'HARD')
+                          self.rescue_id, type='HARD')
 
     @test.attr(type=['negative'])
     @test.idempotent_id('6dfc0a55-3a77-4564-a144-1587b7971dde')
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index e0ed66c..ed8484e 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -152,7 +152,7 @@
         # Reboot a non existent server
         nonexistent_server = data_utils.rand_uuid()
         self.assertRaises(lib_exc.NotFound, self.client.reboot_server,
-                          nonexistent_server, 'SOFT')
+                          nonexistent_server, type='SOFT')
 
     @test.idempotent_id('d1417e7f-a509-41b5-a102-d5eed8613369')
     @testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -188,7 +188,7 @@
         waiters.wait_for_server_termination(self.client, server['id'])
 
         self.assertRaises(lib_exc.NotFound, self.client.reboot_server,
-                          server['id'], 'SOFT')
+                          server['id'], type='SOFT')
 
     @test.attr(type=['negative'])
     @test.idempotent_id('d86141a7-906e-4731-b187-d64a2ea61422')
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index de25c9c..e363fc4 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -157,7 +157,7 @@
     def test_reboot_server_for_alt_account_fails(self):
         # A reboot request for another user's server should fail
         self.assertRaises(lib_exc.NotFound, self.alt_client.reboot_server,
-                          self.server['id'], 'HARD')
+                          self.server['id'], type='HARD')
 
     @test.idempotent_id('8a0bce51-cd00-480b-88ba-dbc7d8408a37')
     def test_rebuild_server_for_alt_account_fails(self):
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 585b19d..2ef3cee 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -84,7 +84,7 @@
         self.assertEqual(volume, got_volume)
 
     def nova_reboot(self, server):
-        self.servers_client.reboot_server(server['id'], 'SOFT')
+        self.servers_client.reboot_server(server['id'], type='SOFT')
         self._wait_for_server_status(server, 'ACTIVE')
 
     def check_partitions(self):
@@ -97,7 +97,7 @@
         self.servers_client.add_security_group(server['id'],
                                                name=secgroup['name'])
         self.addCleanup(self.servers_client.remove_security_group,
-                        server['id'], secgroup['name'])
+                        server['id'], name=secgroup['name'])
 
         def wait_for_secgroup_add():
             body = (self.servers_client.show_server(server['id'])
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index a45a730..8aac98e 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -112,7 +112,7 @@
     @test.services('compute', 'network')
     def test_server_connectivity_reboot(self):
         server, keypair, floating_ip = self._setup_network_and_servers()
-        self.servers_client.reboot_server(server['id'], reboot_type='SOFT')
+        self.servers_client.reboot_server(server['id'], type='SOFT')
         self._wait_server_status_and_check_network_connectivity(
             server, keypair, floating_ip)
 
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 8d3fcb3..c20295b 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -187,12 +187,19 @@
                                resp, body)
         return service_client.ResponseBody(resp, body)
 
-    def reboot_server(self, server_id, reboot_type):
-        """Reboots a server."""
-        return self.action(server_id, 'reboot', type=reboot_type)
+    def reboot_server(self, server_id, **kwargs):
+        """Reboot a server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#reboot
+        """
+        return self.action(server_id, 'reboot', **kwargs)
 
     def rebuild_server(self, server_id, image_ref, **kwargs):
-        """Rebuilds a server with a new image.
+        """Rebuild a server with a new image.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#rebuild
 
         Most parameters except the following are passed to the API without
         any changes.
@@ -209,7 +216,10 @@
                            rebuild_schema, **kwargs)
 
     def resize_server(self, server_id, flavor_ref, **kwargs):
-        """Changes the flavor of a server.
+        """Change the flavor of a server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#resize
 
         Most parameters except the following are passed to the API without
         any changes.
@@ -231,7 +241,11 @@
                            **kwargs)
 
     def revert_resize_server(self, server_id, **kwargs):
-        """Reverts a server back to its original flavor."""
+        """Revert a server back to its original flavor.
+
+        Available params: see http://developer.openstack.org/
+                              api-ref-compute-v2.1.html#revertResize
+        """
         return self.action(server_id, 'revertResize', **kwargs)
 
     def list_server_metadata(self, server_id):
@@ -332,9 +346,16 @@
         # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1524199
         return self.action(server_id, 'addSecurityGroup', **kwargs)
 
-    def remove_security_group(self, server_id, name):
-        """Removes a security group from the server."""
-        return self.action(server_id, 'removeSecurityGroup', name=name)
+    def remove_security_group(self, server_id, **kwargs):
+        """Remove a security group from the server.
+
+        Available params: TODO
+        """
+        # TODO(oomichi): The api-site doesn't contain this API description.
+        # So the above should be changed to the api-site link after
+        # adding the description on the api-site.
+        # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1524199
+        return self.action(server_id, 'removeSecurityGroup', **kwargs)
 
     def live_migrate_server(self, server_id, **kwargs):
         """This should be called with administrator privileges.
@@ -345,7 +366,11 @@
         return self.action(server_id, 'os-migrateLive', **kwargs)
 
     def migrate_server(self, server_id, **kwargs):
-        """Migrates a server to a new host."""
+        """Migrate a server to a new host.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#migrate
+        """
         return self.action(server_id, 'migrate', **kwargs)
 
     def lock_server(self, server_id, **kwargs):
@@ -357,39 +382,75 @@
         return self.action(server_id, 'lock', **kwargs)
 
     def unlock_server(self, server_id, **kwargs):
-        """UNlocks the given server."""
+        """UNlock the given server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#unlock
+        """
         return self.action(server_id, 'unlock', **kwargs)
 
     def suspend_server(self, server_id, **kwargs):
-        """Suspends the provided server."""
+        """Suspend the provided server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#suspend
+        """
         return self.action(server_id, 'suspend', **kwargs)
 
     def resume_server(self, server_id, **kwargs):
-        """Un-suspends the provided server."""
+        """Un-suspend the provided server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#resume
+        """
         return self.action(server_id, 'resume', **kwargs)
 
     def pause_server(self, server_id, **kwargs):
-        """Pauses the provided server."""
+        """Pause the provided server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#pause
+        """
         return self.action(server_id, 'pause', **kwargs)
 
     def unpause_server(self, server_id, **kwargs):
-        """Un-pauses the provided server."""
+        """Un-pause the provided server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#unpause
+        """
         return self.action(server_id, 'unpause', **kwargs)
 
-    def reset_state(self, server_id, state='error'):
-        """Resets the state of a server to active/error."""
-        return self.action(server_id, 'os-resetState', state=state)
+    def reset_state(self, server_id, **kwargs):
+        """Reset the state of a server to active/error.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#resetState
+        """
+        return self.action(server_id, 'os-resetState', **kwargs)
 
     def shelve_server(self, server_id, **kwargs):
-        """Shelves the provided server."""
+        """Shelve the provided server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#shelve
+        """
         return self.action(server_id, 'shelve', **kwargs)
 
     def unshelve_server(self, server_id, **kwargs):
-        """Un-shelves the provided server."""
+        """Un-shelve the provided server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#unshelve
+        """
         return self.action(server_id, 'unshelve', **kwargs)
 
     def shelve_offload_server(self, server_id, **kwargs):
-        """Shelve-offload the provided server."""
+        """Shelve-offload the provided server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#shelveOffload
+        """
         return self.action(server_id, 'shelveOffload', **kwargs)
 
     def get_console_output(self, server_id, **kwargs):
@@ -410,10 +471,12 @@
         return service_client.ResponseBody(resp, body)
 
     def rescue_server(self, server_id, **kwargs):
-        """Rescue the provided server."""
-        return self.action(server_id, 'rescue',
-                           schema.rescue_server,
-                           **kwargs)
+        """Rescue the provided server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#rescue
+        """
+        return self.action(server_id, 'rescue', schema.rescue_server, **kwargs)
 
     def unrescue_server(self, server_id):
         """Unrescue the provided server."""
@@ -449,11 +512,19 @@
         return self.action(server_id, 'forceDelete', **kwargs)
 
     def restore_soft_deleted_server(self, server_id, **kwargs):
-        """Restore a soft-deleted server."""
+        """Restore a soft-deleted server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#restore
+        """
         return self.action(server_id, 'restore', **kwargs)
 
     def reset_network(self, server_id, **kwargs):
-        """Resets the Network of a server"""
+        """Reset the Network of a server.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#resetNetwork
+        """
         return self.action(server_id, 'resetNetwork', **kwargs)
 
     def inject_network_info(self, server_id, **kwargs):
@@ -482,5 +553,9 @@
         return self.action(server_id, 'addFixedIp', **kwargs)
 
     def remove_fixed_ip(self, server_id, **kwargs):
-        """Remove input fixed IP from input server instance."""
+        """Remove input fixed IP from input server instance.
+
+        Available params: http://developer.openstack.org/
+                          api-ref-compute-v2.1.html#removeFixedIp
+        """
         return self.action(server_id, 'removeFixedIp', **kwargs)
diff --git a/tempest/tests/services/compute/test_servers_client.py b/tempest/tests/services/compute/test_servers_client.py
index d88f524..1fd0740 100644
--- a/tempest/tests/services/compute/test_servers_client.py
+++ b/tempest/tests/services/compute/test_servers_client.py
@@ -363,7 +363,7 @@
             {},
             status=202,
             server_id=self.server_id,
-            reboot_type='fake-reboot-type'
+            type='fake-reboot-type'
             )
 
     def test_rebuild_server_with_str_body(self):