Merge "Update style guide link in HACKING.rst"
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 2a72c95..7c72991 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -31,6 +31,7 @@
         super(BaseOrchestrationTest, cls).setUpClass()
         os = clients.OrchestrationManager()
         cls.orchestration_cfg = os.config.orchestration
+        cls.compute_cfg = os.config.compute
         if not os.config.service_available.heat:
             raise cls.skipException("Heat support is required")
         cls.build_timeout = cls.orchestration_cfg.build_timeout
@@ -40,10 +41,18 @@
         cls.orchestration_client = os.orchestration_client
         cls.servers_client = os.servers_client
         cls.keypairs_client = os.keypairs_client
+        cls.network_client = os.network_client
         cls.stacks = []
         cls.keypairs = []
 
     @classmethod
+    def _get_default_network(cls):
+        resp, networks = cls.network_client.list_networks()
+        for net in networks['networks']:
+            if net['name'] == cls.compute_cfg.fixed_network_name:
+                return net
+
+    @classmethod
     def _get_identity_admin_client(cls):
         """
         Returns an instance of the Identity Admin API client
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index defb910..0ecc5ff 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -36,6 +36,8 @@
     Type: String
   ImageId:
     Type: String
+  Subnet:
+    Type: String
 Resources:
   SmokeServer:
     Type: AWS::EC2::Instance
@@ -45,6 +47,7 @@
       ImageId: {Ref: ImageId}
       InstanceType: {Ref: InstanceType}
       KeyName: {Ref: KeyName}
+      SubnetId: {Ref: Subnet}
       UserData:
         Fn::Base64:
           Fn::Join:
@@ -78,13 +81,15 @@
                         cls._create_keypair()['name'])
 
         # create the stack
+        subnet = cls._get_default_network()['subnets'][0]
         cls.stack_identifier = cls.create_stack(
             cls.stack_name,
             cls.template,
             parameters={
                 'KeyName': keypair_name,
                 'InstanceType': cls.orchestration_cfg.instance_type,
-                'ImageId': cls.orchestration_cfg.image_ref
+                'ImageId': cls.orchestration_cfg.image_ref,
+                'Subnet': subnet
             })
         cls.stack_id = cls.stack_identifier.split('/')[1]
         cls.resource_name = 'SmokeServer'
diff --git a/tempest/api/orchestration/stacks/test_server_cfn_init.py b/tempest/api/orchestration/stacks/test_server_cfn_init.py
index 41849d0..d8334fa 100644
--- a/tempest/api/orchestration/stacks/test_server_cfn_init.py
+++ b/tempest/api/orchestration/stacks/test_server_cfn_init.py
@@ -43,6 +43,8 @@
     Type: String
   image:
     Type: String
+  network:
+    Type: String
 Resources:
   CfnUser:
     Type: AWS::IAM::User
@@ -88,6 +90,8 @@
       key_name: {Ref: key_name}
       security_groups:
       - {Ref: SmokeSecurityGroup}
+      networks:
+      - uuid: {Ref: network}
       user_data:
         Fn::Base64:
           Fn::Join:
@@ -142,7 +146,8 @@
             parameters={
                 'key_name': keypair_name,
                 'flavor': cls.orchestration_cfg.instance_type,
-                'image': cls.orchestration_cfg.image_ref
+                'image': cls.orchestration_cfg.image_ref,
+                'network': cls._get_default_network()['id']
             })
 
     @attr(type='slow')
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index c01de83..c4b98d5 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -656,3 +656,10 @@
     @classmethod
     def _stack_rand_name(cls):
         return rand_name(cls.__name__ + '-')
+
+    @classmethod
+    def _get_default_network(cls):
+        networks = cls.network_client.list_networks()
+        for net in networks['networks']:
+            if net['name'] == cls.config.compute.fixed_network_name:
+                return net
diff --git a/tempest/scenario/orchestration/test_autoscaling.py b/tempest/scenario/orchestration/test_autoscaling.py
index 1a4d802..658e9bb 100644
--- a/tempest/scenario/orchestration/test_autoscaling.py
+++ b/tempest/scenario/orchestration/test_autoscaling.py
@@ -37,11 +37,13 @@
             self.keypair_name = self.keypair.id
 
     def launch_stack(self):
+        net = self._get_default_network()
         self.parameters = {
             'KeyName': self.keypair_name,
             'InstanceType': self.config.orchestration.instance_type,
             'ImageId': self.config.orchestration.image_ref,
-            'StackStart': str(time.time())
+            'StackStart': str(time.time()),
+            'Subnet': net['subnets'][0]
         }
 
         # create the stack
diff --git a/tempest/scenario/orchestration/test_autoscaling.yaml b/tempest/scenario/orchestration/test_autoscaling.yaml
index 045b3bc..745eb05 100644
--- a/tempest/scenario/orchestration/test_autoscaling.yaml
+++ b/tempest/scenario/orchestration/test_autoscaling.yaml
@@ -8,6 +8,8 @@
     Type: String
   ImageId:
     Type: String
+  Subnet:
+    Type: String
   StackStart:
     Description: Epoch seconds when the stack was launched
     Type: Number
@@ -39,6 +41,7 @@
       LaunchConfigurationName: {Ref: LaunchConfig}
       MinSize: '1'
       MaxSize: '3'
+      VPCZoneIdentifier: [{Ref: Subnet}]
   SmokeServerScaleUpPolicy:
     Type: AWS::AutoScaling::ScalingPolicy
     Properties:
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index d8c9b8e..4f49d65 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -18,6 +18,7 @@
 import time
 
 from cinderclient import exceptions as cinder_exceptions
+import testtools
 
 from tempest.common.utils.data_utils import rand_name
 from tempest import exceptions
@@ -141,6 +142,7 @@
         got_timestamp = ssh_client.exec_command('sudo cat /mnt/timestamp')
         self.assertEqual(self.timestamp, got_timestamp)
 
+    @testtools.skip("Skipped until the Bug #1205344 is resolved.")
     @tempest.test.services('compute', 'network', 'volume', 'image')
     def test_stamp_pattern(self):
         # prepare for booting a instance