blob: d6fd0750f332eda2637854c58c1bb455a9285674 [file] [log] [blame]
Jon Perritt4a5c8492015-02-03 13:13:59 -07001package stacks
2
Pratik Mallya3de347f2015-09-22 12:25:59 -05003// ValidJSONTemplate is a valid OpenStack Heat template in JSON format
Pratik Mallya5fddb2a2015-09-14 14:04:49 -05004const ValidJSONTemplate = `
5{
6 "heat_template_version": "2014-10-16",
7 "parameters": {
8 "flavor": {
9 "default": 4353,
10 "description": "Flavor for the server to be created",
11 "hidden": true,
12 "type": "string"
13 }
14 },
15 "resources": {
16 "test_server": {
17 "properties": {
18 "flavor": "2 GB General Purpose v1",
19 "image": "Debian 7 (Wheezy) (PVHVM)",
20 "name": "test-server"
21 },
22 "type": "OS::Nova::Server"
23 }
24 }
25}
26`
27
Pratik Mallya3de347f2015-09-22 12:25:59 -050028// ValidYAMLTemplate is a valid OpenStack Heat template in YAML format
Pratik Mallya5fddb2a2015-09-14 14:04:49 -050029const ValidYAMLTemplate = `
30heat_template_version: 2014-10-16
31parameters:
32 flavor:
33 type: string
34 description: Flavor for the server to be created
35 default: 4353
36 hidden: true
37resources:
38 test_server:
39 type: "OS::Nova::Server"
40 properties:
41 name: test-server
42 flavor: 2 GB General Purpose v1
43 image: Debian 7 (Wheezy) (PVHVM)
44`
45
Pratik Mallya3de347f2015-09-22 12:25:59 -050046// InvalidTemplateNoVersion is an invalid template as it has no `version` section
Pratik Mallya5fddb2a2015-09-14 14:04:49 -050047const InvalidTemplateNoVersion = `
48parameters:
49 flavor:
50 type: string
51 description: Flavor for the server to be created
52 default: 4353
53 hidden: true
54resources:
55 test_server:
56 type: "OS::Nova::Server"
57 properties:
58 name: test-server
59 flavor: 2 GB General Purpose v1
60 image: Debian 7 (Wheezy) (PVHVM)
61`
62
Pratik Mallya3de347f2015-09-22 12:25:59 -050063// ValidJSONEnvironment is a valid environment for a stack in JSON format
Pratik Mallya5fddb2a2015-09-14 14:04:49 -050064const ValidJSONEnvironment = `
65{
jrperritt3d966162016-06-06 14:08:54 -050066 "parameters": {
67 "user_key": "userkey"
68 },
69 "resource_registry": {
70 "My::WP::Server": "file:///home/shardy/git/heat-templates/hot/F18/WordPress_Native.yaml",
71 "OS::Quantum*": "OS::Neutron*",
72 "AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml",
73 "OS::Metering::Alarm": "OS::Ceilometer::Alarm",
74 "AWS::RDS::DBInstance": "file:///etc/heat/templates/AWS_RDS_DBInstance.yaml",
75 "resources": {
76 "my_db_server": {
77 "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml"
78 },
79 "my_server": {
80 "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml",
81 "hooks": "pre-create"
82 },
83 "nested_stack": {
84 "nested_resource": {
85 "hooks": "pre-update"
86 },
87 "another_resource": {
88 "hooks": [
89 "pre-create",
90 "pre-update"
91 ]
92 }
93 }
94 }
95 }
Pratik Mallya5fddb2a2015-09-14 14:04:49 -050096}
97`
98
jrperritt3d966162016-06-06 14:08:54 -050099// ValidYAMLEnvironment is a valid environment for a stack in YAML format
100const ValidYAMLEnvironment = `
101parameters:
102 user_key: userkey
103resource_registry:
104 My::WP::Server: file:///home/shardy/git/heat-templates/hot/F18/WordPress_Native.yaml
105 # allow older templates with Quantum in them.
106 "OS::Quantum*": "OS::Neutron*"
107 # Choose your implementation of AWS::CloudWatch::Alarm
108 "AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml"
109 #"AWS::CloudWatch::Alarm": "OS::Heat::CWLiteAlarm"
110 "OS::Metering::Alarm": "OS::Ceilometer::Alarm"
111 "AWS::RDS::DBInstance": "file:///etc/heat/templates/AWS_RDS_DBInstance.yaml"
112 resources:
113 my_db_server:
114 "OS::DBInstance": file:///home/mine/all_my_cool_templates/db.yaml
115 my_server:
116 "OS::DBInstance": file:///home/mine/all_my_cool_templates/db.yaml
117 hooks: pre-create
118 nested_stack:
119 nested_resource:
120 hooks: pre-update
121 another_resource:
122 hooks: [pre-create, pre-update]
123`
124
125// InvalidEnvironment is an invalid environment as it has an extra section called `resources`
126const InvalidEnvironment = `
127parameters:
128 flavor:
129 type: string
130 description: Flavor for the server to be created
131 default: 4353
132 hidden: true
133resources:
134 test_server:
135 type: "OS::Nova::Server"
136 properties:
137 name: test-server
138 flavor: 2 GB General Purpose v1
139 image: Debian 7 (Wheezy) (PVHVM)
140parameter_defaults:
141 KeyName: heat_key
142`
143
Pratik Mallya3de347f2015-09-22 12:25:59 -0500144// ValidJSONEnvironmentParsed is the expected parsed version of ValidJSONEnvironment
Pratik Mallya5fddb2a2015-09-14 14:04:49 -0500145var ValidJSONEnvironmentParsed = map[string]interface{}{
146 "parameters": map[string]interface{}{
147 "user_key": "userkey",
148 },
149 "resource_registry": map[string]interface{}{
150 "My::WP::Server": "file:///home/shardy/git/heat-templates/hot/F18/WordPress_Native.yaml",
151 "OS::Quantum*": "OS::Neutron*",
152 "AWS::CloudWatch::Alarm": "file:///etc/heat/templates/AWS_CloudWatch_Alarm.yaml",
153 "OS::Metering::Alarm": "OS::Ceilometer::Alarm",
154 "AWS::RDS::DBInstance": "file:///etc/heat/templates/AWS_RDS_DBInstance.yaml",
155 "resources": map[string]interface{}{
156 "my_db_server": map[string]interface{}{
157 "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml",
158 },
159 "my_server": map[string]interface{}{
160 "OS::DBInstance": "file:///home/mine/all_my_cool_templates/db.yaml",
161 "hooks": "pre-create",
162 },
163 "nested_stack": map[string]interface{}{
164 "nested_resource": map[string]interface{}{
165 "hooks": "pre-update",
166 },
167 "another_resource": map[string]interface{}{
168 "hooks": []interface{}{
169 "pre-create",
170 "pre-update",
171 },
172 },
173 },
174 },
175 },
176}
177
jrperritt3d966162016-06-06 14:08:54 -0500178// ValidJSONTemplateParsed is the expected parsed version of ValidJSONTemplate
179var ValidJSONTemplateParsed = map[string]interface{}{
180 "heat_template_version": "2014-10-16",
181 "parameters": map[string]interface{}{
182 "flavor": map[string]interface{}{
183 "default": 4353,
184 "description": "Flavor for the server to be created",
185 "hidden": true,
186 "type": "string",
187 },
188 },
189 "resources": map[string]interface{}{
190 "test_server": map[string]interface{}{
191 "properties": map[string]interface{}{
192 "flavor": "2 GB General Purpose v1",
193 "image": "Debian 7 (Wheezy) (PVHVM)",
194 "name": "test-server",
195 },
196 "type": "OS::Nova::Server",
197 },
198 },
199}