Merge "factor out templates to yaml files"
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 9bf9568..ab0fb7c 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -10,6 +10,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import os.path
+
 from tempest import clients
 from tempest.common.utils import data_utils
 from tempest import config
@@ -28,18 +30,17 @@
     @classmethod
     def setUpClass(cls):
         super(BaseOrchestrationTest, cls).setUpClass()
-        os = clients.OrchestrationManager()
+        cls.os = clients.OrchestrationManager()
         if not CONF.service_available.heat:
             raise cls.skipException("Heat support is required")
         cls.build_timeout = CONF.orchestration.build_timeout
         cls.build_interval = CONF.orchestration.build_interval
 
-        cls.os = os
-        cls.orchestration_client = os.orchestration_client
-        cls.client = os.orchestration_client
-        cls.servers_client = os.servers_client
-        cls.keypairs_client = os.keypairs_client
-        cls.network_client = os.network_client
+        cls.orchestration_client = cls.os.orchestration_client
+        cls.client = cls.orchestration_client
+        cls.servers_client = cls.os.servers_client
+        cls.keypairs_client = cls.os.keypairs_client
+        cls.network_client = cls.os.network_client
         cls.stacks = []
         cls.keypairs = []
 
@@ -55,8 +56,8 @@
         """
         Returns an instance of the Identity Admin API client
         """
-        os = clients.AdminManager(interface=cls._interface)
-        admin_client = os.identity_client
+        manager = clients.AdminManager(interface=cls._interface)
+        admin_client = manager.identity_client
         return admin_client
 
     @classmethod
@@ -101,6 +102,16 @@
                 pass
 
     @classmethod
+    def load_template(cls, name, ext='yaml'):
+        loc = ["tempest", "api", "orchestration",
+               "stacks", "templates", "%s.%s" % (name, ext)]
+        fullpath = os.path.join(*loc)
+
+        with open(fullpath, "r") as f:
+            content = f.read()
+            return content
+
+    @classmethod
     def tearDownClass(cls):
         cls.clear_stacks()
         cls.clear_keypairs()
diff --git a/tempest/api/orchestration/stacks/templates/cfn_init_signal.yaml b/tempest/api/orchestration/stacks/templates/cfn_init_signal.yaml
new file mode 100644
index 0000000..23ad06f
--- /dev/null
+++ b/tempest/api/orchestration/stacks/templates/cfn_init_signal.yaml
@@ -0,0 +1,80 @@
+HeatTemplateFormatVersion: '2012-12-12'
+Description: |
+  Template which uses a wait condition to confirm that a minimal
+  cfn-init and cfn-signal has worked
+Parameters:
+  key_name:
+    Type: String
+  flavor:
+    Type: String
+  image:
+    Type: String
+  network:
+    Type: String
+Resources:
+  CfnUser:
+    Type: AWS::IAM::User
+  SmokeSecurityGroup:
+    Type: AWS::EC2::SecurityGroup
+    Properties:
+      GroupDescription: Enable only ping and SSH access
+      SecurityGroupIngress:
+      - {CidrIp: 0.0.0.0/0, FromPort: '-1', IpProtocol: icmp, ToPort: '-1'}
+      - {CidrIp: 0.0.0.0/0, FromPort: '22', IpProtocol: tcp, ToPort: '22'}
+  SmokeKeys:
+    Type: AWS::IAM::AccessKey
+    Properties:
+      UserName: {Ref: CfnUser}
+  SmokeServer:
+    Type: OS::Nova::Server
+    Metadata:
+      AWS::CloudFormation::Init:
+        config:
+          files:
+            /tmp/smoke-status:
+              content: smoke test complete
+            /etc/cfn/cfn-credentials:
+              content:
+                Fn::Replace:
+                - SmokeKeys: {Ref: SmokeKeys}
+                  SecretAccessKey:
+                    'Fn::GetAtt': [SmokeKeys, SecretAccessKey]
+                - |
+                  AWSAccessKeyId=SmokeKeys
+                  AWSSecretKey=SecretAccessKey
+              mode: '000400'
+              owner: root
+              group: root
+    Properties:
+      image: {Ref: image}
+      flavor: {Ref: flavor}
+      key_name: {Ref: key_name}
+      security_groups:
+      - {Ref: SmokeSecurityGroup}
+      networks:
+      - uuid: {Ref: network}
+      user_data:
+        Fn::Replace:
+        - WaitHandle: {Ref: WaitHandle}
+        - |
+          #!/bin/bash -v
+          /opt/aws/bin/cfn-init
+          /opt/aws/bin/cfn-signal -e 0 --data "`cat /tmp/smoke-status`" \
+              "WaitHandle"
+  WaitHandle:
+    Type: AWS::CloudFormation::WaitConditionHandle
+  WaitCondition:
+    Type: AWS::CloudFormation::WaitCondition
+    DependsOn: SmokeServer
+    Properties:
+      Handle: {Ref: WaitHandle}
+      Timeout: '600'
+Outputs:
+  WaitConditionStatus:
+    Description: Contents of /tmp/smoke-status on SmokeServer
+    Value:
+      Fn::GetAtt: [WaitCondition, Data]
+  SmokeServerIp:
+    Description: IP address of server
+    Value:
+      Fn::GetAtt: [SmokeServer, first_address]
diff --git a/tempest/api/orchestration/stacks/templates/neutron_basic.yaml b/tempest/api/orchestration/stacks/templates/neutron_basic.yaml
new file mode 100644
index 0000000..9d90e31
--- /dev/null
+++ b/tempest/api/orchestration/stacks/templates/neutron_basic.yaml
@@ -0,0 +1,68 @@
+heat_template_version: '2013-05-23'
+description: |
+  Template which creates single EC2 instance
+parameters:
+  KeyName:
+    type: string
+  InstanceType:
+    type: string
+  ImageId:
+    type: string
+  ExternalRouterId:
+    type: string
+  ExternalNetworkId:
+    type: string
+resources:
+  Network:
+    type: OS::Neutron::Net
+    properties:
+      name: NewNetwork
+  Subnet:
+    type: OS::Neutron::Subnet
+    properties:
+      network_id: {Ref: Network}
+      name: NewSubnet
+      ip_version: 4
+      cidr: 10.0.3.0/24
+      dns_nameservers: ["8.8.8.8"]
+      allocation_pools:
+      - {end: 10.0.3.150, start: 10.0.3.20}
+  Router:
+    type: OS::Neutron::Router
+    properties:
+      name: NewRouter
+      admin_state_up: false
+      external_gateway_info:
+        network: {get_param: ExternalNetworkId}
+        enable_snat: false
+  RouterInterface:
+    type: OS::Neutron::RouterInterface
+    properties:
+      router_id: {get_param: ExternalRouterId}
+      subnet_id: {get_resource: Subnet}
+  Server:
+    type: AWS::EC2::Instance
+    metadata:
+      Name: SmokeServerNeutron
+    properties:
+      ImageId: {get_param: ImageId}
+      InstanceType: {get_param: InstanceType}
+      KeyName: {get_param: KeyName}
+      SubnetId: {get_resource: Subnet}
+      UserData:
+        str_replace:
+          template: |
+            #!/bin/bash -v
+
+            /opt/aws/bin/cfn-signal -e 0 -r "SmokeServerNeutron created" \
+            'wait_handle'
+          params:
+            wait_handle: {get_resource: WaitHandleNeutron}
+  WaitHandleNeutron:
+    type: AWS::CloudFormation::WaitConditionHandle
+  WaitCondition:
+    type: AWS::CloudFormation::WaitCondition
+    depends_on: Server
+    properties:
+      Handle: {get_resource: WaitHandleNeutron}
+      Timeout: '600'
diff --git a/tempest/api/orchestration/stacks/templates/non_empty_stack.yaml b/tempest/api/orchestration/stacks/templates/non_empty_stack.yaml
new file mode 100644
index 0000000..58a934e
--- /dev/null
+++ b/tempest/api/orchestration/stacks/templates/non_empty_stack.yaml
@@ -0,0 +1,32 @@
+HeatTemplateFormatVersion: '2012-12-12'
+Description: |
+  Template which creates some simple resources
+Parameters:
+  trigger:
+    Type: String
+    Default: not_yet
+Resources:
+  fluffy:
+    Type: AWS::AutoScaling::LaunchConfiguration
+    Metadata:
+      kittens:
+      - Tom
+      - Stinky
+    Properties:
+      ImageId: not_used
+      InstanceType: not_used
+      UserData:
+        Fn::Replace:
+        - variable_a: {Ref: trigger}
+          variable_b: bee
+        - |
+          A == variable_a
+          B == variable_b
+Outputs:
+  fluffy:
+    Description: "fluffies irc nick"
+    Value:
+      Fn::Replace:
+      - nick: {Ref: fluffy}
+      - |
+        #nick
diff --git a/tempest/api/orchestration/stacks/templates/nova_keypair.json b/tempest/api/orchestration/stacks/templates/nova_keypair.json
new file mode 100644
index 0000000..63d3817
--- /dev/null
+++ b/tempest/api/orchestration/stacks/templates/nova_keypair.json
@@ -0,0 +1,48 @@
+{
+  "AWSTemplateFormatVersion" : "2010-09-09",
+  "Description" : "Template which create two key pairs.",
+  "Parameters" : {
+    "KeyPairName1": {
+      "Type": "String",
+      "Default": "testkey1"
+      },
+    "KeyPairName2": {
+      "Type": "String",
+      "Default": "testkey2"
+      }
+   },
+   "Resources" : {
+     "KeyPairSavePrivate": {
+       "Type": "OS::Nova::KeyPair",
+       "Properties": {
+         "name" : { "Ref" : "KeyPairName1" },
+         "save_private_key": true
+       }
+     },
+     "KeyPairDontSavePrivate": {
+       "Type": "OS::Nova::KeyPair",
+       "Properties": {
+         "name" : { "Ref" : "KeyPairName2" },
+         "save_private_key": false
+      }
+     }
+  },
+ "Outputs": {
+   "KeyPair_PublicKey": {
+     "Description": "Public Key of generated keypair.",
+     "Value": { "Fn::GetAtt" : ["KeyPairSavePrivate", "public_key"] }
+    },
+   "KeyPair_PrivateKey": {
+     "Description": "Private Key of generated keypair.",
+     "Value": { "Fn::GetAtt" : ["KeyPairSavePrivate", "private_key"] }
+   },
+   "KeyPairDontSavePrivate_PublicKey": {
+     "Description": "Public Key of generated keypair.",
+     "Value": { "Fn::GetAtt" : ["KeyPairDontSavePrivate", "public_key"] }
+   },
+  "KeyPairDontSavePrivate_PrivateKey": {
+     "Description": "Private Key of generated keypair.",
+     "Value": { "Fn::GetAtt" : ["KeyPairDontSavePrivate", "private_key"] }
+   }
+  }
+}
diff --git a/tempest/api/orchestration/stacks/templates/nova_keypair.yaml b/tempest/api/orchestration/stacks/templates/nova_keypair.yaml
new file mode 100644
index 0000000..81ad99c
--- /dev/null
+++ b/tempest/api/orchestration/stacks/templates/nova_keypair.yaml
@@ -0,0 +1,43 @@
+heat_template_version: 2013-05-23
+
+description: >
+  Template which creates two key pairs.
+
+parameters:
+  KeyPairName1:
+    type: string
+    default: testkey
+
+  KeyPairName2:
+    type: string
+    default: testkey2
+
+resources:
+  KeyPairSavePrivate:
+    type: OS::Nova::KeyPair
+    properties:
+      name: { get_param: KeyPairName1 }
+      save_private_key: true
+
+  KeyPairDontSavePrivate:
+    type: OS::Nova::KeyPair
+    properties:
+      name: { get_param: KeyPairName2 }
+      save_private_key: false
+
+outputs:
+  KeyPair_PublicKey:
+    description: Public Key of generated keypair
+    value: { get_attr: [KeyPairSavePrivate, public_key] }
+
+  KeyPair_PrivateKey:
+    description: Private Key of generated keypair
+    value: { get_attr: [KeyPairSavePrivate, private_key] }
+
+  KeyPairDontSavePrivate_PublicKey:
+    description: Public Key of generated keypair
+    value: { get_attr: [KeyPairDontSavePrivate, public_key] }
+
+  KeyPairDontSavePrivate_PrivateKey:
+    description: Private Key of generated keypair
+    value: { get_attr: [KeyPairDontSavePrivate, private_key] }
diff --git a/tempest/api/orchestration/stacks/templates/swift_basic.yaml b/tempest/api/orchestration/stacks/templates/swift_basic.yaml
new file mode 100644
index 0000000..713f8bc
--- /dev/null
+++ b/tempest/api/orchestration/stacks/templates/swift_basic.yaml
@@ -0,0 +1,23 @@
+heat_template_version: 2013-05-23
+description: Template which creates a Swift container resource
+
+resources:
+  SwiftContainerWebsite:
+    deletion_policy: "Delete"
+    type: OS::Swift::Container
+    properties:
+      X-Container-Read: ".r:*"
+      X-Container-Meta:
+        web-index: "index.html"
+        web-error: "error.html"
+
+  SwiftContainer:
+    type: OS::Swift::Container
+
+outputs:
+  WebsiteURL:
+    description: "URL for website hosted on S3"
+    value: { get_attr: [SwiftContainer, WebsiteURL] }
+  DomainName:
+    description: "Domain of Swift host"
+    value: { get_attr: [SwiftContainer, DomainName] }
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index dee26b1..61dbb4d 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -26,78 +26,6 @@
 
 
 class NeutronResourcesTestJSON(base.BaseOrchestrationTest):
-    _interface = 'json'
-
-    template = """
-heat_template_version: '2013-05-23'
-description: |
-  Template which creates single EC2 instance
-parameters:
-  KeyName:
-    type: string
-  InstanceType:
-    type: string
-  ImageId:
-    type: string
-  ExternalRouterId:
-    type: string
-  ExternalNetworkId:
-    type: string
-resources:
-  Network:
-    type: OS::Neutron::Net
-    properties:
-      name: NewNetwork
-  Subnet:
-    type: OS::Neutron::Subnet
-    properties:
-      network_id: {Ref: Network}
-      name: NewSubnet
-      ip_version: 4
-      cidr: 10.0.3.0/24
-      dns_nameservers: ["8.8.8.8"]
-      allocation_pools:
-      - {end: 10.0.3.150, start: 10.0.3.20}
-  Router:
-    type: OS::Neutron::Router
-    properties:
-      name: NewRouter
-      admin_state_up: false
-      external_gateway_info:
-        network: {get_param: ExternalNetworkId}
-        enable_snat: false
-  RouterInterface:
-    type: OS::Neutron::RouterInterface
-    properties:
-      router_id: {get_param: ExternalRouterId}
-      subnet_id: {get_resource: Subnet}
-  Server:
-    type: AWS::EC2::Instance
-    metadata:
-      Name: SmokeServerNeutron
-    properties:
-      ImageId: {get_param: ImageId}
-      InstanceType: {get_param: InstanceType}
-      KeyName: {get_param: KeyName}
-      SubnetId: {get_resource: Subnet}
-      UserData:
-        str_replace:
-          template: |
-            #!/bin/bash -v
-
-            /opt/aws/bin/cfn-signal -e 0 -r "SmokeServerNeutron created" \
-            'wait_handle'
-          params:
-            wait_handle: {get_resource: WaitHandleNeutron}
-  WaitHandleNeutron:
-    type: AWS::CloudFormation::WaitConditionHandle
-  WaitCondition:
-    type: AWS::CloudFormation::WaitCondition
-    depends_on: Server
-    properties:
-      Handle: {get_resource: WaitHandleNeutron}
-      Timeout: '600'
-"""
 
     @classmethod
     @test.safe_setup
@@ -111,6 +39,7 @@
             raise cls.skipException("Neutron support is required")
         cls.network_client = os.network_client
         cls.stack_name = data_utils.rand_name('heat')
+        template = cls.load_template('neutron_basic')
         cls.keypair_name = (CONF.orchestration.keypair_name or
                             cls._create_keypair()['name'])
         cls.external_router_id = cls._get_external_router_id()
@@ -119,7 +48,7 @@
         # create the stack
         cls.stack_identifier = cls.create_stack(
             cls.stack_name,
-            cls.template,
+            template,
             parameters={
                 'KeyName': cls.keypair_name,
                 'InstanceType': CONF.orchestration.instance_type,
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index 11d01f7..70bf562 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -21,53 +21,18 @@
 
 
 class StacksTestJSON(base.BaseOrchestrationTest):
-    _interface = 'json'
-
-    template = """
-HeatTemplateFormatVersion: '2012-12-12'
-Description: |
-  Template which creates some simple resources
-Parameters:
-  trigger:
-    Type: String
-    Default: not_yet
-Resources:
-  fluffy:
-    Type: AWS::AutoScaling::LaunchConfiguration
-    Metadata:
-      kittens:
-      - Tom
-      - Stinky
-    Properties:
-      ImageId: not_used
-      InstanceType: not_used
-      UserData:
-        Fn::Replace:
-        - variable_a: {Ref: trigger}
-          variable_b: bee
-        - |
-          A == variable_a
-          B == variable_b
-Outputs:
-  fluffy:
-    Description: "fluffies irc nick"
-    Value:
-      Fn::Replace:
-      - nick: {Ref: fluffy}
-      - |
-        #nick
-"""
 
     @classmethod
     def setUpClass(cls):
         super(StacksTestJSON, cls).setUpClass()
         cls.client = cls.orchestration_client
         cls.stack_name = data_utils.rand_name('heat')
+        template = cls.load_template('non_empty_stack')
 
         # create the stack
         cls.stack_identifier = cls.create_stack(
             cls.stack_name,
-            cls.template,
+            template,
             parameters={
                 'trigger': 'start'
             })
diff --git a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
index 9d3bf13..1edae72 100644
--- a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
+++ b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
@@ -22,63 +22,19 @@
 
 
 class NovaKeyPairResourcesYAMLTest(base.BaseOrchestrationTest):
-    _interface = 'json'
-    template = """
-heat_template_version: 2013-05-23
-
-description: >
-  Template which creates two key pairs.
-
-parameters:
-  KeyPairName1:
-    type: string
-    default: testkey
-
-  KeyPairName2:
-    type: string
-    default: testkey2
-
-resources:
-  KeyPairSavePrivate:
-    type: OS::Nova::KeyPair
-    properties:
-      name: { get_param: KeyPairName1 }
-      save_private_key: true
-
-  KeyPairDontSavePrivate:
-    type: OS::Nova::KeyPair
-    properties:
-      name: { get_param: KeyPairName2 }
-      save_private_key: false
-
-outputs:
-  KeyPair_PublicKey:
-    description: Public Key of generated keypair
-    value: { get_attr: [KeyPairSavePrivate, public_key] }
-
-  KeyPair_PrivateKey:
-    description: Private Key of generated keypair
-    value: { get_attr: [KeyPairSavePrivate, private_key] }
-
-  KeyPairDontSavePrivate_PublicKey:
-    description: Public Key of generated keypair
-    value: { get_attr: [KeyPairDontSavePrivate, public_key] }
-
-  KeyPairDontSavePrivate_PrivateKey:
-    description: Private Key of generated keypair
-    value: { get_attr: [KeyPairDontSavePrivate, private_key] }
-"""
+    _tpl_type = 'yaml'
 
     @classmethod
     def setUpClass(cls):
         super(NovaKeyPairResourcesYAMLTest, cls).setUpClass()
         cls.client = cls.orchestration_client
         cls.stack_name = data_utils.rand_name('heat')
+        template = cls.load_template('nova_keypair', ext=cls._tpl_type)
 
         # create the stack, avoid any duplicated key.
         cls.stack_identifier = cls.create_stack(
             cls.stack_name,
-            cls.template,
+            template,
             parameters={
                 'KeyPairName1': cls.stack_name + '_1',
                 'KeyPairName2': cls.stack_name + '_2'
@@ -129,53 +85,4 @@
 
 
 class NovaKeyPairResourcesAWSTest(NovaKeyPairResourcesYAMLTest):
-    template = """
-{
-  "AWSTemplateFormatVersion" : "2010-09-09",
-  "Description" : "Template which create two key pairs.",
-  "Parameters" : {
-    "KeyPairName1": {
-      "Type": "String",
-      "Default": "testkey1"
-      },
-    "KeyPairName2": {
-      "Type": "String",
-      "Default": "testkey2"
-      }
-   },
-   "Resources" : {
-     "KeyPairSavePrivate": {
-       "Type": "OS::Nova::KeyPair",
-       "Properties": {
-         "name" : { "Ref" : "KeyPairName1" },
-         "save_private_key": true
-       }
-     },
-     "KeyPairDontSavePrivate": {
-       "Type": "OS::Nova::KeyPair",
-       "Properties": {
-         "name" : { "Ref" : "KeyPairName2" },
-         "save_private_key": false
-      }
-     }
-  },
- "Outputs": {
-   "KeyPair_PublicKey": {
-     "Description": "Public Key of generated keypair.",
-     "Value": { "Fn::GetAtt" : ["KeyPairSavePrivate", "public_key"] }
-    },
-   "KeyPair_PrivateKey": {
-     "Description": "Private Key of generated keypair.",
-     "Value": { "Fn::GetAtt" : ["KeyPairSavePrivate", "private_key"] }
-   },
-   "KeyPairDontSavePrivate_PublicKey": {
-     "Description": "Public Key of generated keypair.",
-     "Value": { "Fn::GetAtt" : ["KeyPairDontSavePrivate", "public_key"] }
-   },
-  "KeyPairDontSavePrivate_PrivateKey": {
-     "Description": "Private Key of generated keypair.",
-     "Value": { "Fn::GetAtt" : ["KeyPairDontSavePrivate", "private_key"] }
-   }
-  }
-}
-"""
+    _tpl_type = 'json'
diff --git a/tempest/api/orchestration/stacks/test_server_cfn_init.py b/tempest/api/orchestration/stacks/test_server_cfn_init.py
index a6f74b6..b590f88 100644
--- a/tempest/api/orchestration/stacks/test_server_cfn_init.py
+++ b/tempest/api/orchestration/stacks/test_server_cfn_init.py
@@ -26,92 +26,8 @@
 
 
 class ServerCfnInitTestJSON(base.BaseOrchestrationTest):
-    _interface = 'json'
     existing_keypair = CONF.orchestration.keypair_name is not None
 
-    template = """
-HeatTemplateFormatVersion: '2012-12-12'
-Description: |
-  Template which uses a wait condition to confirm that a minimal
-  cfn-init and cfn-signal has worked
-Parameters:
-  key_name:
-    Type: String
-  flavor:
-    Type: String
-  image:
-    Type: String
-  network:
-    Type: String
-Resources:
-  CfnUser:
-    Type: AWS::IAM::User
-  SmokeSecurityGroup:
-    Type: AWS::EC2::SecurityGroup
-    Properties:
-      GroupDescription: Enable only ping and SSH access
-      SecurityGroupIngress:
-      - {CidrIp: 0.0.0.0/0, FromPort: '-1', IpProtocol: icmp, ToPort: '-1'}
-      - {CidrIp: 0.0.0.0/0, FromPort: '22', IpProtocol: tcp, ToPort: '22'}
-  SmokeKeys:
-    Type: AWS::IAM::AccessKey
-    Properties:
-      UserName: {Ref: CfnUser}
-  SmokeServer:
-    Type: OS::Nova::Server
-    Metadata:
-      AWS::CloudFormation::Init:
-        config:
-          files:
-            /tmp/smoke-status:
-              content: smoke test complete
-            /etc/cfn/cfn-credentials:
-              content:
-                Fn::Replace:
-                - SmokeKeys: {Ref: SmokeKeys}
-                  SecretAccessKey:
-                    'Fn::GetAtt': [SmokeKeys, SecretAccessKey]
-                - |
-                  AWSAccessKeyId=SmokeKeys
-                  AWSSecretKey=SecretAccessKey
-              mode: '000400'
-              owner: root
-              group: root
-    Properties:
-      image: {Ref: image}
-      flavor: {Ref: flavor}
-      key_name: {Ref: key_name}
-      security_groups:
-      - {Ref: SmokeSecurityGroup}
-      networks:
-      - uuid: {Ref: network}
-      user_data:
-        Fn::Replace:
-        - WaitHandle: {Ref: WaitHandle}
-        - |
-          #!/bin/bash -v
-          /opt/aws/bin/cfn-init
-          /opt/aws/bin/cfn-signal -e 0 --data "`cat /tmp/smoke-status`" \
-              "WaitHandle"
-  WaitHandle:
-    Type: AWS::CloudFormation::WaitConditionHandle
-  WaitCondition:
-    Type: AWS::CloudFormation::WaitCondition
-    DependsOn: SmokeServer
-    Properties:
-      Handle: {Ref: WaitHandle}
-      Timeout: '600'
-Outputs:
-  WaitConditionStatus:
-    Description: Contents of /tmp/smoke-status on SmokeServer
-    Value:
-      Fn::GetAtt: [WaitCondition, Data]
-  SmokeServerIp:
-    Description: IP address of server
-    Value:
-      Fn::GetAtt: [SmokeServer, first_address]
-"""
-
     @classmethod
     @test.safe_setup
     def setUpClass(cls):
@@ -119,7 +35,7 @@
         if not CONF.orchestration.image_ref:
             raise cls.skipException("No image available to test")
         cls.client = cls.orchestration_client
-
+        template = cls.load_template('cfn_init_signal')
         stack_name = data_utils.rand_name('heat')
         if CONF.orchestration.keypair_name:
             keypair_name = CONF.orchestration.keypair_name
@@ -130,7 +46,7 @@
         # create the stack
         cls.stack_identifier = cls.create_stack(
             stack_name,
-            cls.template,
+            template,
             parameters={
                 'key_name': keypair_name,
                 'flavor': CONF.orchestration.instance_type,
diff --git a/tempest/api/orchestration/stacks/test_stacks.py b/tempest/api/orchestration/stacks/test_stacks.py
index fc2dda8..3ffa0bc 100644
--- a/tempest/api/orchestration/stacks/test_stacks.py
+++ b/tempest/api/orchestration/stacks/test_stacks.py
@@ -20,8 +20,6 @@
 
 
 class StacksTestJSON(base.BaseOrchestrationTest):
-    _interface = 'json'
-
     empty_template = "HeatTemplateFormatVersion: '2012-12-12'\n"
 
     @classmethod
diff --git a/tempest/api/orchestration/stacks/test_swift_resources.py b/tempest/api/orchestration/stacks/test_swift_resources.py
index fcf357a..b954128 100644
--- a/tempest/api/orchestration/stacks/test_swift_resources.py
+++ b/tempest/api/orchestration/stacks/test_swift_resources.py
@@ -25,40 +25,13 @@
 
 
 class SwiftResourcesTestJSON(base.BaseOrchestrationTest):
-    _interface = 'json'
-    template = """
-heat_template_version: 2013-05-23
-description: Template which creates a Swift container resource
-
-resources:
-  SwiftContainerWebsite:
-    deletion_policy: "Delete"
-    type: OS::Swift::Container
-    properties:
-      X-Container-Read: ".r:*"
-      X-Container-Meta:
-        web-index: "index.html"
-        web-error: "error.html"
-
-  SwiftContainer:
-    type: OS::Swift::Container
-
-outputs:
-  WebsiteURL:
-    description: "URL for website hosted on S3"
-    value: { get_attr: [SwiftContainer, WebsiteURL] }
-  DomainName:
-    description: "Domain of Swift host"
-    value: { get_attr: [SwiftContainer, DomainName] }
-
-"""
-
     @classmethod
     @test.safe_setup
     def setUpClass(cls):
         super(SwiftResourcesTestJSON, cls).setUpClass()
         cls.client = cls.orchestration_client
         cls.stack_name = data_utils.rand_name('heat')
+        template = cls.load_template('swift_basic')
         os = clients.Manager()
         if not CONF.service_available.swift:
             raise cls.skipException("Swift support is required")
@@ -67,7 +40,7 @@
         # create the stack
         cls.stack_identifier = cls.create_stack(
             cls.stack_name,
-            cls.template)
+            template)
         cls.stack_id = cls.stack_identifier.split('/')[1]
         cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
         cls.test_resources = {}
diff --git a/tempest/api/orchestration/stacks/test_templates.py b/tempest/api/orchestration/stacks/test_templates.py
index 2dc29fc..5f55b4d 100644
--- a/tempest/api/orchestration/stacks/test_templates.py
+++ b/tempest/api/orchestration/stacks/test_templates.py
@@ -16,8 +16,6 @@
 
 
 class TemplateYAMLTestJSON(base.BaseOrchestrationTest):
-    _interface = 'json'
-
     template = """
 HeatTemplateFormatVersion: '2012-12-12'
 Description: |
diff --git a/tempest/api/orchestration/stacks/test_templates_negative.py b/tempest/api/orchestration/stacks/test_templates_negative.py
index c55f6ee..a2a6f98 100644
--- a/tempest/api/orchestration/stacks/test_templates_negative.py
+++ b/tempest/api/orchestration/stacks/test_templates_negative.py
@@ -18,8 +18,6 @@
 
 
 class TemplateYAMLNegativeTestJSON(base.BaseOrchestrationTest):
-    _interface = 'json'
-
     template = """
 HeatTemplateFormatVersion: '2012-12-12'
 Description: |