Fix spacing issues in YAML files in heat
[demo.git] / heat / vLB_CDS / vpkg.yaml
1 ##########################################################################
2 #
3 #==================LICENSE_START==========================================
4 #
5 #
6 # Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #        http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 #==================LICENSE_END============================================
20 #
21 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 #
23 ##########################################################################
24
25 heat_template_version: 2013-05-23
26
27 description: Heat template that deploys a vPacketGen for ONAP
28
29 ##############
30 #            #
31 # PARAMETERS #
32 #            #
33 ##############
34
35 parameters:
36   vpg_image_name:
37     type: string
38     label: Image name or ID
39     description: Image to be used for compute instance
40   vpg_flavor_name:
41     type: string
42     label: Flavor
43     description: Type of instance (flavor) to be used
44   public_net_id:
45     type: string
46     label: Public network name or ID
47     description: Public network that enables remote connection to VNF
48   int_pktgen_private_net_id:
49     type: string
50     label: vPacketGen private network name or ID
51     description: Private network that connects vLoadBalancer with vPacketGen
52   int_pktgen_private_subnet_id:
53     type: string
54     label: vPacketGen private subnet name or ID
55     description: Private subnet of the network that connects vLoadBalancer with vPacketGen
56   onap_private_net_id:
57     type: string
58     label: ONAP management network name or ID
59     description: Private network that connects ONAP component and the VNF
60   onap_private_subnet_id:
61     type: string
62     label: ONAP management sub-network name or ID
63     description: Private sub-network that connects ONAP component and the VNF
64   pktgen_private_net_cidr:
65     type: string
66     label: vPacketGen private network CIDR
67     description: The CIDR of the vPacketGen private network
68   onap_private_net_cidr:
69     type: string
70     label: ONAP private network CIDR
71     description: The CIDR of the protected private network
72   vpg_int_pktgen_private_ip_0:
73     type: string
74     label: vPacketGen private IP address towards the vPacketGen private network
75     description: Private IP address that is assigned to the vPacketGen to communicate with the vLoadBalancer
76   vpg_onap_private_ip_0:
77     type: string
78     label: vPacketGen private IP address towards the ONAP management network
79     description: Private IP address that is assigned to the vPacketGen to communicate with ONAP components
80   vlb_int_pktgen_private_ip_0:
81     type: string
82     label: vLoadBalancer private IP address towards the vPacketGen network
83     description: Private IP address that is assigned to the vLoadBalancer to communicate with vPacketGen
84   vlb_0_mac_address:
85     type: string
86     label: vLB MAC address
87     description: MAC address of the vLB used by the vPacketGen VM
88   vpg_0_mac_address:
89     type: string
90     label: vPacketGen MAC address
91     description: MAC address of the vPacketGen used by the vLB VM
92   pg_int:
93     type: string
94     label: IP Address of the output vPacketGen interface
95     description: IP address assigned to the output interface of the vPacketGen's VPP layer
96   vpg_name_0:
97     type: string
98     label: vPKTGEN name
99     description: Name of the vPKTGEN
100   vnf_id:
101     type: string
102     label: VNF ID
103     description: The VNF ID is provided by ONAP
104   vnf_name:
105     type: string
106     label: VNF NAME
107     description: The VNF NAME is provided by ONAP
108   vf_module_id:
109     type: string
110     label: vFirewall module ID
111     description: The vLoadBalancer Module ID is provided by ONAP
112   keypair:
113     type: string
114     label: Key pair name
115     description: Public/Private key pair name
116   demo_artifacts_version:
117     type: string
118     label: Artifacts version used in demo vnfs
119     description: Version number for downloading the vPacketGen streams for VPP and VES
120   nb_api_version:
121     type: string
122     label: Northbound API version
123     description: Version number of the health check and config APIs
124   install_script_version:
125     type: string
126     label: Installation script version number
127     description: Version number of the scripts that install the vLB demo app
128   cloud_env:
129     type: string
130     label: Cloud environment
131     description: Cloud environment (e.g., openstack, rackspace)
132   nexus_artifact_repo:
133     type: string
134     description: Root URL for the Nexus repository for Maven artifacts.
135   sec_group:
136     type: string
137     description: ONAP Security Group
138
139 #############
140 #           #
141 # RESOURCES #
142 #           #
143 #############
144
145 resources:
146
147   # NETWORK_ROLE: pktgen_private
148   # VM_TYPE: vpg
149   vpg_0_int_pktgen_private_port_0:
150     type: OS::Neutron::Port
151     properties:
152       network: { get_param: int_pktgen_private_net_id }
153       fixed_ips: [{"subnet": { get_param: int_pktgen_private_subnet_id }, "ip_address": { get_param: vpg_int_pktgen_private_ip_0 }}]
154       mac_address: { get_param: vpg_0_mac_address }
155       security_groups:
156       - { get_param: sec_group }
157
158   # NETWORK_ROLE: onap_private
159   # VM_TYPE: vpg
160   vpg_0_onap_private_port_0:
161     type: OS::Neutron::Port
162     properties:
163       network: { get_param: onap_private_net_id }
164       fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vpg_onap_private_ip_0 }}]
165       security_groups:
166       - { get_param: sec_group }
167
168   # VM_TYPE: vpg
169   vpg_server_0:
170     type: OS::Nova::Server
171     properties:
172       image: { get_param: vpg_image_name }
173       flavor: { get_param: vpg_flavor_name }
174       name: { get_param: vpg_name_0 }
175       key_name: { get_param: keypair }
176       metadata:
177         vnf_id: { get_param: vnf_id }
178         vf_module_id: { get_param: vf_module_id }
179         vnf_name: { get_param: vnf_name }
180       networks:
181         - network: { get_param: public_net_id }
182         - port: { get_resource: vpg_0_int_pktgen_private_port_0 }
183         - port: { get_resource: vpg_0_onap_private_port_0 }
184       user_data_format: RAW
185       user_data:
186         str_replace:
187           params:
188             __local_private_ipaddr__: { get_param: vpg_int_pktgen_private_ip_0 }
189             __oam_private_ipaddr__: { get_param: vpg_onap_private_ip_0 }
190             __onap_private_net_cidr__: { get_param: onap_private_net_cidr }
191             __pktgen_private_net_cidr__: { get_param: pktgen_private_net_cidr }
192             __vlb_ipaddr__: { get_param: vlb_int_pktgen_private_ip_0 }
193             __demo_artifacts_version__: { get_param: demo_artifacts_version }
194             __nb_api_version__: { get_param: nb_api_version }
195             __install_script_version__: { get_param: install_script_version }
196             __pg_int__: { get_param: pg_int }
197             __vlb_mac__: { get_param: vlb_0_mac_address }
198             __cloud_env__: { get_param: cloud_env }
199             __nexus_artifact_repo__: { get_param: nexus_artifact_repo }
200           template: |
201             #!/bin/bash
202
203             # Create configuration files
204             mkdir /opt/config
205             echo "__oam_private_ipaddr__" > /opt/config/oam_private_ipaddr.txt
206             echo "__onap_private_net_cidr__" > /opt/config/onap_private_net_cidr.txt
207             echo "__local_private_ipaddr__" > /opt/config/local_private_ipaddr.txt
208             echo "__pktgen_private_net_cidr__" > /opt/config/pktgen_private_net_cidr.txt
209             echo "__vlb_ipaddr__" > /opt/config/vlb_ipaddr.txt
210             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
211             echo "__nb_api_version__" > /opt/config/nb_api_version.txt
212             echo "__install_script_version__" > /opt/config/install_script_version.txt
213             echo "__pg_int__" > /opt/config/pg_int.txt
214             echo "__vlb_mac__" > /opt/config/vlb_mac.txt
215             echo "__cloud_env__" > /opt/config/cloud_env.txt
216             echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt
217
218             # Download and run install script
219             apt-get update
220             apt-get -y install unzip
221             if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
222             curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vlbms&a=vlbms-scripts&e=zip&v=__install_script_version__" -o /opt/vlbms-scripts-__install_script_version__.zip
223             unzip -j /opt/vlbms-scripts-__install_script_version__.zip -d /opt v_packetgen_install.sh
224             cd /opt
225             chmod +x v_packetgen_install.sh
226             ./v_packetgen_install.sh