Merge "Removes duplicate code autoscale_complete"
diff --git a/common/test.py b/common/test.py
index 976ae8b..16d5920 100644
--- a/common/test.py
+++ b/common/test.py
@@ -377,7 +377,6 @@
         env = environment or {}
         env_files = files or {}
         parameters = parameters or {}
-        stack_name = stack_identifier.split('/')[0]
 
         self.updated_time[stack_identifier] = self.client.stacks.get(
             stack_identifier, resolve_outputs=False).updated_time
@@ -385,7 +384,6 @@
         self._handle_in_progress(
             self.client.stacks.update,
             stack_id=stack_identifier,
-            stack_name=stack_name,
             template=template,
             files=env_files,
             disable_rollback=disable_rollback,
@@ -410,11 +408,9 @@
         env = environment or {}
         env_files = files or {}
         parameters = parameters or {}
-        stack_name = stack_identifier.split('/')[0]
 
         return self.client.stacks.preview_update(
             stack_id=stack_identifier,
-            stack_name=stack_name,
             template=template,
             files=env_files,
             disable_rollback=disable_rollback,
@@ -558,8 +554,7 @@
                 'SUSPEND' in self.conf.skip_test_stack_action_list):
             self.addCleanup(self._stack_delete, stack_identifier)
             self.skipTest('Testing Stack suspend disabled in conf, skipping')
-        stack_name = stack_identifier.split('/')[0]
-        self._handle_in_progress(self.client.actions.suspend, stack_name)
+        self._handle_in_progress(self.client.actions.suspend, stack_identifier)
         # improve debugging by first checking the resource's state.
         self._wait_for_all_resource_status(stack_identifier,
                                            'SUSPEND_COMPLETE')
@@ -570,8 +565,7 @@
                 'RESUME' in self.conf.skip_test_stack_action_list):
             self.addCleanup(self._stack_delete, stack_identifier)
             self.skipTest('Testing Stack resume disabled in conf, skipping')
-        stack_name = stack_identifier.split('/')[0]
-        self._handle_in_progress(self.client.actions.resume, stack_name)
+        self._handle_in_progress(self.client.actions.resume, stack_identifier)
         # improve debugging by first checking the resource's state.
         self._wait_for_all_resource_status(stack_identifier,
                                            'RESUME_COMPLETE')
diff --git a/functional/test_nova_server_networks.py b/functional/test_nova_server_networks.py
index ae550b2..f258f83 100644
--- a/functional/test_nova_server_networks.py
+++ b/functional/test_nova_server_networks.py
@@ -31,6 +31,16 @@
     properties:
       network: {get_resource: net}
       cidr: 11.11.11.0/24
+  security_group:
+    type: OS::Neutron::SecurityGroup
+    properties:
+      name: the_sg
+      description: Ping and SSH
+      rules:
+      - protocol: icmp
+      - protocol: tcp
+        port_range_min: 22
+        port_range_max: 22
   server:
     type: OS::Nova::Server
     properties:
@@ -39,6 +49,8 @@
       networks:
         - subnet: {get_resource: subnet}
           fixed_ip: 11.11.11.11
+      security_groups:
+        - {get_resource: security_group}
 outputs:
   networks:
     value: {get_attr: [server, networks]}
@@ -55,7 +67,7 @@
         output = self._stack_output(stack, output_key)
         return output
 
-    def test_create_server_with_subnet_fixed_ip(self):
+    def test_create_server_with_subnet_fixed_ip_sec_group(self):
         parms = {'flavor': self.conf.minimal_instance_type,
                  'image': self.conf.minimal_image_ref}
         stack_identifier = self.stack_create(
@@ -65,6 +77,12 @@
         networks = self.get_outputs(stack_identifier, 'networks')
         self.assertEqual(['11.11.11.11'], networks['my_net'])
 
+        server_resource = self.client.resources.get(
+            stack_identifier, 'server')
+        server_id = server_resource.physical_resource_id
+        server = self.compute_client.servers.get(server_id)
+        self.assertEqual([{"name": "the_sg"}], server.security_groups)
+
     def test_create_update_server_with_subnet(self):
         parms = {'flavor': self.conf.minimal_instance_type,
                  'image': self.conf.minimal_image_ref}