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