7243f106b6f784956eeb98670ff29fa04b6c6efe
[demo.git] / heat / vFWCL / vPNG / base_vpng.yaml
1 ##########################################################################\r
2 #\r
3 #==================LICENSE_START==========================================\r
4\r
5 #\r
6 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.\r
7 #\r
8 # Licensed under the Apache License, Version 2.0 (the "License");\r
9 # you may not use this file except in compliance with the License.\r
10 # You may obtain a copy of the License at\r
11 #        http://www.apache.org/licenses/LICENSE-2.0\r
12 #\r
13 # Unless required by applicable law or agreed to in writing, software\r
14 # distributed under the License is distributed on an "AS IS" BASIS,\r
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 # See the License for the specific language governing permissions and\r
17 # limitations under the License.\r
18 #\r
19 #==================LICENSE_END============================================\r
20 #\r
21 # ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
22 #\r
23 ##########################################################################\r
24 \r
25 heat_template_version: 2013-05-23\r
26 \r
27 description: Heat template that deploys vFirewall Traffic Generator demo app for ONAP\r
28 \r
29 ##############\r
30 #            #\r
31 # PARAMETERS #\r
32 #            #\r
33 ##############\r
34 \r
35 parameters:\r
36   vfw_image_name:\r
37     type: string\r
38     label: Image name or ID\r
39     description: Image to be used for compute instance\r
40   vfw_flavor_name:\r
41     type: string\r
42     label: Flavor\r
43     description: Type of instance (flavor) to be used\r
44   public_net_id:\r
45     type: string\r
46     label: Public network name or ID\r
47     description: Public network that enables remote connection to VNF\r
48   unprotected_private_network_id:\r
49     type: string\r
50     label: Unprotected private network name or ID\r
51     description: Private network that connects vPacketGenerator with vFirewall\r
52   unprotected_private_subnet_id:\r
53     type: string\r
54     label: Unprotected private sub-network name or ID\r
55     description: Private sub-network that connects vPacketGenerator with vFirewall\r
56   onap_private_net_id:\r
57     type: string\r
58     label: ONAP management network name or ID\r
59     description: Private network that connects ONAP components and the VNF\r
60   onap_private_subnet_id:\r
61     type: string\r
62     label: ONAP management sub-network name or ID\r
63     description: Private sub-network that connects ONAP components and the VNF\r
64   unprotected_private_net_cidr:\r
65     type: string\r
66     label: Unprotected private network CIDR\r
67     description: The CIDR of the unprotected private network\r
68   onap_private_net_cidr:\r
69     type: string\r
70     label: ONAP private network CIDR\r
71     description: The CIDR of the protected private network\r
72 \r
73   vfw_private_ip_0:\r
74     type: string\r
75     label: vFirewall private IP address towards the unprotected network\r
76     description: Private IP address that is assigned to the vFirewall to communicate with the vPacketGenerator\r
77 \r
78   protected_private_net_cidr:\r
79     type: string\r
80     label: Protected private network CIDR\r
81     description: The CIDR of the protected private network\r
82 \r
83   vsn_private_ip_0:\r
84     type: string\r
85     label: vSink private IP address towards the protected network\r
86     description: Private IP address that is assigned to the vSink to communicate with the vFirewall\r
87 \r
88   vpg_private_ip_0:\r
89     type: string\r
90     label: vPacketGenerator private IP address towards the unprotected network\r
91     description: Private IP address that is assigned to the vPacketGenerator to communicate with the vFirewall\r
92   vpg_private_ip_1:\r
93     type: string\r
94     label: vPacketGenerator private IP address towards the ONAP management network\r
95     description: Private IP address that is assigned to the vPacketGenerator to communicate with ONAP components\r
96   vpg_name_0:\r
97     type: string\r
98     label: vPacketGenerator name\r
99     description: Name of the vPacketGenerator\r
100   vnf_id:\r
101     type: string\r
102     label: VNF ID\r
103     description: The VNF ID is provided by ONAP\r
104   vf_module_id:\r
105     type: string\r
106     label: vPNG Traffic Generator module ID\r
107     description: The vPNG Module ID is provided by ONAP\r
108   dcae_collector_ip:\r
109     type: string\r
110     label: DCAE collector IP address\r
111     description: IP address of the DCAE collector\r
112   dcae_collector_port:\r
113     type: string\r
114     label: DCAE collector port\r
115     description: Port of the DCAE collector\r
116   key_name:\r
117     type: string\r
118     label: Key pair name\r
119     description: Public/Private key pair name\r
120   pub_key:\r
121     type: string\r
122     label: Public key\r
123     description: Public key to be installed on the compute instance\r
124   repo_url_blob:\r
125     type: string\r
126     label: Repository URL\r
127     description: URL of the repository that hosts the demo packages\r
128   repo_url_artifacts:\r
129     type: string\r
130     label: Repository URL\r
131     description: URL of the repository that hosts the demo packages\r
132   install_script_version:\r
133     type: string\r
134     label: Installation script version number\r
135     description: Version number of the scripts that install the vFW demo app\r
136   demo_artifacts_version:\r
137     type: string\r
138     label: Artifacts version used in demo vnfs\r
139     description: Artifacts (jar, tar.gz) version used in demo vnfs\r
140   cloud_env:\r
141     type: string\r
142     label: Cloud environment\r
143     description: Cloud environment (e.g., openstack, rackspace)\r
144 \r
145 #############\r
146 #           #\r
147 # RESOURCES #\r
148 #           #\r
149 #############\r
150 \r
151 resources:\r
152   random-str:\r
153     type: OS::Heat::RandomString\r
154     properties:\r
155       length: 4\r
156 \r
157   my_keypair:\r
158     type: OS::Nova::KeyPair\r
159     properties:\r
160       name:\r
161         str_replace:\r
162           template: base_rand\r
163           params:\r
164             base: { get_param: key_name }\r
165             rand: { get_resource: random-str }\r
166       public_key: { get_param: pub_key }\r
167       save_private_key: false\r
168 \r
169 \r
170   # Virtual Packet Generator instantiation\r
171   vpg_private_0_port:\r
172     type: OS::Neutron::Port\r
173     properties:\r
174       network: { get_param: unprotected_private_network_id }\r
175       fixed_ips: [{"subnet": { get_param: unprotected_private_subnet_id }, "ip_address": { get_param: vpg_private_ip_0 }}]\r
176 \r
177   vpg_private_1_port:\r
178     type: OS::Neutron::Port\r
179     properties:\r
180       network: { get_param: onap_private_net_id }\r
181       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vpg_private_ip_1 }}]\r
182 \r
183   vpg_0:\r
184     type: OS::Nova::Server\r
185     properties:\r
186       image: { get_param: vfw_image_name }\r
187       flavor: { get_param: vfw_flavor_name }\r
188       name: { get_param: vpg_name_0 }\r
189       key_name: { get_resource: my_keypair }\r
190       networks:\r
191         - network: { get_param: public_net_id }\r
192         - port: { get_resource: vpg_private_0_port }\r
193         - port: { get_resource: vpg_private_1_port }\r
194       metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }}\r
195       user_data_format: RAW\r
196       user_data:\r
197         str_replace:\r
198           params:\r
199             __fw_ipaddr__: { get_param: vfw_private_ip_0 }\r
200             __protected_net_cidr__: { get_param: protected_private_net_cidr }\r
201             __sink_ipaddr__: { get_param: vsn_private_ip_0 }\r
202             __repo_url_blob__ : { get_param: repo_url_blob }\r
203             __repo_url_artifacts__ : { get_param: repo_url_artifacts }\r
204             __demo_artifacts_version__ : { get_param: demo_artifacts_version }\r
205             __install_script_version__ : { get_param: install_script_version }\r
206             __vpg_private_ip_0__ : { get_param: vpg_private_ip_0 }\r
207             __vpg_private_ip_1__ : { get_param: vpg_private_ip_1 }\r
208             __unprotected_private_net_cidr__ : { get_param: unprotected_private_net_cidr }\r
209             __onap_private_net_cidr__ : { get_param: onap_private_net_cidr }\r
210             __cloud_env__ : { get_param: cloud_env }\r
211           template: |\r
212             #!/bin/bash\r
213             \r
214             # Create configuration files\r
215             mkdir /opt/config\r
216             echo "__fw_ipaddr__" > /opt/config/fw_ipaddr.txt\r
217             echo "__protected_net_cidr__" > /opt/config/protected_net_cidr.txt\r
218             echo "__sink_ipaddr__" > /opt/config/sink_ipaddr.txt\r
219             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt\r
220             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt\r
221             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt\r
222             echo "__install_script_version__" > /opt/config/install_script_version.txt\r
223             echo "__vpg_private_ip_0__" > /opt/config/vpg_private_ip_0.txt\r
224             echo "__vpg_private_ip_1__" > /opt/config/vpg_private_ip_1.txt\r
225             echo "__unprotected_private_net_cidr__" > /opt/config/unprotected_private_net_cidr.txt\r
226             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt\r
227             echo "__cloud_env__" > /opt/config/cloud_env.txt\r
228             \r
229             # Download and run install script\r
230             curl -k __repo_url_blob__/org.onap.demo/vnfs/vfw/__install_script_version__/v_packetgen_install.sh -o /opt/v_packetgen_install.sh\r
231             cd /opt\r
232             chmod +x v_packetgen_install.sh\r
233             ./v_packetgen_install.sh\r