Added MTU network config and updated flavor_metadata test support
[snaps.git] / snaps / openstack / tests / heat / floating_ip_heat_template.yaml
1 ##############################################################################
2 # Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
3 #                    and others.  All rights reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at:
8 #
9 #     http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 ##############################################################################
17 heat_template_version: 2015-04-30
18
19 description: >
20   Sample template with two VMs instantiated against different images and
21   flavors on the same network and the first one has a floating IP
22
23 parameters:
24   image1_name:
25     type: string
26     label: Image ID for first VM
27     description: Image name to be used for first instance
28     default: image_1
29   image2_name:
30     type: string
31     label: Image ID for second VM
32     description: Image name to be used for second instance
33     default: image_2
34   flavor1_name:
35     type: string
36     label: Instance Flavor for first VM
37     description: Flavor name for the first instance
38     default: m1.small
39   flavor2_name:
40     type: string
41     label: Instance Flavor for second VM
42     description: Flavor name for the second instance
43     default: m1.med
44   net_name:
45     type: string
46     label: Test network name
47     description: The name of the stack's network
48     default: test_net
49   subnet_name:
50     type: string
51     label: Test subnet name
52     description: The name of the stack's subnet
53     default: test_subnet
54   router_name:
55     type: string
56     label: Test router name
57     description: The name of the stack's router
58     default: mgmt_router
59   keypair_name:
60     type: string
61     label: Keypair name
62     description: The name of the stack's keypair
63     default: keypair_name
64   security_group_name:
65     type: string
66     label: Security Group name
67     description: The name of the stack's security group
68     default: security_group_name
69   inst1_name:
70     type: string
71     label: First VM name
72     description: The name of the first VM to be spawned
73     default: test_vm1
74   inst2_name:
75     type: string
76     label: Second VM name
77     description: The name of the second VM to be spawned
78     default: test_vm2
79   external_net_name:
80     type: string
81     description: Name of the external network which management network will connect to
82     default: external
83
84 resources:
85   flavor1:
86     type: OS::Nova::Flavor
87     properties:
88       ram: 1024
89       vcpus: 2
90       disk: 2
91       extra_specs:
92         hw:mem_page_size: large
93   flavor2:
94     type: OS::Nova::Flavor
95     properties:
96       ram: 1024
97       vcpus: 2
98       disk: 2
99       extra_specs:
100         hw:mem_page_size: large
101
102   network:
103     type: OS::Neutron::Net
104     properties:
105       name: { get_param: net_name }
106
107   subnet:
108     type: OS::Neutron::Subnet
109     properties:
110       name: { get_param: subnet_name }
111       ip_version: 4
112       cidr: 10.1.2.0/24
113       network: { get_resource: network }
114
115   management_router:
116     type: OS::Neutron::Router
117     properties:
118       name: { get_param: router_name }
119       external_gateway_info:
120         network: { get_param: external_net_name }
121
122   management_router_interface:
123     type: OS::Neutron::RouterInterface
124     properties:
125       router: { get_resource: management_router }
126       subnet: { get_resource: subnet }
127
128   server_security_group:
129     type: OS::Neutron::SecurityGroup
130     properties:
131       description: Add security group rules for server
132       name: { get_param: security_group_name }
133       rules:
134         - remote_ip_prefix: 0.0.0.0/0
135           protocol: tcp
136           port_range_min: 22
137           port_range_max: 22
138         - remote_ip_prefix: 0.0.0.0/0
139           protocol: icmp
140
141   floating_ip:
142     type: OS::Neutron::FloatingIP
143     properties:
144       floating_network: { get_param: external_net_name }
145
146   floating_ip_association:
147     type: OS::Nova::FloatingIPAssociation
148     properties:
149       floating_ip: { get_resource: floating_ip }
150       server_id: {get_resource: vm1}
151
152   keypair:
153     type: OS::Nova::KeyPair
154     properties:
155       name: { get_param: keypair_name }
156       save_private_key: True
157
158   vm1:
159     type: OS::Nova::Server
160     depends_on: [subnet, keypair, flavor1]
161     properties:
162       name: { get_param: inst1_name }
163       image: { get_param: image1_name }
164       flavor: { get_resource: flavor1 }
165       key_name: {get_resource: keypair}
166       security_groups: [{ get_resource: server_security_group }]
167       networks:
168         - network: { get_resource: network }
169
170   vm2:
171     type: OS::Nova::Server
172     depends_on: [subnet, flavor2]
173     properties:
174       name: { get_param: inst2_name }
175       image: { get_param: image2_name }
176       flavor: { get_resource: flavor2 }
177       key_name: {get_resource: keypair}
178       networks:
179         - network: { get_resource: network }
180
181 outputs:
182   private_key:
183     description: "SSH Private Key"
184     value: { get_attr: [ keypair, private_key ]}