Project

General

Profile

Basic Testing » History » Version 1

laforge, 02/24/2017 04:27 PM

1 1 laforge
h1. Basic Testing
2 1 laforge
3 1 laforge
This page documents some basic testing setup for the Kenrel GTP-U code. It follows the below rationale:
4 1 laforge
* focus on testing the kernel GTP-U module without too much external dependencies
5 1 laforge
* test GTP-U interoperability of the kernel with at least one other implementation, not just kernel-to-kernel (which currently is not supported in the kernel, as it only implements the GGSN/P-GW role)
6 1 laforge
* limit testing to SGSN/S-GW and GGSN/P-GW, without a real cellular network (which is possible e.g. using [[OsmoSGSN:]] and [[OsmoPCU:]])
7 1 laforge
8 1 laforge
h2. Building / Installing dependencies
9 1 laforge
10 1 laforge
In order to follow below test instructions, you will need
11 1 laforge
* A Linux kernel including the GTP-U driver (@drivers/net/gtp.c@) either compiled-in or as kernel module
12 1 laforge
* [[libgtpnl]] - the userspace library providing an API around the kernel GTP-U netlink interface
13 1 laforge
* [[OpenGGSN:]] - a minimal C-language implementation of a 3GPP GGSN, also contains a SGSN-side emulator called [[OpenGGSN:sgsnemu]]
14 1 laforge
15 1 laforge
h2. Test setup description
16 1 laforge
17 1 laforge
We will run the GGSN natively on the host, and put the emulated SGSN inside a separate network namespace.
18 1 laforge
19 1 laforge
The two namespaces are interconnected by a virtual ethernet device using the transfer network 172.31.1.0/24
20 1 laforge
21 1 laforge
The GGSN is configured to provide a pool of IP addresses from the 192.168.71.0/24 range.  Each PDP context will be allocated one dynamic address from that pool
22 1 laforge
23 1 laforge
24 1 laforge
h2. Test instructions
25 1 laforge
26 1 laforge
h3. create the network namespace for the SGSN
27 1 laforge
28 1 laforge
 ip netns add sgsn
29 1 laforge
30 1 laforge
h3. add veth to be used between SGSN and GGSN
31 1 laforge
32 1 laforge
 ip link add veth0 type veth peer name veth1
33 1 laforge
34 1 laforge
h3. remote (SGSN) side of veth device
35 1 laforge
36 1 laforge
<pre>
37 1 laforge
ip link set veth1 netns sgsn
38 1 laforge
ip netns exec sgsn ip addr add 172.31.1.2/24 dev veth1
39 1 laforge
ip netns exec sgsn ip link set veth1 up
40 1 laforge
</pre>
41 1 laforge
42 1 laforge
h3. local (GGSN) side of veth device
43 1 laforge
44 1 laforge
<pre>
45 1 laforge
ip addr add  172.31.1.1/24 dev veth0
46 1 laforge
ip link set veth0 up
47 1 laforge
</pre>
48 1 laforge
49 1 laforge
h3. execute the GGSN on the host
50 1 laforge
51 1 laforge
 ggsn -c ./ggsn.conf.test
52 1 laforge
53 1 laforge
(use the file attached to this wiki page)
54 1 laforge
55 1 laforge
h3. execute the emulated SGSN inside the sgsn namespace
56 1 laforge
57 1 laforge
 ip netns exec sgsn sgsnemu -d -r 172.31.1.1 -l 172.31.1.2 --defaultroute --createif
58 1 laforge
59 1 laforge
h3. verify the existnace of the GTP tunnel
60 1 laforge
61 1 laforge
<pre>
62 1 laforge
ggsn:~# gtp-tunnel list
63 1 laforge
version 1 tei 1/1 ms_addr 192.168.71.2 sgsn_addr 172.31.1.2
64 1 laforge
</pre>
65 1 laforge
66 1 laforge
h3. further testing
67 1 laforge
68 1 laforge
in the @sgsn@ namespace, there's now a default-route that points into the GTP tunnel. You can use this to ping any network address that's reachable to the GGSN host.  If that host is connected to the internet, you can e.g. run a ping command from within the namespace using 
69 1 laforge
70 1 laforge
 ip netns exec sgsn ping -c 10 8.8.8.8
71 1 laforge
72 1 laforge
which will send some IP packets to 8.8.8.8 via the tun0 device (created by [[OpenGGSN:sgsnemu]]). It will be encapsulated by the userspace GTP-U implementation of sgsnemu, sent via the veth device to the host, where it ends up inthe GTP-U kernel module, decapsulating the package and passing in on to the gtp0 device there.  Anything beyond that point depends on your local routing configuration.