1 heat_template_version: 2014-10-16
2 description: HOT template to deploy a vitual Traffic Classifier
19 description: Timeout for WaitCondition, depends on your image and environment
24 type: OS::Heat::WaitCondition
26 handle: {get_resource: wait_handle}
28 timeout: {get_param: timeout}
31 type: OS::Heat::WaitConditionHandle
33 ### DEFAULT NETWORK FOR MNGM
35 type: OS::Neutron::Port
37 network: { get_param: default_net }
38 binding:vnic_type: normal
40 - subnet: { get_param: default_subnet }
42 ### NETWORK FOR RECEIVING TRAFFIC
44 type: OS::Neutron::Port
46 network: { get_param: source_net }
47 binding:vnic_type: #vnic_type
49 - subnet: { get_param: source_subnet }
51 ### NETWORK FOR SENDING TRAFFIC
53 type: OS::Neutron::Port
55 network: { get_param: destination_net }
56 binding:vnic_type: #vnic_type
58 - subnet: { get_param: destination_subnet }
61 type: OS::Nova::Server
64 #key_name: { get_param: key_name }
71 echo "Creating custom user..."
72 useradd clouduser -g admin -s /bin/bash -m
73 echo clouduser:secrete | chpasswd
74 echo "Enabling ssh password login..."
75 sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
85 # Install vTC Dependencies
87 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
88 apt-get install -y byacc libtool libcurl4-openssl-dev
90 sed -i 's/localhost/localhost vtc/g' /etc/hosts
94 echo mgroup from eth1 group 224.192.16.1 > /etc/smcroute.conf
95 git clone https://github.com/troglobit/smcroute.git
97 sed -i 's/aclocal-1.11/aclocal/g' ./autogen.sh
98 sed -i 's/automake-1.11/automake/g' ./autogen.sh
105 echo "#!/bin/bash" > multicast.sh
106 echo "while [ true ]" >> multicast.sh
107 echo "do" >> multicast.sh
108 echo " smcroute -k" >> multicast.sh
109 echo " smcroute -d" >> multicast.sh
110 echo " sleep 50" >> multicast.sh
111 echo "done" >> multicast.sh
112 chmod +x multicast.sh
116 curl -X POST -u "mPkgwvJPsTFS8hYmHk:SDczcrK4cvnkMRWSEchB3ANcWbqFXqPx" https://bitbucket.org/site/oauth2/access_token -d grant_type=refresh_token -d refresh_token=38uFQuhEdPvCTbhc7k >> resp.json
117 access_token=`jq -r '.access_token' resp.json`
118 git clone https://x-token-auth:${access_token}@bitbucket.org/akiskourtis/vtc.git
120 git checkout -b stable
125 NDPI_INCLUDE=$(pwd)/src/include
132 #Build PF_RING library
136 #Build PF_RING examples, including the modified pfbridge, with nDPI integrated.
137 cd userland/examples/
138 sed -i 's#EXTRA_LIBS =#EXTRA_LIBS='"${NDPI_DIR}"'/src/lib/.libs/libndpi.a -ljson-c#' ./Makefile
139 sed -i 's# -Ithird-party# -Ithird-party/ -I'"$NDPI_INCLUDE"' -I'"$NDPI_DIR"'#' ./Makefile
146 # To use PF_RING driver use the following
148 #insmod ./vtc/PF_RING/kernel/pf_ring.ko min_num_slots=16384 enable_debug=1 quick_mode=1 enable_tx_capture=0
149 #./vtc/PF_RING/userland/examples/pfbridge -a eth1 -b eth2 &
152 # To use the Linux kernel driver use the following
154 sudo nohup ./vtc/nDPI/example/ndpiReader -i eth1 -a eth2 &
157 curl --data-ascii "{\"classification_rules\":[{\"RuleId\":\"1\",\"ToS\":\"16\"}]}" http://localhost:9999/classifier/classification_rules/224.192.16.1 &
158 wc_notify --data-binary '{"status": "SUCCESS"}'
160 wc_notify: { get_attr: ['wait_handle', 'curl_cli'] }
161 #$IP_FAMILY: { get_param: ip_family }
164 - port: { get_resource: port_1 }
165 - port: { get_resource: port_2 }
166 - port: { get_resource: port_3 }