ramp generator traffic & prox.log copy
[samplevnf.git] / VNFs / DPPD-PROX / helper-scripts / rapid / openstack-rapid.yaml
1 heat_template_version: 2015-10-15
2
3 description: >
4   Template for deploying n PROX instances. The template allows for deploying
5   multiple groups of PROX VMs. You can create a first group with certain
6   flavors, availability groups, etc... Another group can be created with
7   different characteristics.
8
9 parameters:
10   public_net_name: {description: Public network to allocate (floating) IPs to VMs', type: string, default: admin_floating_net}
11   mgmt_net_name: {description: Name of PROX mgmt network to be created, type: string, default: admin_internal_net}
12   PROX_image: {description: Image name to use for PROX, type: string, default: rapidVM}
13   PROX_key: {description: DO NOT CHANGE THIS DEFAULT KEY NAME, type: string, default: rapid_key}
14   my_availability_zone: {description: availability_zone for Hosting VMs, type: string, default: nova}
15   security_group: {description: Security Group to use, type: string, default: prox_security_group}
16   PROXVM_count: {description: Total number of testVMs to create, type: number, default: 2}
17   PROX2VM_count: {description: Total number of testVMs to create, type: number, default: 1}
18
19 # The following paramters are not used, but are here in case you want to also
20 # create the management and dataplane networks in this template
21   mgmt_net_cidr: {description: PROX mgmt network CIDR, type: string, default: 20.20.1.0/24}
22   mgmt_net_gw: {description: PROX mgmt network gateway address, type: string, default: 20.20.1.1}
23   mgmt_net_pool_start: {description: Start of mgmt network IP address allocation pool, type: string, default: 20.20.1.100}
24   mgmt_net_pool_end: {description: End of mgmt network IP address allocation pool, type: string, default: 20.20.1.200}
25   data_net_name: {description: Name of PROX private network to be created, type: string, default: dataplane-network}
26   data_net_cidr: {description: PROX private network CIDR,type: string, default: 30.30.1.0/24}
27   data_net_pool_start: {description: Start of private network IP address allocation pool, type: string, default: 30.30.1.100}
28   data_net_pool_end: {description: End of private network IP address allocation pool, type: string, default: 30.30.1.200}
29   dns:
30     type: comma_delimited_list
31     label: DNS nameservers
32     description: Comma separated list of DNS nameservers for the management network.
33     default: '8.8.8.8'
34
35 resources:
36   PROXVMs:
37     type: OS::Heat::ResourceGroup
38     description: Group of PROX VMs according to specs described in this section
39     properties:
40       count: { get_param: PROXVM_count }
41       resource_def:
42         type: rapid-openstack-server.yaml
43         properties:
44           PROX_availability_zone : {get_param: my_availability_zone}
45           PROX_security_group : {get_param: security_group}
46           PROX_image: {get_param: PROX_image}
47           PROX_key: {get_param: PROX_key}
48           PROX_server_name: rapidVM-%index%
49           PROX_public_net: {get_param: public_net_name}
50           PROX_mgmt_net_id: {get_param: mgmt_net_name}
51           PROX_data_net_id: {get_param: data_net_name}
52           PROX_config: {get_resource: MyConfig}
53     depends_on:
54       - MyConfig
55   
56   PROX2VMs:
57     type: OS::Heat::ResourceGroup
58     description: Group of PROX VMs according to specs described in this section
59     properties:
60       count: { get_param: PROX2VM_count }
61       resource_def:
62         type: rapid-openstack-server.yaml
63         properties:
64           PROX_availability_zone : {get_param: my_availability_zone}
65           PROX_security_group : {get_param: security_group}
66           PROX_image: {get_param: PROX_image}
67           PROX_key: {get_param: PROX_key}
68           PROX_server_name: rapidType2VM-%index%
69           PROX_public_net: {get_param: public_net_name}
70           PROX_mgmt_net_id: {get_param: mgmt_net_name}
71           PROX_data_net_id: {get_param: data_net_name}
72           PROX_config: {get_resource: MyConfig}
73     depends_on:
74       - MyConfig
75   
76   MyConfig:
77     type: OS::Heat::CloudConfig
78     properties:
79       cloud_config:
80         users:
81         - default
82         - name: rapid
83           groups: "users,root"
84           lock-passwd: false
85           passwd: 'test'
86           shell: "/bin/bash"
87           sudo: "ALL=(ALL) NOPASSWD:ALL"
88         ssh_pwauth: true
89         chpasswd:
90           list:  |
91               rapid:rapid
92           expire: False
93         write_files:
94         - path: /opt/rapid/after_boot_do_not_run.sh
95           # after_boot.sh is ran by check_prox_system_setup.sh, if it exists
96           # This can be used to fix some issues, like in the example below
97           # Remove this section or rename the file, if you do not want to run
98           # this after booting
99           content: |
100             OLDIFS="${IFS}"
101             IFS=$'\n'
102             list="$(ip route | grep via | grep -v 'dev eth0')"
103             # Delete all routes using gateway on other interfaces than eth0
104             for item in ${list}
105               do /bin/bash -c "sudo ip route del ${item}"
106             done
107             /bin/bash -c "sudo ip route add default via 10.6.6.1 dev eth0"
108             /bin/bash -c "echo nameserver 8.8.8.8 > /etc/resolv.conf"
109             IFS="${OLDIFS}"
110           permissions: '0777'
111
112 outputs:
113   number_of_servers:
114     description: List of number or PROX instance
115     value: 
116       - {get_param: PROXVM_count}
117       - {get_param: PROX2VM_count}
118   server_name:
119     description: List of list of names of the PROX instances
120     value: 
121       - {get_attr: [PROXVMs, name]}
122       - {get_attr: [PROX2VMs, name]}
123   mngmt_ips:
124     description: List of list of Management IPs of the VMs
125     value: 
126       - {get_attr: [PROXVMs, mngmt_ip]}
127       - {get_attr: [PROX2VMs, mngmt_ip]}
128   data_plane_ips:
129     description: List of list of list of DataPlane IPs of the VMs
130     value: 
131       - {get_attr: [PROXVMs, data_plane_ips]}
132       - {get_attr: [PROX2VMs, data_plane_ips]}
133   data_plane_macs:
134     description: List of list of list of DataPlane MACs of the VMs
135     value: 
136       - {get_attr: [PROXVMs, data_plane_mac]}
137       - {get_attr: [PROX2VMs, data_plane_mac]}