add timestamp to the alb-test script, create time series graph for the...

add timestamp to the alb-test script, create time series graph for the whitelist data loss evaluation
parent f578b831
......@@ -13,6 +13,7 @@ sys.path = ['../'] + sys.path
import os
import random
import json
import time
from time import sleep
from optparse import OptionParser
from subprocess import Popen, PIPE
......@@ -194,6 +195,8 @@ def bandwidthTest(bw=5, controllerip="localhost"):
for m in monitors:
m.start();
start_time = time.time();
#start the traffic generation wait for 5 seconds (H1->H3)
h2_tg_cmd = 'bittwist -i h2-eth0 -m 0 -r 1 -s 800 ../pcap/net-2009-11-14-09-24.pcap &'
print "iperf server @H3"
......@@ -208,7 +211,8 @@ def bandwidthTest(bw=5, controllerip="localhost"):
print "wait for configs to take effect 5s delay"
sleep(5)
if opts.disable == False:
print "Traffic generation from H1 -> H3 started"
now = time.time();
print "[second:%d] Traffic generation from H1 -> H3 started" % (int(now-start_time))
print h1_tg_cmd
h1.cmd(h1_tg_cmd)
......@@ -216,6 +220,8 @@ def bandwidthTest(bw=5, controllerip="localhost"):
print "Sleeping for %d seconds before TAP is applied" % sleep_time
sleep(sleep_time)
now = time.time();
print "[second:%d] TAP started" % (int(now-start_time))
p = Popen(("./bwTestAlbWhiteListTapFlow.sh %s" % controllerip), shell=True, stdout=PIPE, stderr=PIPE)
out, err = p.communicate()
print out
......@@ -228,6 +234,8 @@ def bandwidthTest(bw=5, controllerip="localhost"):
if opts.whitelist == True:
print "Sleeping for %d seconds before Whitelisting TCP traffic between H1->H3" % sleep_time
sleep(sleep_time)
now = time.time();
print "[second:%d] Whitelist started" % (int(now-start_time))
p = Popen(("./bwSimAlbWhiteListFlow.sh %s" % controllerip), shell=True, stdout=PIPE, stderr=PIPE)
out, err = p.communicate()
print out
......@@ -242,6 +250,8 @@ def bandwidthTest(bw=5, controllerip="localhost"):
sleep(sleep_time)
print "Playing the trace file"
now = time.time();
print "[second:%d] Source 2 started" % (int(now-start_time))
print h2_tg_cmd
h2.cmd(h2_tg_cmd)
......
To get the ground truth traffic graph:
./drawEvtGraph.sh ground-truth/txrate0.csv ground
To get the traffic graph with whitelisting
./drawEvtGraph.sh with-whitelist/txrate0.csv white
To get the traffic graph without whitelisting
./drawEvtGraph.sh without-whitelist/txrate0.csv nowhite
#!/bin/bash -x
ep_csv_input=$1
output_name=$2
start_timestamp=`head -1 $ep_csv_input | cut -d',' -f1`
export start_timestamp
src1_filename="src1.data"
src2_filename="src2.data"
dst_filename="dst.data"
tap_filename="tap.data"
output_filename="${output_name}.pdf"
#filed :1 timestamp, 3:bytes_out, 4:bytes_in, 8:total_packets, 9:errors_out, 10:errors_in
grep "s1-eth1" $ep_csv_input | cut -d',' -f1,3,4,9,10 | sort -u -g --output=$src1_filename
grep "s1-eth2" $ep_csv_input | cut -d',' -f1,3,4,9,10 | sort -u -g --output=$src2_filename
grep "s2-eth2" $ep_csv_input | cut -d',' -f1,3,4,9,10 | sort -u -g --output=$dst_filename
grep "s3-eth2" $ep_csv_input | cut -d',' -f1,3,4,9,10 | sort -u -g --output=$tap_filename
src1_start_second=5
tap_start_second=25
white_start_second=105
src2_start_second=115
white_end_second=$((white_start_second+60))
export src1_filename
export src2_filename
export dst_filename
export tap_filename
export output_filename
export src1_start_second
export src2_start_second
export tap_start_second
export white_start_second
export white_end_second
./evt_gnu_graph.scr
rm -vf $src1_filename $src2_filename $dst_filename $tap_filename
#!/usr/bin/gnuplot
src1_input="`echo $src1_filename`"
src2_input="`echo $src2_filename`"
dst_input="`echo $dst_filename`"
tap_input="`echo $tap_filename`"
output_filename="`echo $output_filename`"
start_timestamp="`echo $start_timestamp`"
service1_timestamp="`echo $src1_start_second`"
service2_timestamp="`echo $src2_start_second`"
tap_timestamp="`echo $tap_start_second`"
white_start_timestamp="`echo $white_start_second`"
white_end_timestamp="`echo $white_end_second`"
set terminal pdfcairo enhanced font "Times-Roman,20" size 12,18
set output output_filename
set timefmt '%s'
set datafile separator ","
set title "Event Series Graph"
set grid
set yrange [0:5]
set ytics 1
set xrange [0:250]
set xtics 50
set multiplot layout 4,1 columnsfirst
set style arrow 1 lt 4 lw 2
set style arrow 2 lt 1 lw 1
set style arrow 5 heads filled size screen 0.03,5,5 ls 1
set style func linespoints
set style line 1 lt 2 lc rgb "black" lw 3
set style line 2 lt 2 lc rgb "blue" lw 3
set style line 3 lt 2 lc rgb "yellow" lw 2
set style line 4 lt 2 lc rgb "orange" lw 2
set key autotitle column
set key on left
#event arrows
y=2
d=10 #displacement
x=service1_timestamp
set arrow from x,0 to x,y as 1
set label 1 "Event 1" at x-d,y font "Times-Roman,20"
x=tap_timestamp
set arrow from x,0 to x,y as 1
set label 2 "Event 2" at x-d,y font "Times-Roman,20"
x=service2_timestamp
set arrow from x,0 to x,y as 1
set label 3 "Event 3" at x-d,y font "Times-Roman,20"
y=3
x=white_start_timestamp
set arrow from x,0 to x,y as 1
set label 4 "WhiteStart" at x-d,y font "Times-Roman,20"
x=white_end_timestamp
set arrow from x,0 to x,y as 1
set label 5 "WhiteEnd" at x-d,y font "Times-Roman,20"
y=2.5
set arrow from white_start_timestamp,y to white_end_timestamp,y as 5
set label 6 "60 sec" at white_start_timestamp+27,y+0.1 font "Times-Roman,20"
ysize = 0.5
xsize = 1
set title "(a) TCP Source Traffic Activity"
set ylabel "Mb/s out"
plot src1_input using ($1-start_timestamp):(($2*8)/(1024*1024)) title 'out' with lines ls 1 , \
src1_input using ($1-start_timestamp):(($3*8)/(1024*1024)) title 'in' with lines ls 2 , \
src1_input using ($1-start_timestamp):(($4*8)/(1024*1024)) title 'error-out' with lines ls 3 , \
src1_input using ($1-start_timestamp):(($5*8)/(1024*1024)) title 'error-in' with lines ls 4
set title "(b) PCAP Replay Source Traffic Activity"
set ylabel "Mb/s out"
plot src2_input using ($1-start_timestamp):(($2*8)/(1024*1024)) title 'out' with lines ls 1 , \
src2_input using ($1-start_timestamp):(($3*8)/(1024*1024)) title 'in' with lines ls 2 , \
src2_input using ($1-start_timestamp):(($4*8)/(1024*1024)) title 'error-out' with lines ls 3 , \
src2_input using ($1-start_timestamp):(($5*8)/(1024*1024)) title 'error-in' with lines ls 4
set title "(c) Destination Traffic Activity"
set ylabel "Mb/s out"
plot dst_input using ($1-start_timestamp):(($2*8)/(1024*1024)) title 'out' with lines ls 1 , \
dst_input using ($1-start_timestamp):(($3*8)/(1024*1024)) title 'in' with lines ls 2 , \
dst_input using ($1-start_timestamp):(($4*8)/(1024*1024)) title 'error-out' with lines ls 3 , \
dst_input using ($1-start_timestamp):(($5*8)/(1024*1024)) title 'error-in' with lines ls 4
set title "(d) Enterprise Network Gateway Traffic Activity"
set ylabel "Mb/s out"
set xlabel "Time"
plot tap_input using ($1-start_timestamp):(($2*8)/(1024*1024)) title 'out' with lines ls 1 , \
tap_input using ($1-start_timestamp):(($3*8)/(1024*1024)) title 'in' with lines ls 2 , \
tap_input using ($1-start_timestamp):(($4*8)/(1024*1024)) title 'error-out' with lines ls 3 , \
tap_input using ($1-start_timestamp):(($5*8)/(1024*1024)) title 'error-in' with lines ls 4
unset multiplot
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment