Project

General

Profile

Basic Testing » History » Version 3

laforge, 02/24/2017 04:30 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 2 laforge
You can find some instructions on how to build [[OpenGGSN:]] with support for [[libgtpnl]] and kernel GTP-U at this wiki page: [[OpenGGSN:Kernel_GTP]]
16 2 laforge
17 1 laforge
h2. Test setup description
18 1 laforge
19 1 laforge
We will run the GGSN natively on the host, and put the emulated SGSN inside a separate network namespace.
20 1 laforge
21 1 laforge
The two namespaces are interconnected by a virtual ethernet device using the transfer network 172.31.1.0/24
22 1 laforge
23 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
24 1 laforge
25 1 laforge
26 1 laforge
h2. Test instructions
27 1 laforge
28 1 laforge
h3. create the network namespace for the SGSN
29 1 laforge
30 1 laforge
 ip netns add sgsn
31 1 laforge
32 1 laforge
h3. add veth to be used between SGSN and GGSN
33 1 laforge
34 1 laforge
 ip link add veth0 type veth peer name veth1
35 1 laforge
36 1 laforge
h3. remote (SGSN) side of veth device
37 1 laforge
38 1 laforge
<pre>
39 1 laforge
ip link set veth1 netns sgsn
40 1 laforge
ip netns exec sgsn ip addr add 172.31.1.2/24 dev veth1
41 1 laforge
ip netns exec sgsn ip link set veth1 up
42 1 laforge
</pre>
43 1 laforge
44 1 laforge
h3. local (GGSN) side of veth device
45 1 laforge
46 1 laforge
<pre>
47 1 laforge
ip addr add  172.31.1.1/24 dev veth0
48 1 laforge
ip link set veth0 up
49 1 laforge
</pre>
50 1 laforge
51 1 laforge
h3. execute the GGSN on the host
52 1 laforge
53 3 laforge
 ggsn -g -c ./ggsn.conf.test
54 1 laforge
55 1 laforge
(use the file attached to this wiki page)
56 1 laforge
57 1 laforge
h3. execute the emulated SGSN inside the sgsn namespace
58 1 laforge
59 1 laforge
 ip netns exec sgsn sgsnemu -d -r 172.31.1.1 -l 172.31.1.2 --defaultroute --createif
60 1 laforge
61 1 laforge
h3. verify the existnace of the GTP tunnel
62 1 laforge
63 1 laforge
<pre>
64 1 laforge
ggsn:~# gtp-tunnel list
65 1 laforge
version 1 tei 1/1 ms_addr 192.168.71.2 sgsn_addr 172.31.1.2
66 1 laforge
</pre>
67 1 laforge
68 1 laforge
h3. further testing
69 1 laforge
70 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 
71 1 laforge
72 1 laforge
 ip netns exec sgsn ping -c 10 8.8.8.8
73 1 laforge
74 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.
Add picture from clipboard (Maximum size: 48.8 MB)