966a5155935c0110a55e6e9a59d5dbe8ddf3f0ca
[demo.git] / heat / vLB / dnsscaling_rackspace.yaml
1 heat_template_version: 2013-05-23
2
3 description: Heat template to deploy a vDNS for ONAP (scaling-up scenario)
4
5 parameters:
6   vlb_image_name:
7     type: string
8     label: Image name or ID
9     description: Image to be used for compute instance
10   vlb_flavor_name:
11     type: string
12     label: Flavor
13     description: Type of instance (flavor) to be used
14   public_net_id:
15     type: string
16     label: Public network name or ID
17     description: Public network that enables remote connection to VNF
18   vlb_private_net_id:
19     type: string
20     label: vLoadBalancer private network name or ID
21     description: Private network that connects vLoadBalancer with vDNSs
22   onap_private_net_id:
23     type: string
24     label: ONAP management network name or ID
25     description: Private network that connects ONAP components and the VNF
26   onap_private_subnet_id:
27     type: string
28     label: ONAP management sub-network name or ID
29     description: Private sub-network that connects ONAP components and the VNF
30   vlb_private_ip_0:
31     type: string
32     label: vLoadBalancer private IP address towards the private network
33     description: Private IP address that is assigned to the vLoadBalancer to communicate with the vDNSs
34   vlb_private_ip_1:
35     type: string
36     label: vLoadBalancer private IP address towards the ONAP management network
37     description: Private IP address that is assigned to the vLoadBalancer to communicate with ONAP components
38   vdns_private_ip_0:
39     type: string
40     label: vDNS private IP address towards the private network
41     description: Private IP address that is assigned to the vDNS to communicate with the vLoadBalancer
42   vdns_private_ip_1:
43     type: string
44     label: vDNS private IP address towards the ONAP management network
45     description: Private IP address that is assigned to the vDNS to communicate with ONAP components
46   vdns_name_0:
47     type: string
48     label: vDNS name
49     description: Name of the vDNS
50   vnf_id:
51     type: string
52     label: VNF ID
53     description: The VNF ID is provided by ONAP
54   vf_module_id:
55     type: string
56     label: vFirewall module ID
57     description: The vLoadBalancer Module ID is provided by ONAP
58   key_name:
59     type: string
60     label: Key pair name
61     description: Public/Private key pair name
62   pub_key:
63     type: string
64     label: Public key
65     description: Public key to be installed on the compute instance
66   repo_url_blob:
67     type: string
68     label: Repository URL
69     description: URL of the repository that hosts the demo packages
70   repo_url_artifacts:
71     type: string
72     label: Repository URL
73     description: URL of the repository that hosts the demo packages
74   install_script_version:
75     type: string
76     label: Installation script version number
77     description: Version number of the scripts that install the vFW demo app
78   demo_artifacts_version:
79     type: string
80     label: Artifacts version used in demo vnfs
81     description: Artifacts (jar, tar.gz) version used in demo vnfs
82   cloud_env:
83     type: string
84     label: Cloud environment
85     description: Cloud environment (e.g., openstack, rackspace)
86
87 resources:
88
89   random-str:
90     type: OS::Heat::RandomString
91     properties:
92       length: 4
93
94   my_keypair:
95     type: OS::Nova::KeyPair
96     properties:
97       name:
98         str_replace:
99           template: base_rand
100           params:
101             base: { get_param: key_name }
102             rand: { get_resource: random-str }
103       public_key: { get_param: pub_key }
104       save_private_key: false
105
106   # Virtual DNS Instantiation
107   vdns_private_0_port:
108     type: OS::Neutron::Port
109     properties:
110       network: { get_param: vlb_private_net_id }
111       fixed_ips: [{"subnet": { get_param: vlb_private_net_id }, "ip_address": { get_param: vdns_private_ip_0 }}]
112
113   vdns_private_1_port:
114     type: OS::Neutron::Port
115     properties:
116       network: { get_param: onap_private_net_id }
117       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vdns_private_ip_1 }}]
118
119   vdns_0:
120     type: OS::Nova::Server
121     properties:
122       image: { get_param: vlb_image_name }
123       flavor: { get_param: vlb_flavor_name }
124       name: { get_param: vdns_name_0 }
125       key_name: { get_resource: my_keypair }
126       networks:
127         - network: { get_param: public_net_id }
128         - port: { get_resource: vdns_private_0_port }
129         - port: { get_resource: vdns_private_1_port }
130       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}
131       user_data_format: RAW
132       user_data:
133         str_replace:
134           params:
135             __lb_oam_int__ : { get_param: vlb_private_ip_1 }
136             __lb_private_ipaddr__: { get_param: vlb_private_ip_0 }
137             __local_private_ipaddr__: { get_param: vdns_private_ip_0 }
138             __repo_url_blob__ : { get_param: repo_url_blob }
139             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
140             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
141             __install_script_version__ : { get_param: install_script_version }
142             __cloud_env__ : { get_param: cloud_env }
143           template: |
144             #!/bin/bash
145
146             # Create configuration files
147             mkdir /opt/config
148             echo "__lb_oam_int__" > /opt/config/lb_oam_int.txt
149             echo "__lb_private_ipaddr__" > /opt/config/lb_private_ipaddr.txt
150             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
151             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
152             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
153             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
154             echo "__install_script_version__" > /opt/config/install_script_version.txt
155             echo "__cloud_env__" > /opt/config/cloud_env.txt
156
157             # Download and run install script
158             curl -k __repo_url_blob__/org.openecomp.demo/vnfs/vlb/__install_script_version__/v_dns_install.sh -o /opt/v_dns_install.sh
159             cd /opt
160             chmod +x v_dns_install.sh
161             ./v_dns_install.sh