operation_general: fix logging to use %s
[yardstick.git] / tools / dpdk_install.yml
1 ##############################################################################
2 # Copyright (c) 2017 ZTE corporation and others.
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 DPDK pktgen
13
14 parameters:
15   image:
16     type: string
17     description: Name of the image
18     default: yardstick-wily-server
19
20   timeout:
21     type: number
22     description: Timeout in seconds for WaitCondition, depends on your image and environment
23     default: 900
24
25   external_net_name:
26     type: string
27     description: Name of the external network which management network will connect to
28     default: admin_floating_net
29
30 resources:
31   flavor:
32     type: OS::Nova::Flavor
33     properties:
34       ram: 4096
35       vcpus: 4
36       disk: 4
37
38   network:
39     type: OS::Neutron::Net
40     properties:
41       name: dpdk_net
42
43   subnet:
44     type: OS::Neutron::Subnet
45     properties:
46       name: dpdk_subnet
47       ip_version: 4
48       cidr: 192.168.0.0/24
49       network: { get_resource: network }
50
51   management_router:
52     type: OS::Neutron::Router
53     properties:
54       name: management_router
55       external_gateway_info:
56         network: { get_param: external_net_name }
57
58   management_router_interface:
59     type: OS::Neutron::RouterInterface
60     properties:
61       router: { get_resource: management_router }
62       subnet: { get_resource: subnet }
63
64   floating_ip:
65     type: OS::Neutron::FloatingIP
66     properties:
67       floating_network: { get_param: external_net_name }
68
69   floating_ip_association:
70     type: OS::Nova::FloatingIPAssociation
71     properties:
72       floating_ip: { get_resource: floating_ip }
73       server_id: {get_resource: dpdk_vm}
74
75   keypair:
76     type: OS::Nova::KeyPair
77     properties:
78       name: yardstick-key
79       public_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD0RkXfW6pksd1cZmXuvXZF/Mlqqq3ahIGcGoULOC97XMpu0vdxMpcUwdjwGqMwEXTVyfHidu0l99bLqOCpSUKCmbWx3ONJ+1kqFx4HwsKEWLiyDYqsuMrDeZT1eFjC5avCoTcrIw2wq5NaBb00lDGagNZOeopaL5YIa4+PizEY23+cir24D67NU21Fg3JE92AIeGlNa4j66L3a+lL0hZq74Dilmp42wm4GsbplRO6KJfyaraowHb1X+TmhCjBgHk6M/OJ9yPAroZyJNcwjMAuuxhAYWRuT3SdbnoUR0RG2VhfDh0qNid7vOqLbhKPeaLLFmzkN+9w3WdCp6LbSYt87 yardstick@yardstick.opnfv.org
80
81   wait_handle:
82     type: OS::Heat::WaitConditionHandle
83
84   wait_condition:
85     type: OS::Heat::WaitCondition
86     properties:
87       handle: { get_resource: wait_handle }
88       count: 1
89       timeout: { get_param: timeout }
90
91   dpdk_vm:
92     type: OS::Nova::Server
93     depends_on: [subnet, keypair, flavor]
94     properties:
95       name: { get_param: "OS::stack_name" }
96       image: { get_param: image }
97       flavor: { get_resource: flavor }
98       key_name: {get_resource: keypair}
99       networks:
100         - network: { get_resource: network }
101       config_drive: True
102       user_data_format : RAW
103       user_data:
104         str_replace:
105           template: |
106             #!/bin/sh
107             cat <<'CEOF' > /tmp/dpdk_post_build.sh
108             export RTE_SDK=/dpdk
109             export RTE_TARGET=x86_64-native-linuxapp-gcc
110             cd /dpdk
111             make install T=x86_64-native-linuxapp-gcc DESTDIR=destdir
112             modprobe uio
113             insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
114             insmod /dpdk/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko
115             cd /pktgen-dpdk
116             make RTE_SDK=/dpdk
117             echo "PCKTGEN BUILT"
118             rm -rf /var/lib/cloud/instances
119             echo "rm succesfull"
120             ls /dpdk/x86_64-native-linuxapp-gcc/kmod/
121             $NOTIFY --data-binary '{"status": "SUCCESS"}'
122             CEOF
123             chmod +x /tmp/dpdk_post_build.sh
124             echo "chmod"
125             nohup /tmp/dpdk_post_build.sh &
126           params:
127             $NOTIFY: { get_attr: ['wait_handle', 'curl_cli'] }
128
129 outputs:
130   vm_uuid:
131     description: uuid of the VM
132     value: { get_attr: [ dpdk_vm, show,id ] }