Complete all the code and files required to run ApexLake
[yardstick.git] / yardstick / vTC / apexlake / heat_templates / stress_workload.yaml
1 heat_template_version: 2014-10-16
2 description: HOT template to create a DPI
3
4 parameters:
5    nic_type:
6       type: string
7       default: normal
8    name:
9       type: string
10       default: cpu_stress
11    cores:
12        type: string
13    memory:
14        type: string
15
16 resources:
17    internal_net:
18       type: OS::Neutron::Net
19       properties:
20          name: traffic_network
21    internal_subnet:
22       type: OS::Neutron::Subnet
23       properties:
24          network_id: { get_resource: internal_net }
25          cidr: 10.100.0.0/24
26
27    router:
28       properties:
29          admin_state_up: true
30          name: router
31       type: OS::Neutron::Router
32
33    router_gateway:
34       properties:
35          network: external
36          router_id: { get_resource: router }
37       type: OS::Neutron::RouterGateway
38
39    router_interface_0:
40       properties:
41          router_id: { get_resource: router }
42          subnet_id: { get_resource: internal_subnet }
43       type: OS::Neutron::RouterInterface
44
45    vm1_port_1:
46       type: OS::Neutron::Port
47       properties:
48          network: { get_resource: internal_net }
49          binding:vnic_type: { get_param: nic_type }
50          fixed_ips:
51             - subnet: { get_resource: internal_subnet }
52
53    flavor_1:
54       type: OS::Nova::Flavor
55       properties:
56          disk: 20
57          ram: 4096
58          vcpus: 4
59
60    vm1:
61       type: OS::Nova::Server
62       properties:
63          name: traffic_vm1
64          key_name: test
65          image: ubuntu1404
66          user_data:
67             str_replace:
68                template: |
69                   #!/bin/sh
70                   echo "Creating custom user..."
71                   useradd clouduser -g admin -s /bin/bash -m
72                   echo clouduser:secrete | chpasswd
73                   echo "Enabling ssh password login..."
74                   sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
75                   service ssh restart
76                   sleep 1
77
78                   ifconfig eth1 up
79                   dhclient eth1
80
81                   sed -i 's/localhost/localhost traffic_vm1/g' /etc/hosts
82                   touch /etc/resolfconf/resolv.conf.d/tail
83                   echo 'nameserver 8.8.8.8' > /etc/resolvconf/resolv.conf.d/tail
84                   resolvconf -u
85
86                   # Installation of stress
87                   apt-get install -y stress
88
89                   cd /home/clouduser
90                   # Setup merlin
91                   rm -rf merlin
92                   mkdir merlin
93                   cd merlin
94                   wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
95                   apt-get install -y zip
96                   unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
97                   ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
98                   ./updateConfiguration.py ./instrumentation.cfg tags role=cpu_stress
99                   nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
100                   cd ..
101
102                   # workload setup
103                   nohup stress -c #CORES --vm-bytes #MEMORY
104
105                params:
106                   $NAME: { get_param: name }
107                   $CORES: { get_param: cores }
108                   $MEMORY: { get_param: memory }
109
110          flavor: { get_resource: flavor_1 }
111          networks:
112             - port: { get_resource: vm1_port_1 }