Measuring Tools and Scripts » History » Version 14
Version 13 (GAY, Adrien, 12/15/2014 09:05 PM) → Version 14/19 (GAY, Adrien, 12/15/2014 09:09 PM)
h1. Measuring Tools
-----
h2. EL470
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:
<pre>
Timestamp,Demod,RqModCod,EsNo,CarrierBitrate
2014-12-12 15:04:58,1,16APSK-2/3,11.30,1445835 15:05:19,1,16APSK-2/3,11.20,1445835
2014-12-12 15:05:10,1,16APSK-2/3,11.20,1445835
2014-12-12 15:05:24,1,16APSK-2/3,10.72,1324072
2014-12-12 15:05:28,1,16APSK-2/3,10.61,1324072
2014-12-12 15:05:31,1,16APSK-2/3,10.66,1324072
2014-12-12 15:05:34,1,8PSK-3/4,10.19,1313479
2014-12-12 15:05:37,1,8PSK-3/4,11.87,1313479
2014-12-12 15:05:41,1,8PSK-3/4,10.40,1313479
2014-12-12 15:06:47,1,QPSK-5/6,6.93,884389
2014-12-12 15:06:51,1,QPSK-5/6,8.18,884389
2014-12-12 15:06:54,1,QPSK-5/6,7.02,825503 15:06:56,1,QPSK-5/6,7.02,825503
</pre>
It is unclear though what the sampling logging 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:
* Timestamp (in seconds)
* Modcod parameter (modulation + coding rate)
* Estimate of E ~s~ / N ~0~
* Information bitrate (in bps)
This log file can be accessed through in the FlexACM controller tab. It is the button labeled Controller Log:
p=. !{width: 70%}FlexController.png!
A much simpler way though is to use the following link:
@http://192.168.88.100/cgi-bin/pegui-cgi/cli/cgi+acmcdem?filename=acmcdem.csv@
h2. Traffic generation and capture
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.
notice. We will generate a UDP data stream in order to test throughput.
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 server. Likewise, the Station PC must be setup as a server.
<pre><code class="Terminal">
# STATION PC LISTENING ON PORT 5201
$ iperf3 -s -u -i1 -p 5201
------------------------------------------------------------
Server listening on UDP port 5201
Receiving 1470 byte datagrams
UDP buffer size: 192 KByte (default)
------------------------------------------------------------
</code></pre>
<pre><code class="Terminal">
# HUB PC STARTS UDP DATA STREAM DES_PORT = 5201
$ iperf3 -c 10.0.0.130 -u -t <duration in secs> -b <bandwidth> -l <udp size> -p 5201
------------------------------------------------------------
Client connecting to 10.0.0.130, UDP port 5201
Sending <udp size> byte datagrams
UDP buffer size: 9.00 KByte (default)
------------------------------------------------------------
</code></pre>
At the same time the Station PC must capture all incoming traffic, we will use the following command:
<pre><code class="Terminal">
# CAPTURE INCOMING TRAFFIC
$ tcpdump -w output_file_name.pcap
</code></pre>
h1. Scripts
-----
In order to process obtained data we have created multiple scripts to parse and display results. Please download attachment:measurements.zip inside you will find measurements taken in the course of this project as well as well as the following scripts:
* *pcaptput.py* : Calculates throughput metrics from .pcap file.
* *bulk_pcaptput* : Bash script to run pcaptput.py on all data and generate .tput files.
* *ConsolidateRun.m* : MATLAB class to import and consolidate .pcap as well as .tput data.
* *bulk_consolidate_results.m* : MATLAB script to generate all graphs in this wiki.
There is also README for further clarification.
h2. pcaptput.py
_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.
<pre><code class="Python">
#!/usr/bin/python2.6
# pcaptput.py
import sys, dpkt
if len(sys.argv) != 2:
raise ValueError('.pcap file needs to be specified.')
filename = sys.argv[1];
udpPort = 5201
tRes = 1
periodn = 0
baseTimeStamp = 0
iter = 0
# Total IP packet counter
ipBitCount = 0
# UDP payload counter
udpBitCount = 0
print 'Time[s]', 'IP-Throughput[bps]', 'UDP-Throughput[bps]'
for timeStamp, buf in dpkt.pcap.Reader(open(filename, 'r')):
iter += 1
if iter == 1:
baseTimeStamp = timeStamp
# Get ethernet frame
eth = dpkt.ethernet.Ethernet(buf)
# Check for pure IP traffic only (no ARP packets)
if type(eth.data) != dpkt.ip.IP:
continue
ip = eth.data
ts = timeStamp - baseTimeStamp
# Histogram bins
if ts >= periodn * tRes:
print periodn * tRes, ipBitCount / tRes, udpBitCount / tRes
periodn += 1
udpBitCount = 0
ipBitCount = 0
# Counters
ipBitCount += ip.len * 8
if isinstance(ip.data, dpkt.udp.UDP) and (udpPort == ip.data.dport):
udpBitCount += ip.data.ulen * 8
</code></pre>
Usage is as follows:
<pre><code class="Terminal">
$ ./pcaptput.py input.pcap > output.tput
Time[s] IP-Throughput[bps] UDP-Throughput[bps]
0 0 0
1 4688 0
2 3984 96
3 754720 742944
4 775552 763872
5 860544 847584
6 903040 889440
7 1019904 1004544
8 1083648 1067328
9 1221760 1203360
10 1296128 1276608
11 903040 889440
12 764928 753408
13 807424 795264
14 860544 847584
15 956160 941760
16 988032 973152
</code></pre>
-----
h2. EL470
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:
<pre>
Timestamp,Demod,RqModCod,EsNo,CarrierBitrate
2014-12-12 15:04:58,1,16APSK-2/3,11.30,1445835 15:05:19,1,16APSK-2/3,11.20,1445835
2014-12-12 15:05:10,1,16APSK-2/3,11.20,1445835
2014-12-12 15:05:24,1,16APSK-2/3,10.72,1324072
2014-12-12 15:05:28,1,16APSK-2/3,10.61,1324072
2014-12-12 15:05:31,1,16APSK-2/3,10.66,1324072
2014-12-12 15:05:34,1,8PSK-3/4,10.19,1313479
2014-12-12 15:05:37,1,8PSK-3/4,11.87,1313479
2014-12-12 15:05:41,1,8PSK-3/4,10.40,1313479
2014-12-12 15:06:47,1,QPSK-5/6,6.93,884389
2014-12-12 15:06:51,1,QPSK-5/6,8.18,884389
2014-12-12 15:06:54,1,QPSK-5/6,7.02,825503 15:06:56,1,QPSK-5/6,7.02,825503
</pre>
It is unclear though what the sampling logging 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:
* Timestamp (in seconds)
* Modcod parameter (modulation + coding rate)
* Estimate of E ~s~ / N ~0~
* Information bitrate (in bps)
This log file can be accessed through in the FlexACM controller tab. It is the button labeled Controller Log:
p=. !{width: 70%}FlexController.png!
A much simpler way though is to use the following link:
@http://192.168.88.100/cgi-bin/pegui-cgi/cli/cgi+acmcdem?filename=acmcdem.csv@
h2. Traffic generation and capture
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.
notice. We will generate a UDP data stream in order to test throughput.
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 server. Likewise, the Station PC must be setup as a server.
<pre><code class="Terminal">
# STATION PC LISTENING ON PORT 5201
$ iperf3 -s -u -i1 -p 5201
------------------------------------------------------------
Server listening on UDP port 5201
Receiving 1470 byte datagrams
UDP buffer size: 192 KByte (default)
------------------------------------------------------------
</code></pre>
<pre><code class="Terminal">
# HUB PC STARTS UDP DATA STREAM DES_PORT = 5201
$ iperf3 -c 10.0.0.130 -u -t <duration in secs> -b <bandwidth> -l <udp size> -p 5201
------------------------------------------------------------
Client connecting to 10.0.0.130, UDP port 5201
Sending <udp size> byte datagrams
UDP buffer size: 9.00 KByte (default)
------------------------------------------------------------
</code></pre>
At the same time the Station PC must capture all incoming traffic, we will use the following command:
<pre><code class="Terminal">
# CAPTURE INCOMING TRAFFIC
$ tcpdump -w output_file_name.pcap
</code></pre>
h1. Scripts
-----
In order to process obtained data we have created multiple scripts to parse and display results. Please download attachment:measurements.zip inside you will find measurements taken in the course of this project as well as well as the following scripts:
* *pcaptput.py* : Calculates throughput metrics from .pcap file.
* *bulk_pcaptput* : Bash script to run pcaptput.py on all data and generate .tput files.
* *ConsolidateRun.m* : MATLAB class to import and consolidate .pcap as well as .tput data.
* *bulk_consolidate_results.m* : MATLAB script to generate all graphs in this wiki.
There is also README for further clarification.
h2. pcaptput.py
_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.
<pre><code class="Python">
#!/usr/bin/python2.6
# pcaptput.py
import sys, dpkt
if len(sys.argv) != 2:
raise ValueError('.pcap file needs to be specified.')
filename = sys.argv[1];
udpPort = 5201
tRes = 1
periodn = 0
baseTimeStamp = 0
iter = 0
# Total IP packet counter
ipBitCount = 0
# UDP payload counter
udpBitCount = 0
print 'Time[s]', 'IP-Throughput[bps]', 'UDP-Throughput[bps]'
for timeStamp, buf in dpkt.pcap.Reader(open(filename, 'r')):
iter += 1
if iter == 1:
baseTimeStamp = timeStamp
# Get ethernet frame
eth = dpkt.ethernet.Ethernet(buf)
# Check for pure IP traffic only (no ARP packets)
if type(eth.data) != dpkt.ip.IP:
continue
ip = eth.data
ts = timeStamp - baseTimeStamp
# Histogram bins
if ts >= periodn * tRes:
print periodn * tRes, ipBitCount / tRes, udpBitCount / tRes
periodn += 1
udpBitCount = 0
ipBitCount = 0
# Counters
ipBitCount += ip.len * 8
if isinstance(ip.data, dpkt.udp.UDP) and (udpPort == ip.data.dport):
udpBitCount += ip.data.ulen * 8
</code></pre>
Usage is as follows:
<pre><code class="Terminal">
$ ./pcaptput.py input.pcap > output.tput
Time[s] IP-Throughput[bps] UDP-Throughput[bps]
0 0 0
1 4688 0
2 3984 96
3 754720 742944
4 775552 763872
5 860544 847584
6 903040 889440
7 1019904 1004544
8 1083648 1067328
9 1221760 1203360
10 1296128 1276608
11 903040 889440
12 764928 753408
13 807424 795264
14 860544 847584
15 956160 941760
16 988032 973152
</code></pre>