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