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