94776fc6da0d72fe428685a07c0f862eedb31f75
[demo.git] / heat / vLB / packet_gen_vlb_rackspace.yaml
1 heat_template_version: 2013-05-23
2 description: Heat template to deploy a packet generator for the vLoadBalancer/vDNS demo app for ONAP
3
4 parameters:
5   public_net_id:
6     type: string
7     label: Public network name or ID
8     description: Public network that enables remote connection to VNF
9   vpg_image_name:
10     type: string
11     label: Image name or ID
12     description: Image to be used for compute instance
13   vpg_flavor_name:
14     type: string
15     label: Flavor
16     description: Type of instance (flavor) to be used
17   vpg_name_0:
18     type: string
19     label: vPacketGenerator name
20     description: Name of the vPacketGenerator
21   key_name:
22     type: string
23     label: Key pair name
24     description: Public/Private key pair name
25   pub_key:
26     type: string
27     label: Public key
28     description: Public key to be installed on the compute instance
29   repo_url_blob:
30     type: string
31     label: Repository URL
32     description: URL of the repository that hosts the demo packages
33   repo_url_artifacts:
34     type: string
35     label: Repository URL
36     description: URL of the repository that hosts the demo packages
37   vlb_ipaddr:
38     type: string
39     label: Public IP of the vLoadBalancer to which we want to send traffic
40     description: Public IP of the vLoadBalancer to which we want to send traffic
41   install_script_version:
42     type: string
43     label: Installation script version number
44     description: Version number of the scripts that install the vFW demo app
45   demo_artifacts_version:
46     type: string
47     label: Artifacts version used in demo vnfs
48     description: Artifacts (jar, tar.gz) version used in demo vnfs
49   cloud_env:
50     type: string
51     label: Cloud environment
52     description: Cloud environment (e.g., openstack, rackspace)
53
54
55 resources:
56
57   random-str:
58     type: OS::Heat::RandomString
59     properties:
60       length: 4
61
62   my_keypair:
63     type: OS::Nova::KeyPair
64     properties:
65       name:
66         str_replace:
67           template: base_rand
68           params:
69             base: { get_param: key_name }
70             rand: { get_resource: random-str }
71       public_key: { get_param: pub_key }
72       save_private_key: false
73
74  
75   vpg_0:
76     type: OS::Nova::Server
77     properties:
78       image: { get_param: vpg_image_name }
79       flavor: { get_param: vpg_flavor_name }
80       name: { get_param: vpg_name_0 }
81       key_name: { get_resource: my_keypair }
82       networks:
83         - network: { get_param: public_net_id }
84       user_data_format: RAW
85       user_data:
86         str_replace:
87           params:
88             __repo_url_blob__ : { get_param: repo_url_blob }
89             __repo_url_artifacts__ : { get_param: repo_url_artifacts }
90             __vlb_ipaddr__: { get_param: vlb_ipaddr }
91             __demo_artifacts_version__ : { get_param: demo_artifacts_version }
92             __install_script_version__ : { get_param: install_script_version }
93             __cloud_env__ : { get_param: cloud_env }
94           template: |
95             #!/bin/bash
96
97             # Create configuration files
98             mkdir /opt/config
99             echo "__vlb_ipaddr__" > /opt/config/vlb_ipaddr.txt
100             echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt
101             echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt
102             echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt
103             echo "__install_script_version__" > /opt/config/install_script_version.txt
104             echo "__cloud_env__" > /opt/config/cloud_env.txt
105
106             # Download and run install script
107             curl -k __repo_url_blob__/org.openecomp.demo/vnfs/vlb/__install_script_version__/v_packetgen_install.sh -o /opt/v_packetgen_install.sh
108             cd /opt
109             chmod +x v_packetgen_install.sh
110             ./v_packetgen_install.sh