Measuring Tools and Scripts » History » Version 19

GAY, Adrien, 12/15/2014 10:41 PM

1 3 Cuadro, Juan Pablo
h1. Measuring Tools
2 1 Cuadro, Juan Pablo
3 4 Cuadro, Juan Pablo
-----
4 4 Cuadro, Juan Pablo
5 3 Cuadro, Juan Pablo
h2. EL470
6 1 Cuadro, Juan Pablo
7 13 GAY, Adrien
The Newtec EL470 versions that Telecom Bretagne owns have no protocol testing capabilities. However, when in ACM mode, the ACM controller (the HUB) keeps a log file containing the modulation and coding schemes as well as bitrate and Es/N0 estimated . The log files are stored as .csv (Comma Separated Values). These are created per six hours intervals and a log file history of the previous 24hours can be consulted. An example can be seen below:
8 1 Cuadro, Juan Pablo
9 1 Cuadro, Juan Pablo
<pre>
10 1 Cuadro, Juan Pablo
Timestamp,Demod,RqModCod,EsNo,CarrierBitrate
11 14 GAY, Adrien
2014-12-12 15:04:58,1,16APSK-2/3,11.30,1445835
12 14 GAY, Adrien
2014-12-12 15:05:10,1,16APSK-2/3,11.20,1445835
13 2 Cuadro, Juan Pablo
2014-12-12 15:05:24,1,16APSK-2/3,10.72,1324072
14 2 Cuadro, Juan Pablo
2014-12-12 15:05:28,1,16APSK-2/3,10.61,1324072
15 2 Cuadro, Juan Pablo
2014-12-12 15:05:31,1,16APSK-2/3,10.66,1324072
16 2 Cuadro, Juan Pablo
2014-12-12 15:05:34,1,8PSK-3/4,10.19,1313479
17 2 Cuadro, Juan Pablo
2014-12-12 15:05:37,1,8PSK-3/4,11.87,1313479
18 2 Cuadro, Juan Pablo
2014-12-12 15:05:41,1,8PSK-3/4,10.40,1313479
19 1 Cuadro, Juan Pablo
2014-12-12 15:06:47,1,QPSK-5/6,6.93,884389
20 2 Cuadro, Juan Pablo
2014-12-12 15:06:51,1,QPSK-5/6,8.18,884389
21 14 GAY, Adrien
2014-12-12 15:06:54,1,QPSK-5/6,7.02,825503
22 1 Cuadro, Juan Pablo
</pre>
23 1 Cuadro, Juan Pablo
24 14 GAY, Adrien
It is unclear though what the sampling frequency is. We have determined that this rate depends on the rate at which Es/N0 estimates change. From the csv file we can extract the following information:
25 1 Cuadro, Juan Pablo
26 1 Cuadro, Juan Pablo
* Timestamp (in seconds)
27 1 Cuadro, Juan Pablo
* Modcod parameter (modulation + coding rate)
28 1 Cuadro, Juan Pablo
* Estimate of E ~s~ / N ~0~
29 1 Cuadro, Juan Pablo
* Information bitrate (in bps)
30 1 Cuadro, Juan Pablo
31 9 Cuadro, Juan Pablo
This log file can be accessed through in the FlexACM controller tab. It is the button labeled Controller Log:
32 9 Cuadro, Juan Pablo
33 10 Cuadro, Juan Pablo
p=. !{width: 70%}FlexController.png!
34 9 Cuadro, Juan Pablo
35 9 Cuadro, Juan Pablo
A much simpler way though is to use the following link:
36 9 Cuadro, Juan Pablo
37 9 Cuadro, Juan Pablo
@http://192.168.88.100/cgi-bin/pegui-cgi/cli/cgi+acmcdem?filename=acmcdem.csv@
38 9 Cuadro, Juan Pablo
39 1 Cuadro, Juan Pablo
h2. Traffic generation and capture
40 1 Cuadro, Juan Pablo
41 8 Cuadro, Juan Pablo
In order to measure performance at the application level we will use _Iperf_. _Iperf_ is a tool to generate streams of TCP and UDP traffic as well as measuring throughput and other statistics. It has a client and server functionality, and can measure the throughput between the two ends. For more information and download links as well as documentation check Iperf3's website "here":http://software.es.net/iperf/. In order to have a finer control over the values obtained, we will capture all traffic using _tcpdump_ and perform an offline calculation of throughput using pcaptput.py.
42 3 Cuadro, Juan Pablo
43 3 Cuadro, Juan Pablo
notice. We will generate a UDP data stream in order to test throughput.
44 3 Cuadro, Juan Pablo
45 15 GAY, Adrien
To setup Iperf we will have to launch it on both the HUB PC (as client) and Station PC (as server). Since the HUB PC will be the one sending packets it has to be setup as a client. Likewise, the Station PC must be setup as a server.
46 3 Cuadro, Juan Pablo
47 3 Cuadro, Juan Pablo
<pre><code class="Terminal">
48 3 Cuadro, Juan Pablo
# STATION PC LISTENING ON PORT 5201
49 3 Cuadro, Juan Pablo
50 8 Cuadro, Juan Pablo
$ iperf3 -s -u -i1 -p 5201
51 3 Cuadro, Juan Pablo
------------------------------------------------------------
52 3 Cuadro, Juan Pablo
Server listening on UDP port 5201
53 3 Cuadro, Juan Pablo
Receiving 1470 byte datagrams
54 3 Cuadro, Juan Pablo
UDP buffer size:  192 KByte (default)
55 3 Cuadro, Juan Pablo
------------------------------------------------------------
56 3 Cuadro, Juan Pablo
</code></pre>
57 3 Cuadro, Juan Pablo
58 3 Cuadro, Juan Pablo
<pre><code class="Terminal">
59 3 Cuadro, Juan Pablo
# HUB PC STARTS UDP DATA STREAM DES_PORT = 5201
60 3 Cuadro, Juan Pablo
61 8 Cuadro, Juan Pablo
$ iperf3 -c 10.0.0.130 -u -t <duration in secs> -b <bandwidth> -l <udp size> -p 5201
62 3 Cuadro, Juan Pablo
------------------------------------------------------------
63 3 Cuadro, Juan Pablo
Client connecting to 10.0.0.130, UDP port 5201
64 3 Cuadro, Juan Pablo
Sending <udp size>  byte datagrams
65 3 Cuadro, Juan Pablo
UDP buffer size: 9.00 KByte (default)
66 3 Cuadro, Juan Pablo
------------------------------------------------------------
67 3 Cuadro, Juan Pablo
</code></pre>
68 3 Cuadro, Juan Pablo
69 3 Cuadro, Juan Pablo
At the same time the Station PC must capture all incoming traffic, we will use the following command:
70 1 Cuadro, Juan Pablo
71 3 Cuadro, Juan Pablo
<pre><code class="Terminal">
72 3 Cuadro, Juan Pablo
# CAPTURE INCOMING TRAFFIC
73 8 Cuadro, Juan Pablo
74 3 Cuadro, Juan Pablo
$ tcpdump -w output_file_name.pcap
75 3 Cuadro, Juan Pablo
</code></pre>
76 3 Cuadro, Juan Pablo
77 5 Cuadro, Juan Pablo
78 5 Cuadro, Juan Pablo
79 3 Cuadro, Juan Pablo
h1. Scripts
80 4 Cuadro, Juan Pablo
81 4 Cuadro, Juan Pablo
-----
82 4 Cuadro, Juan Pablo
83 3 Cuadro, Juan Pablo
84 17 GAY, Adrien
In order to process obtained data we have created multiple scripts to parse and display results: 
85 3 Cuadro, Juan Pablo
86 3 Cuadro, Juan Pablo
* *pcaptput.py* : Calculates throughput metrics from .pcap file.
87 19 GAY, Adrien
* *bulk_pcaptput* : Bash script to run pcaptput.py on all measurements and generate .tput files.
88 3 Cuadro, Juan Pablo
* *ConsolidateRun.m* : MATLAB class to import and consolidate .pcap as well as .tput data.
89 3 Cuadro, Juan Pablo
* *bulk_consolidate_results.m* : MATLAB script to generate all graphs in this wiki.
90 3 Cuadro, Juan Pablo
91 18 Cuadro, Juan Pablo
All of these as well as all measurements are contained in attachment:measurements.zip. There is also README for further clarification.
92 3 Cuadro, Juan Pablo
 
93 3 Cuadro, Juan Pablo
h2. pcaptput.py
94 3 Cuadro, Juan Pablo
95 3 Cuadro, Juan Pablo
_pcaptput.py_ is a small python script we wrote in order to calculate application (UDP) throughput  as well as layer 3 end-to-end throughput considering only IP packets (header + payload). It uses the "dpkt":http://code.google.com/p/dpkt/. library which is a "fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols" Python library. 
96 3 Cuadro, Juan Pablo
97 3 Cuadro, Juan Pablo
<pre><code class="Python">
98 3 Cuadro, Juan Pablo
#!/usr/bin/python2.6
99 3 Cuadro, Juan Pablo
100 3 Cuadro, Juan Pablo
# pcaptput.py
101 3 Cuadro, Juan Pablo
102 3 Cuadro, Juan Pablo
import sys, dpkt
103 3 Cuadro, Juan Pablo
if len(sys.argv) != 2:
104 3 Cuadro, Juan Pablo
	raise ValueError('.pcap file needs to be specified.')
105 3 Cuadro, Juan Pablo
106 3 Cuadro, Juan Pablo
filename = sys.argv[1];
107 3 Cuadro, Juan Pablo
udpPort = 5201
108 3 Cuadro, Juan Pablo
tRes = 1
109 3 Cuadro, Juan Pablo
periodn = 0
110 3 Cuadro, Juan Pablo
baseTimeStamp = 0
111 3 Cuadro, Juan Pablo
iter = 0
112 3 Cuadro, Juan Pablo
# Total IP packet counter
113 3 Cuadro, Juan Pablo
ipBitCount = 0
114 3 Cuadro, Juan Pablo
# UDP payload counter
115 3 Cuadro, Juan Pablo
udpBitCount = 0
116 3 Cuadro, Juan Pablo
print 'Time[s]', 'IP-Throughput[bps]', 'UDP-Throughput[bps]'
117 3 Cuadro, Juan Pablo
for timeStamp, buf in dpkt.pcap.Reader(open(filename, 'r')):
118 3 Cuadro, Juan Pablo
	iter += 1
119 3 Cuadro, Juan Pablo
	if iter == 1:
120 3 Cuadro, Juan Pablo
		baseTimeStamp = timeStamp
121 3 Cuadro, Juan Pablo
	# Get ethernet frame
122 3 Cuadro, Juan Pablo
	eth = dpkt.ethernet.Ethernet(buf)
123 3 Cuadro, Juan Pablo
	# Check for pure IP traffic only (no ARP packets)
124 3 Cuadro, Juan Pablo
	if type(eth.data) != dpkt.ip.IP:
125 3 Cuadro, Juan Pablo
		continue
126 3 Cuadro, Juan Pablo
	ip = eth.data
127 3 Cuadro, Juan Pablo
	ts = timeStamp - baseTimeStamp
128 3 Cuadro, Juan Pablo
	# Histogram bins
129 3 Cuadro, Juan Pablo
	if ts >= periodn * tRes:
130 3 Cuadro, Juan Pablo
		print periodn * tRes, ipBitCount / tRes, udpBitCount / tRes
131 3 Cuadro, Juan Pablo
		periodn += 1
132 3 Cuadro, Juan Pablo
		udpBitCount = 0
133 3 Cuadro, Juan Pablo
		ipBitCount = 0
134 3 Cuadro, Juan Pablo
	# Counters
135 3 Cuadro, Juan Pablo
	ipBitCount += ip.len * 8
136 3 Cuadro, Juan Pablo
	if isinstance(ip.data, dpkt.udp.UDP) and (udpPort == ip.data.dport):
137 3 Cuadro, Juan Pablo
		udpBitCount += ip.data.ulen * 8
138 3 Cuadro, Juan Pablo
</code></pre>
139 3 Cuadro, Juan Pablo
140 3 Cuadro, Juan Pablo
Usage is as follows:
141 3 Cuadro, Juan Pablo
142 3 Cuadro, Juan Pablo
<pre><code class="Terminal">
143 3 Cuadro, Juan Pablo
$ ./pcaptput.py input.pcap > output.tput
144 3 Cuadro, Juan Pablo
145 3 Cuadro, Juan Pablo
Time[s] IP-Throughput[bps] UDP-Throughput[bps]
146 3 Cuadro, Juan Pablo
0 0 0
147 3 Cuadro, Juan Pablo
1 4688 0
148 3 Cuadro, Juan Pablo
2 3984 96
149 3 Cuadro, Juan Pablo
3 754720 742944
150 3 Cuadro, Juan Pablo
4 775552 763872
151 3 Cuadro, Juan Pablo
5 860544 847584
152 3 Cuadro, Juan Pablo
6 903040 889440
153 3 Cuadro, Juan Pablo
7 1019904 1004544
154 3 Cuadro, Juan Pablo
8 1083648 1067328
155 3 Cuadro, Juan Pablo
9 1221760 1203360
156 3 Cuadro, Juan Pablo
10 1296128 1276608
157 3 Cuadro, Juan Pablo
11 903040 889440
158 3 Cuadro, Juan Pablo
12 764928 753408
159 3 Cuadro, Juan Pablo
13 807424 795264
160 3 Cuadro, Juan Pablo
14 860544 847584
161 3 Cuadro, Juan Pablo
15 956160 941760
162 3 Cuadro, Juan Pablo
16 988032 973152
163 3 Cuadro, Juan Pablo
</code></pre>