Statistics
| Branch: | Revision:

wcn_emulator / README.md @ master

History | View | Annotate | Download (3.52 KB)

1 eac05fb4 Luca Baldesi
NePA TesT is a front-end for mininet which
2 976ba3fc Luca Baldesi
setups experiment on a given (networkx) network
3
4 3cfd0aca Luca Baldesi
Setup
5
=====
6
7
NePA TesT requires a patched version of Mininet.
8
Please refer to:
9
[NePA wiki](https://ans.disi.unitn.it/redmine/projects/community-newtork-emulator/wiki)
10
for the detailed setup.
11
12
Usage
13
=====
14
15 eac05fb4 Luca Baldesi
To run a test you need a configuration file
16
(to be placed in conf/) and the test class code
17
(to be placed in test_code/).
18
Then run
19
$>python wcn_emulator -f <conf_file> -t <test>
20
where <test> identifies a test case in 
21
<conf_file>. 
22
Each test case must specify an implementation
23
of MininetTest through the argoment "testClass"/
24
Each MininetTest class has the runTest method
25
which starts what the test needs and then waits
26
for completion.
27
This waiting can be implemented with self.wait()
28
function which sleeps for the desired amount of
29
time and optionally logs resource usage.
30
31
For example:
32 3cfd0aca Luca Baldesi
33
 * self.wait(self.duration) # will wait till the end
34
 * self.wait(self.duration, log_resources={'cpu': 'cpu_usage'}, 2) # will wait till the 
35 eac05fb4 Luca Baldesi
end of the test while sampling every 2 seconds
36
the cpu load and saving the results in a file 
37
called 'cpu_usage'.
38
39
Other than 'cpu', also 'net' and 'mem' can be
40
logged; 'mem' makes NePA TesT logging the amount
41
of available RAM (free or released) and the
42
amount of swap memory used; 'net' makes instead
43
logging both the fraction of received packets
44
over sent packets and the fraction of received
45
bytes over sent bytes since the beginning of the
46
test.
47
It is important to always specify the destination
48
file of the logs (even the same for all the
49
resources).
50
51 3cfd0aca Luca Baldesi
Test
52
====
53
54 eac05fb4 Luca Baldesi
NePA TesT stores test files in the Test folder.
55
Tests follows the pytest approach, to run them
56
simply install the pytest module and run
57
$>python -m pytest 
58
in the root folder
59
60 3cfd0aca Luca Baldesi
Troubleshooting
61
===============
62
63 976ba3fc Luca Baldesi
If something fails system may remain unstable.
64
In this case try typing:
65
$> sudo mn -c
66
67 3cfd0aca Luca Baldesi
How to
68
======
69
70 976ba3fc Luca Baldesi
Use a custom delay distribution for the links
71
---------------------------------------------
72 3cfd0aca Luca Baldesi
73 976ba3fc Luca Baldesi
Through network_builder.py is possible to set
74
some parameters of the links, e.g., loss,
75
bandwidth, mean delay, delay jitter and delay
76
distribution.
77 3cfd0aca Luca Baldesi
78 976ba3fc Luca Baldesi
Available delay distributions are placed in
79
/usr/lib/tc/ and the defaults one are normal,
80
pareto, paretonormal and experimental.
81
82
Given sample delay values is possible to build
83
a custom distribution and use it in mininet.
84 3cfd0aca Luca Baldesi
The following is an extraction from this [netem article](http://piao-tech.blogspot.it/2009/10/how-to-create-netem-distribution-tables.html).
85
86
 1. git clone git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git
87
 2. compile these netem utilities:
88
    cd iproute2/netem
89
    gcc -o maketable maketable.c -lm
90
    gcc -o stats stats.c -lm
91
 3. fill data.txt with samples from the
92
    distribution (in ms), e.g.,
93
    ping -c10 google.com | grep -Eo 'time=[0-9.]+'| grep -Eo '[0-9.]+' > data.txt
94
 4. build a netem distribution
95
    ./maketable data.txt > mydist.dist
96
 5. put mydist.dist in /usr/lib/tc/
97
 6. compute mean and standard deviation (sigma)
98
    ./stats data.txt
99
 7. use the following configuration parameters:
100
    link_mean_delay = <mean>ms
101
    link_delay_sd = <sigma>ms
102
    link_delay_distribution = mydist 
103 e165e09f Michele Segata
104
Attach to a host with bash without using CLI
105
--------------------------------------------
106
107
By using the `attachto.sh` script you can attach
108
to an experiment host via a `bash` on the isolated
109
network namespace of the host. To do so, run
110
111
```
112
attachto.sh <hostname>
113
```
114
115
where `hostname` is something like `h0_0`. At this
116
point if, for example, you type `ifconfig` you will
117
only see the interfaces of `h0_0`.