Merge "pktgen: speedup unittest, mock time.sleep"
[yardstick.git] / yardstick / vTC / apexlake / heat_templates / stress_workload.yaml
1 # Copyright (c) 2016-2017 Intel Corporation
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 heat_template_version: 2014-10-16
15 description: HOT template to create a DPI
16
17 parameters:
18    name:
19       type: string
20       default: cpu_stress
21    cores:
22        type: string
23    memory:
24        type: string
25    network:
26        type: string
27    subnet:
28        type: string
29
30 resources:
31    port:
32       type: OS::Neutron::Port
33       properties:
34          network: { get_param: network }
35          fixed_ips:
36             - subnet: { get_param: subnet }
37
38    vm1:
39       type: OS::Nova::Server
40       properties:
41          name: traffic_vm1
42          image: ubuntu1404
43          user_data:
44             str_replace:
45                template: |
46                   #!/bin/sh
47                   echo "Creating custom user..."
48                   useradd clouduser -g admin -s /bin/bash -m
49                   echo clouduser:secrete | chpasswd
50                   echo "Enabling ssh password login..."
51                   sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
52                   service ssh restart
53                   sleep 1
54
55                   ifconfig eth1 up
56                   dhclient eth1
57
58                   sed -i 's/localhost/localhost traffic_vm1/g' /etc/hosts
59                   touch /etc/resolvconf/resolv.conf.d/tail
60                   echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
61                   resolvconf -u
62                   echo 'nameserver 10.118.32.193' > /etc/resolv.conf
63
64
65                   # Installation of stress
66                   apt-get install -y stress
67
68                   cd /home/clouduser
69
70                   # workload setup
71                   echo 'stress -c $CORES --vm-bytes $MEMORY' > ./stress.sh
72                   chmod +x ./stress.sh
73                   nohup ./stress.sh &
74                   #nohup stress -c #CORES --vm-bytes #MEMORY
75
76                params:
77                   $NAME: { get_param: name }
78                   $CORES: { get_param: cores }
79                   $MEMORY: { get_param: memory }
80
81          flavor: m1.small
82          networks:
83             - port: { get_resource: port }