1 ##############################################################################
2 # Copyright (c) 2017 user@TRAFCLASS-PACKET1.fuel.local and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 heat_template_version: 2014-10-16
10 description: HOT template to deploy a virtual Traffic Classifier
27 description: Timeout for WaitCondition, depends on your image and environment
32 type: OS::Heat::WaitCondition
34 handle: {get_resource: wait_handle}
36 timeout: {get_param: timeout}
39 type: OS::Heat::WaitConditionHandle
41 ### DEFAULT NETWORK FOR MNGM
43 type: OS::Neutron::Port
45 network: { get_param: default_net }
46 binding:vnic_type: normal
47 port_security_enabled: true
49 - subnet: { get_param: default_subnet }
51 ### NETWORK FOR RECEIVING TRAFFIC
53 type: OS::Neutron::Port
55 network: { get_param: source_net }
56 binding:vnic_type: #vnic_type
57 port_security_enabled: false
59 - subnet: { get_param: source_subnet }
61 ### NETWORK FOR SENDING TRAFFIC
63 type: OS::Neutron::Port
65 network: { get_param: destination_net }
66 binding:vnic_type: #vnic_type
67 port_security_enabled: false
69 - subnet: { get_param: destination_subnet }
72 type: OS::Nova::Server
75 #key_name: { get_param: key_name }
82 echo "Creating custom user..."
83 useradd clouduser -g admin -s /bin/bash -m
84 echo clouduser:yardstick | chpasswd
85 echo "Enabling ssh password login..."
86 sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
95 ifconfig 10.254.254.253 up netmask 255.255.255.248
97 # Fix Network Confiuration
98 sed -i 's/localhost/localhost vtc/g' /etc/hosts
99 touch /etc/resolvconf/resolv.conf.d/tail
100 #echo 'nameserver 192.168.10.1' > /etc/resolvconf/resolv.conf.d/tail
101 #echo 'nameserver 10.20.0.2' > /etc/resolvconf/resolv.conf.d/tail
102 echo 'nameserver 10.118.32.193' > /etc/resolvconf/resolv.conf.d/tail
106 echo 'nameserver 10.118.32.193' > /etc/resolv.conf
109 # Install vTC Dependencies
111 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
112 apt-get install -y byacc libtool libcurl4-openssl-dev
117 echo mgroup from eth1 group 224.192.16.1 > /etc/smcroute.conf
118 git clone https://github.com/troglobit/smcroute.git
120 git reset --hard c3f5c56
121 sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
122 sed -i 's/automake-1.11/automake/g' ./autogen.sh
129 echo "#!/bin/bash" > multicast.sh
130 echo "while [ true ]" >> multicast.sh
131 echo "do" >> multicast.sh
132 echo " smcroute -k" >> multicast.sh
133 echo " smcroute -d" >> multicast.sh
134 echo " sleep 50" >> multicast.sh
135 echo "done" >> multicast.sh
136 chmod +x multicast.sh
140 curl -X POST -u "mPkgwvJPsTFS8hYmHk:SDczcrK4cvnkMRWSEchB3ANcWbqFXqPx" https://bitbucket.org/site/oauth2/access_token -d grant_type=refresh_token -d refresh_token=38uFQuhEdPvCTbhc7k >> resp.json
141 access_token=`jq -r '.access_token' resp.json`
142 git clone https://x-token-auth:${access_token}@bitbucket.org/akiskourtis/vtc.git
144 git checkout -b stable
149 NDPI_INCLUDE=$(pwd)/src/include
156 #Build PF_RING library
160 #Build PF_RING examples, including the modified pfbridge, with nDPI integrated.
161 cd userland/examples/
162 sed -i 's#EXTRA_LIBS =#EXTRA_LIBS='"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c#' ./Makefile
163 sed -i 's# -Ithird-party# -Ithird-party/ -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'#' ./Makefile
170 # To use PF_RING driver use the following
172 #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=16384 enable_debug=1 quick_mode=1 enable_tx_capture=0
173 #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
176 # To use the Linux kernel driver use the following
178 sudo nohup ./vtc/nDPI/example/ndpiReader -i eth1 -a eth2 &
181 curl --data-ascii "{\"classification_rules\":[{\"RuleId\":\"1\",\"ToS\":\"16\"}]}" http://localhost:9999/classifier/classification_rules/224.192.16.1 &
182 wc_notify --data-binary '{"status": "SUCCESS"}'
184 wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
185 #$IP_FAMILY: { get_param: ip_family }
188 - port: { get_resource: port_1 }
189 - port: { get_resource: port_2 }
190 - port: { get_resource: port_3 }