Heatstack create: fix str/bytes error in NamedTemporaryFile.write()
[yardstick.git] / tools / vsperf_install.yml
1 ##############################################################################
2 # Copyright (c) 2017 Nokia
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 heat_template_version: 2015-04-30
10
11 description: >
12   Used to run VMs with Vsperf
13
14 parameters:
15   image:
16     type: string
17     description: Name of the image
18     default: yardstick-vsperf
19
20   flavor:
21     type: string
22     default: vsperf-flavor
23
24   timeout:
25     type: number
26     description: Timeout in seconds for WaitCondition, depends on your image and environment
27     default: 6000
28
29   external_net_name:
30     type: string
31     description: Name of the external network which management network will connect to
32     default: ext-net1
33
34 resources:
35   network:
36     type: OS::Neutron::Net
37     properties:
38       name: vsperf_net
39
40   subnet:
41     type: OS::Neutron::Subnet
42     properties:
43       name: vsperf_subnet
44       ip_version: 4
45       cidr: 192.168.0.0/24
46       network: { get_resource: network }
47
48   management_router:
49     type: OS::Neutron::Router
50     properties:
51       name: management_router
52       external_gateway_info:
53         network: { get_param: external_net_name }
54
55   management_router_interface:
56     type: OS::Neutron::RouterInterface
57     properties:
58       router: { get_resource: management_router }
59       subnet: { get_resource: subnet }
60
61   floating_ip:
62     type: OS::Neutron::FloatingIP
63     properties:
64       floating_network: { get_param: external_net_name }
65
66   floating_ip_association:
67     type: OS::Nova::FloatingIPAssociation
68     properties:
69       floating_ip: { get_resource: floating_ip }
70       server_id: {get_resource: vsperf_vm}
71
72   keypair:
73     type: OS::Nova::KeyPair
74     properties:
75       name: yardstick-key
76       public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD0RkXfW6pksd1cZmXuvXZF/Mlqqq3ahIGcGoULOC97XMpu0vdxMpcUwdjwGqMwEXTVyfHidu0l99bLqOCpSUKCmbWx3ONJ+1kqFx4HwsKEWLiyDYqsuMrDeZT1eFjC5avCoTcrIw2wq5NaBb00lDGagNZOeopaL5YIa4+PizEY23+cir24D67NU21Fg3JE92AIeGlNa4j66L3a+lL0hZq74Dilmp42wm4GsbplRO6KJfyaraowHb1X+TmhCjBgHk6M/OJ9yPAroZyJNcwjMAuuxhAYWRuT3SdbnoUR0RG2VhfDh0qNid7vOqLbhKPeaLLFmzkN+9w3WdCp6LbSYt87 yardstick@yardstick.opnfv.org
77
78   wait_handle:
79     type: OS::Heat::WaitConditionHandle
80
81   wait_condition:
82     type: OS::Heat::WaitCondition
83     properties:
84       handle: { get_resource: wait_handle }
85       count: 1
86       timeout: { get_param: timeout }
87
88   vsperf_vm:
89     type: OS::Nova::Server
90     depends_on: [subnet, keypair]
91     properties:
92       name: { get_param: "OS::stack_name" }
93       image: { get_param: image }
94       flavor: { get_param: flavor }
95       key_name: {get_resource: keypair}
96       networks:
97         - network: { get_resource: network }
98       config_drive: True
99       user_data_format : RAW
100       user_data:
101         str_replace:
102           template: |
103             #!/bin/bash
104             cat <<'CEOF' > /tmp/vsperf_post_build.sh
105             echo "Install vswitchperf"
106             mv /root/vswitchperf /home/ubuntu
107             chown -R ubuntu:ubuntu /home/ubuntu/vswitchperf
108             cd /home/ubuntu/vswitchperf/systems
109             sudo -H -u ubuntu ./build_base_machine.sh
110             echo "Set password less access to MoonGen server"
111             sudo -H -u ubuntu ssh-keygen -b 2048 -t rsa -f /home/ubuntu/.ssh/id_rsa -N ''
112             sudo -H -u ubuntu touch /home/ubuntu/.cloud-warnings.skip
113             echo "Enable 1GB huge pages"
114             update-grub
115             $NOTIFY --data-binary '{"status": "SUCCESS"}'
116             CEOF
117             chmod +x /tmp/vsperf_post_build.sh
118             nohup /tmp/vsperf_post_build.sh &
119           params:
120             $NOTIFY: { get_attr: ['wait_handle', 'curl_cli'] }
121
122 outputs:
123   vm_uuid:
124     description: uuid of the VM
125     value: { get_attr: [ vsperf_vm, show,id ] }