84cf6a783a3d7013736d53c118e0ed952ed1c86e
[sdc.git] /
1 heat_template_version: 2015-04-30
2 #################################
3 # Author: Dmitry Orzhehovsky
4 # Email:  dorzheho@cisco.com
5 #################################
6 description: >
7   The template intended for deploying vSON VM instance.
8
9 parameters:
10
11   instance_index:
12     type: number
13     label: Instance Index
14     description: Index of the instance.
15
16   vnf_name:
17     type: string
18     label: VF name
19     description: Unique name for this VF instance.
20
21   vnf_id:
22     type: string
23     label: VF ID
24     description: Unique ID for this VF instance.
25
26   vf_module_name:
27     type: string
28     label: VF module name
29     description: Unique name for this VF module instance.
30
31   vf_module_id:
32     type: string
33     label: VF module ID
34     description: Unique ID for this VF Module instance
35
36   vfc_role:
37     type: string
38     label: VF module ID
39     description: Unique ID for this VF Module instance
40
41   oam_net_id:
42     type: string
43     label: OAM network ID
44     description: The ID of the OAM network.
45
46   oam_net_subnet_prefix_length: 
47     type: string
48     label: OAM net subnet prefix length
49     description: Prefix length of the subnet on the OAM network.
50
51   default_gateway: 
52     type: string
53     label: Default gateway
54     description: Default gateway.
55
56   dns_servers:
57     type: comma_delimited_list
58     label: DNS servers
59     description: List of DNS servers.
60
61   ntp_servers:
62     type: comma_delimited_list
63     label: NTP servers 
64     description: List of NTP servers.
65
66   oam_net_security_group_id:
67     type: string
68     label: OAM network security group ID
69     description: >
70       The ID of Security group applied on the port
71       bound to the vSON OAM network.
72
73   volume_ids:
74     type: comma_delimited_list
75     label: Volumes IDs 
76     description: List of Volumes IDs.
77
78   availability_zones:
79     type: comma_delimited_list
80     label: Availability zones
81     description: List of availability zones.
82
83   vson_server_group_id:
84     type: string
85     label: vSON server group ID
86     description: >
87       Tells what policy should be applied to the ServerGroup.
88       Affinity policy will force instances to share the same hypervisor.
89       Anti-affinity will force instances to run in different hypervisors.
90
91   vson_vm_names:
92     type: comma_delimited_list
93     label: vSON Cluster leader names
94     description: A list of unique names to be issued to the vSON Cluster leaders.
95
96   oam_net_ips:
97     type: comma_delimited_list
98     label: vSON OAM network IP addresses
99     description: Fixed IP assignments for vSON instances on the OAM network.
100
101   vson_vm_image_name:
102     type: string
103     label: vSON base VM image name
104     description: VM Image name the vSON instance will be created from.
105
106   vson_vm_flavor_name:
107     type: string
108     label: Flavor name
109     description: The ID or name of the flavor to boot onto.
110
111   vson_dc_unit:
112     type: string
113     label: vSON Data Center name
114     description: Name of the vSON Data Center.
115
116   vson_clm_oam_net_ip:
117     type: string
118     label: vSON Cluster Manager IP
119     description: IP of the vSON Cluster Manager.
120
121   vson_join_cluster_auth_token:
122     type: string
123     label: vSON join cluster auth token
124     description: >
125       Authentication Token generated for the user permitted to add 
126       a new Datacenter/vSON member to existing vSON Cluster. 
127
128   swift_account_auth_token:
129     type: string
130     label: Swift account auth token
131     description: >
132       Swift account auth token.
133       Example:  041a5187bb4641f9b89583e2539776b0
134
135 resources:
136
137   wait_condition:
138     type: OS::Heat::SwiftSignal
139     properties:
140       handle: {get_resource: wait_handle}
141       count: 1
142       timeout: 800
143
144   wait_handle:
145     type: OS::Heat::SwiftSignalHandle
146
147 # vSON server OAM network port
148   vson_server_oam_net_port_0:
149     type: OS::Neutron::Port
150     properties:
151       name: 
152         str_replace:
153           template: VNF_NAME_VNF_ID_SERVER_NAME_oam_net_port_0
154           params:
155             VNF_NAME: {get_param: vnf_name}
156             VNF_ID: {get_param: vnf_id}
157             SERVER_NAME: {get_param: [vson_vm_names, {get_param: instance_index}]}
158       network_id: {get_param: oam_net_id}
159       fixed_ips:
160         - ip_address: {get_param: [oam_net_ips, {get_param: instance_index}]}
161       security_groups:
162       - {get_param: oam_net_security_group_id}
163
164 # Attach Cinder volume to the server
165   vson_server_volume_attach:
166     type: OS::Cinder::VolumeAttachment
167     depends_on: vson_server
168     properties:
169       instance_uuid: {get_resource: vson_server}
170       volume_id: {get_param: [volume_ids, {get_param: instance_index}]}
171
172 # Create vSON server 
173   vson_server:
174     type: OS::Nova::Server
175     depends_on: [vson_server_oam_net_port_0]
176     properties:
177       name: {get_param: [vson_vm_names, {get_param: instance_index}]}
178       availability_zone: {get_param: [availability_zones, {get_param: instance_index}]}
179       image: {get_param: vson_vm_image_name}
180       flavor: {get_param: vson_vm_flavor_name}
181       config_drive: True
182       metadata: 
183         vnf_name: {get_param: vnf_name}
184         vnf_id: {get_param: vnf_id}
185         vf_module_name: {get_param: vf_module_name}
186         vf_module_id: {get_param: vf_module_id}
187         vm_role: {get_param: vfc_role}
188       networks:
189       - port: {get_resource: vson_server_oam_net_port_0}
190       scheduler_hints:
191         group: {get_param: vson_server_group_id}
192       user_data_format: RAW
193       user_data:
194         str_replace:
195           template: {get_file: deploy.sh}
196           params:
197             $HOT_INSTANCE_INDEX: {get_param: instance_index}
198             $HOT_VOLUME_ID: {get_param: [volume_ids, {get_param: instance_index}]}
199             $HOT_VOLUME_ATTACH: "False"
200             $HOT_VFC_ROLE: {get_param: vfc_role}
201             $HOT_CLM_SERVER_IP: {get_param: vson_clm_oam_net_ip}
202             $HOT_THIS_INSTANCE_OAM_NET_IP: {get_param: [oam_net_ips, {get_param: instance_index}]}
203             $HOT_THIS_INSTANCE_OAM_NET_PREFIX: {get_param: oam_net_subnet_prefix_length}
204             $HOT_THIS_INSTANCE_DEFAULT_GATEWAY: {get_param: default_gateway}
205             $HOT_DNS_SERVERS: {list_join: [',', {get_param: dns_servers}]}
206             $HOT_DC_NAME: {get_param: vson_dc_unit}
207             $HOT_NTP_SERVERS: {list_join: [' ', {get_param: ntp_servers}]}
208             $HOT_SWIFT_AUTH_TOKEN: {get_param: swift_account_auth_token}
209             $HOT_VSON_JOIN_CLUSTER_AUTH_TOKEN: {get_param: vson_join_cluster_auth_token}
210             $HOT_WC_NOTIFY: { get_attr: ['wait_handle', 'curl_cli'] }
211