1 # Copyright (c) 2016-2017 Intel Corporation
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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 deploy a virtual Traffic Classifier
32 description: Timeout for WaitCondition, depends on your image and environment
37 type: OS::Heat::WaitCondition
39 handle: {get_resource: wait_handle}
41 timeout: {get_param: timeout}
44 type: OS::Heat::WaitConditionHandle
46 ### DEFAULT NETWORK FOR MNGM
48 type: OS::Neutron::Port
50 network: { get_param: default_net }
51 binding:vnic_type: normal
53 - subnet: { get_param: default_subnet }
55 ### NETWORK FOR RECEIVING TRAFFIC
57 type: OS::Neutron::Port
59 network: { get_param: source_net }
60 binding:vnic_type: #vnic_type
62 - subnet: { get_param: source_subnet }
64 ### NETWORK FOR SENDING TRAFFIC
66 type: OS::Neutron::Port
68 network: { get_param: destination_net }
69 binding:vnic_type: #vnic_type
71 - subnet: { get_param: destination_subnet }
74 type: OS::Nova::Server
77 #key_name: { get_param: key_name }
84 echo "Creating custom user..."
85 useradd clouduser -g admin -s /bin/bash -m
86 echo clouduser:yardstick | chpasswd
87 echo "Enabling ssh password login..."
88 sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
98 # Fix Network Confiuration
99 sed -i 's/localhost/localhost vtc/g' /etc/hosts
100 touch /etc/resolvconf/resolv.conf.d/tail
101 #echo 'nameserver 192.168.10.1' > /etc/resolvconf/resolv.conf.d/tail
102 #echo 'nameserver 10.20.0.2' > /etc/resolvconf/resolv.conf.d/tail
103 echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
107 echo 'nameserver 10.118.32.193' > /etc/resolv.conf
110 # Install vTC Dependencies
112 apt-get install -y git build-essential gcc libnuma-dev bison flex byacc libjson0-dev libcurl4-gnutls-dev jq dh-autoreconf libpcap-dev libpulse-dev libtool pkg-config
113 apt-get install -y byacc libtool libcurl4-openssl-dev
118 echo mgroup from eth1 group 224.192.16.1 > /etc/smcroute.conf
119 git clone https://github.com/troglobit/smcroute.git
121 git reset --hard c3f5c56
122 sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
123 sed -i 's/automake-1.11/automake/g' ./autogen.sh
130 echo "#!/bin/bash" > multicast.sh
131 echo "while [ true ]" >> multicast.sh
132 echo "do" >> multicast.sh
133 echo " smcroute -k" >> multicast.sh
134 echo " smcroute -d" >> multicast.sh
135 echo " sleep 50" >> multicast.sh
136 echo "done" >> multicast.sh
137 chmod +x multicast.sh
141 curl -X POST -u "mPkgwvJPsTFS8hYmHk:SDczcrK4cvnkMRWSEchB3ANcWbqFXqPx" https://bitbucket.org/site/oauth2/access_token -d grant_type=refresh_token -d refresh_token=38uFQuhEdPvCTbhc7k >> resp.json
142 access_token=`jq -r '.access_token' resp.json`
143 git clone https://x-token-auth:${access_token}@bitbucket.org/akiskourtis/vtc.git
145 git checkout -b stable
150 NDPI_INCLUDE=$(pwd)/src/include
157 #Build PF_RING library
161 #Build PF_RING examples, including the modified pfbridge, with nDPI integrated.
162 cd userland/examples/
163 sed -i 's#EXTRA_LIBS =#EXTRA_LIBS='"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c#' ./Makefile
164 sed -i 's# -Ithird-party# -Ithird-party/ -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'#' ./Makefile
171 # To use PF_RING driver use the following
173 #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=16384 enable_debug=1 quick_mode=1 enable_tx_capture=0
174 #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
177 # To use the Linux kernel driver use the following
179 sudo nohup ./vtc/nDPI/example/ndpiReader -i eth1 -a eth2 &
182 curl --data-ascii "{\"classification_rules\":[{\"RuleId\":\"1\",\"ToS\":\"16\"}]}" http://localhost:9999/classifier/classification_rules/224.192.16.1 &
183 wc_notify --data-binary '{"status": "SUCCESS"}'
185 wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
186 #$IP_FAMILY: { get_param: ip_family }
189 - port: { get_resource: port_1 }
190 - port: { get_resource: port_2 }
191 - port: { get_resource: port_3 }