Update missing license headers
[yardstick.git] / yardstick / vTC / apexlake / tests / data / generated_templates / experiment_2.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    default_net:
19       type: string
20    default_subnet:
21       type: string
22    source_net:
23       type: string
24    source_subnet:
25       type: string
26    destination_net:
27       type: string
28    destination_subnet:
29       type: string
30    internal_net:
31       type: string
32    internal_subnet:
33       type: string
34    node:
35       type: string
36       default: compB
37    name:
38       type: string
39       default: vtc
40    ip_family:
41       type: string
42    timeout:
43       type: number
44       description: Timeout for WaitCondition, depends on your image and environment
45       default: 1000
46
47 resources:
48    wait_condition:
49       type: OS::Heat::WaitCondition
50       properties:
51          handle: {get_resource: wait_handle}
52          count: 1
53          timeout: {get_param: timeout}
54
55    wait_handle:
56       type: OS::Heat::WaitConditionHandle
57
58
59    ### DEFAULT NETWORK FOR MERLIN DATA
60    port_1:
61       type: OS::Neutron::Port
62       properties:
63          network: { get_param: default_net }
64          binding:vnic_type: normal
65          fixed_ips:
66             - subnet: { get_param: default_subnet }
67
68    ### NETWORK FOR RECEIVING TRAFFIC
69    port_2:
70       type: OS::Neutron::Port
71       properties:
72          network: { get_param: source_net }
73          binding:vnic_type: direct
74          fixed_ips:
75             - subnet: { get_param: source_subnet }
76
77    ### NETWORK FOR SENDING TRAFFIC
78    port_3:
79       type: OS::Neutron::Port
80       properties:
81          network: { get_param: destination_net }
82          binding:vnic_type: direct
83          fixed_ips:
84             - subnet: { get_param: destination_subnet }
85
86    flavor:
87       type: OS::Nova::Flavor
88       properties:
89          disk: 20
90          ram: 1024
91          vcpus: 2
92          #extra_specs: { node: { get_param: node }, "hw:cpu_policy": "#core_pinning_enabled", "hw:cpu_threads_policy": "#core_pinning_mode", "hw:mem_page_size": "#hugepages" }
93          extra_specs: { node: { get_param: node } }
94
95    server:
96       type: OS::Nova::Server
97       properties:
98          name: vTC
99          key_name: test
100          image: ubuntu1404
101          user_data:
102                 str_replace:
103                     template: |
104                         #!/bin/sh
105
106                         # Creation of a user
107                         NAME=$name
108                         echo "Creating custom user..."
109                         useradd clouduser -g admin -s /bin/bash -m
110                         echo clouduser:secrete | chpasswd
111                         echo "Enabling ssh password login..."
112                         sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
113                         service ssh restart
114                         sleep 1
115
116                         # wake up interfaces
117                         ifconfig eth1 up
118                         ifconfig eth2 up
119                         dhclient eth1
120                         dhclient eth2
121
122                         sed -i 's/localhost/localhost vtc/g' /etc/hosts
123                         ip route del 0/0
124                         route add default gw 192.168.200.1
125
126                         AA=$(netstat -ie | grep -B1 $IP_FAMILY | awk '{ print $1 }')
127                         BB=$(echo $AA | awk '{ print $1 }')
128
129                         # Setup Instrumentation Agent
130                         rm -rf cimmaron
131                         mkdir cimmaron
132                         cd cimmaron
133                         apt-get install -y zip
134                         wget http://10.2.1.65/~iolie/merlin/MerlinAgent-12-06-2015-TNovaVM-001.zip
135                         unzip MerlinAgent-12-06-2015-TNovaVM-001.zip
136                         ./updateConfiguration.py ./instrumentation.cfg tags source=tnova_vm
137                         ./updateConfiguration.py ./instrumentation.cfg tags role="$NAME"
138                         nohup ./Agent.py ./instrumentation.cfg >log.out 2>&1 &
139                         cd ..
140
141                         # Setup for PF_RING and bridge between interfaces
142                         apt-get update
143                         apt-get install -y git build-essential gcc libnuma-dev flex byacc libjson0-dev dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
144
145                         # Setup multicast
146                         echo smcroute -d mgroup from $BB group 224.192.16.1 > /etc/smcroute.conf
147                         cd /home/clouduser/
148                         git clone https://github.com/troglobit/smcroute.git
149                         cd smcroute
150                         sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
151                         sed -i 's/automake-1.11/automake/g' ./autogen.sh
152                         ./autogen.sh
153                         ./configure
154                         make
155                         make install
156                         cd ..
157                         touch multicast.sh
158                         echo "#!/bin/bash" > multicast.sh
159                         echo "while [ true ]" >> multicast.sh
160                         echo "do" >> multicast.sh
161                         echo "  smcroute -k" >> multicast.sh
162                         echo "  smcroute -d" >> multicast.sh
163                         echo "  sleep 50" >> multicast.sh
164                         echo "done" >> multicast.sh
165                         chmod +x multicast.sh
166                         ./multicast.sh &
167
168                         # Setup for PF_RING and bridge between interfaces
169                         # Akis Repository
170                         #git clone https://akiskourtis:ptindpi@bitbucket.org/akiskourtis/vtc.git
171                         #cd vtc
172                         #git checkout stable
173
174                         # Intel Repository
175                         git clone http://vincenzox.m.riccobene%40intel.com:vincenzo@134.191.243.6:8081/t-nova/vtc_master.git
176                         cd vtc_master
177
178                         cd nDPI
179                         NDPI_DIR=$(pwd)
180                         echo $NDPI_DIR
181                         NDPI_INCLUDE=$(pwd)/src/include
182                         echo $NDPI_INCLUDE
183                         ./autogen.sh
184                         ./configure
185                         make
186                         make install
187                         cd ..
188                         cd PF_RING
189                         make
190                         cd userland/examples/
191                         sed -i 's/EXTRA_LIBS =/EXTRA_LIBS = '"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c/g' ./Makefile
192                         sed -i 's/ -Ithird-party/ -Ithird-party -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'/g' ./Makefile
193                         make
194                         cd ../..
195                         cd ..
196                         cd ..
197                         #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
198                         #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
199                         insmod ./vtc_master/PF_RING/kernel/pf_ring.ko min_num_slots=8192 enable_debug=1 quick_mode=1 enable_tx_capture=0
200                         ./vtc_master/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
201                         wc_notify --data-binary '{"status": "SUCCESS"}'
202                     params:
203                         wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
204                         $name: { get_param: name }
205                         $IP_FAMILY: { get_param: ip_family }
206
207          flavor: { get_resource: flavor }
208          networks:
209             - port: { get_resource: port_1 }
210             - port: { get_resource: port_2 }
211             - port: { get_resource: port_3 }
212 outputs: