ttcn3-ggsn-test: add kernel test

Make it possible to run ttcn3-ggsn-test against osmo-ggsn with the GTP
kernel module. This feature is enabled by environment variables
explained in ttcn3-ggsn-test/jenkins.sh, and can either use the
pre-built kernel from Debian, or build a kernel from source.

The kernel runs inside QEMU inside the usual osmo-ggsn-master docker
image.

Thanks to Pau for providing the kernel config and kernel-test scripts
that this patch is based on! I ended up modifying them quite a bit to
fit the docker use case, and to build the initrd (so we can use the
stock debian kernel).

Related: OS#3208
Change-Id: I54e752048eed2a170a1cf4e0fd410de255b9de5d
changes/05/23005/6
Oliver Smith 2 years ago
parent fd6f09e0c2
commit 79e48fd3ae
  1. 2
      .gitignore
  2. 39
      README.md
  3. 47
      jenkins-common.sh
  4. 16
      osmo-ggsn-latest/Dockerfile
  5. 14
      osmo-ggsn-master/Dockerfile
  6. 114
      scripts/kernel-test/initrd-build.sh
  7. 38
      scripts/kernel-test/initrd-init.sh
  8. 49
      scripts/kernel-test/kernel-build.sh
  9. 23
      scripts/kernel-test/prepare.sh
  10. 9
      scripts/kernel-test/qemu-ifdown.sh
  11. 18
      scripts/kernel-test/qemu-ifup.sh
  12. 30
      scripts/kernel-test/run-qemu.sh
  13. 268
      ttcn3-ggsn-test/fragment.config
  14. 17
      ttcn3-ggsn-test/initrd-ggsn.sh
  15. 39
      ttcn3-ggsn-test/jenkins.sh
  16. 59
      ttcn3-ggsn-test/osmo-ggsn-kernel-gtp.cfg

2
.gitignore vendored

@ -1 +1,3 @@
.release
/_cache

@ -24,6 +24,45 @@ Environment variables:
* `NO_DOCKER_IMAGE_BUILD`: when set to `1`, it won't try to update the
containers (see "caching" below)
## Kernel test
OsmoGGSN can be configured to either run completely in userspace, or to
use the GTP-U kernel module. To test the kernel module, OsmoGGSN and
the kernel module will run with a Linux kernel (either the pre-built
one from Debian, or a custom built one) in QEMU inside docker. As of
writing, `ttcn3-ggsn-test` is the only testsuite where it makes
sense to test kernel modules. But the same environment variables could
be used for other testsuites in the future.
Environment variables:
* `KERNEL_TEST`: set to 1 to run the SUT in QEMU
* `KERNEL_BUILD`: set to 1 to build the kernel instead of using the
pre-built one
* `KERNEL_REMOTE_NAME`: git remote name (to add multiple git
repositories in the same local linux clone, default: net-next)
* `KERNEL_URL`: git remote url (default: net-next.git on kernel.org)
* `KERNEL_BRANCH` branch to checkout (default: master)
### Creating kernel config fragments
For the kernel tests, we are storing kernel config fragments in the git
repository instead of full kernel configs. Generate them as follows:
```
$ cd _cache/linux
$ cp custom.config .config
$ make olddefconfig
$ cp .config custom-updated.config
$ make defconfig # config to which to diff
$ scripts/diffconfig -m .config custom-updated.config > fragment.config
```
Verify that it was done right:
```
$ make defconfig
$ scripts/kconfig/merge_config.sh -m .config fragment.config
$ make olddefconfig
$ diff .config custom-updated.config # should be the same
```
## Building containers manually
Most folders in this repository contain a `Dockerfile`. Build a docker
container with the same name as the folder like this:

@ -1,3 +1,6 @@
CACHE_DIR="$(realpath ../_cache)"
KERNEL_TEST_DIR="$(realpath ../scripts/kernel-test)"
docker_image_exists() {
test -n "$(docker images -q "$REPO_USER/$1")"
}
@ -150,9 +153,10 @@ fix_perms() {
echo Fixing permissions
docker run --rm \
-v $VOL_BASE_DIR:/data \
-v $CACHE_DIR:/cache \
--name ${BUILD_TAG}-cleaner \
$REPO_USER/debian-stretch-build \
chmod -R a+rX /data/
chmod -R a+rX /data/ /cache/
}
collect_logs() {
@ -190,6 +194,47 @@ set_clean_up_trap() {
trap clean_up_common EXIT INT TERM 0
}
# Generate the initrd, and optionally build a kernel, for tests that involve
# kernel modules. Boot the kernel once in QEMU inside docker to verify that it
# works. See README.md for description of the KERNEL_* environment variables.
# $1: kernel config base (e.g. defconfig, tinyconfig, allnoconfig)
# $2: path to kernel config fragment
# $3: path to project specific initrd build script, which adds the osmo
# program, kernel modules etc. to the initrd (gets sourced by
# scripts/kernel-test/initrd-build.sh)
# $4: docker image name
# $5-n: (optional) additional arguments to "docker run", like a volume
# containing a config file
kernel_test_prepare() {
local kernel_config_base="$1"
local kernel_config_fragment="$2"
local initrd_project_script="$3"
local docker_image="$4"
shift 4
mkdir -p "$CACHE_DIR/kernel-test"
cp "$kernel_config_fragment" \
"$CACHE_DIR/kernel-test/fragment.config"
cp "$initrd_project_script" \
"$CACHE_DIR/kernel-test/initrd-project-script.sh"
docker run \
--cap-add=NET_ADMIN \
--device /dev/kvm:/dev/kvm \
--device /dev/net/tun:/dev/net/tun \
-v "$CACHE_DIR:/cache" \
-v "$KERNEL_TEST_DIR:/kernel-test:ro" \
-e "KERNEL_BRANCH=$KERNEL_BRANCH" \
-e "KERNEL_BUILD=$KERNEL_BUILD" \
-e "KERNEL_CONFIG_BASE=$kernel_config_base" \
-e "KERNEL_REMOTE_NAME=$KERNEL_REMOTE_NAME" \
-e "KERNEL_URL=$KERNEL_URL" \
"$@" \
"$docker_image" \
"/kernel-test/prepare.sh"
}
set -x
# non-jenkins execution: assume local user name

@ -19,10 +19,20 @@ RUN apt-key add /tmp/Release.key && \
echo "deb " $OSMOCOM_REPO " ./" > /etc/apt/sources.list.d/osmocom-latest.list
ADD $OSMOCOM_REPO/Release /tmp/Release
RUN apt-get update && \
# Disable update-initramfs to save time during apt-get install
RUN ln -s /bin/true /usr/local/bin/update-initramfs && \
apt-get update && \
apt-get install -y --no-install-recommends \
telnet \
osmo-ggsn && \
bc \
bridge-utils \
busybox-static \
ca-certificates \
libelf-dev \
linux-image-amd64 \
osmo-ggsn \
pax-utils \
qemu-system-x86 \
telnet && \
apt-get clean
WORKDIR /tmp

@ -24,13 +24,23 @@ RUN case "$DISTRO" in \
# unfortunately Dockerfiles don't support a conditional ARG, so we need to add both DPKG + RPM
ADD $OSMOCOM_REPO/Release /tmp/Release
ADD $OSMOCOM_REPO_MIRROR/repositories/network:/osmocom:/nightly/CentOS_8/repodata/repomd.xml /tmp/repomd.xml
# Disable update-initramfs to save time during apt-get install
RUN case "$DISTRO" in \
debian*) \
ln -s /bin/true /usr/local/bin/update-initramfs && \
apt-get update && \
apt-get install -y --no-install-recommends \
telnet \
bc \
bridge-utils \
busybox-static \
ca-certificates \
libelf-dev \
libgtpnl-dev \
libosmocore-dev && \
libosmocore-dev \
linux-image-amd64 \
pax-utils \
qemu-system-x86 \
telnet && \
apt-get clean \
;; \
centos*) \

@ -0,0 +1,114 @@
#!/bin/sh -ex
# Add one or more files to the initramfs, with parent directories
# $@: path to files
initrd_add_file() {
cp -a --parents "$@" /tmp/initrd
}
# Add kernel module files with dependencies
# $@: kernel module names
initrd_add_mod() {
if [ "$KERNEL_BUILD" = 1 ]; then
# Custom kernel will be built, don't add any modules from the
# distribution's kernel to the initramfs.
return
fi
local kernel="$(basename /lib/modules/*)"
local files="$(modprobe \
-a \
--dry-run \
--show-depends \
--set-version="$kernel" \
"$@" \
| sort -u \
| cut -d ' ' -f 2)"
initrd_add_file $files
# Save the list of modules, so initrd-init.sh can load all of them
for i in $@; do
echo "$i" >> /tmp/initrd/modules
done
}
# Add binaries with depending libraries
# $@: paths to binaries
initrd_add_bin() {
local bin
local bin_path
local file
for bin in "$@"; do
local bin_path="$(which "$bin")"
if [ -z "$bin_path" ]; then
echo "ERROR: file not found: $bin"
exit 1
fi
lddtree_out="$(lddtree -l "$bin_path")"
if [ -z "$lddtree_out" ]; then
echo "ERROR: lddtree failed on '$bin_path'"
exit 1
fi
for file in $lddtree_out; do
initrd_add_file "$file"
# Copy resolved symlink
if [ -L "$file" ]; then
initrd_add_file "$(realpath "$file")"
fi
done
done
}
# Add command to run inside the initramfs
# $@: commands
initrd_add_cmd() {
local i
if ! [ -e /tmp/initrd/cmd.sh ]; then
echo "#!/bin/sh -ex" > /tmp/initrd/cmd.sh
chmod +x /tmp/initrd/cmd.sh
fi
for i in "$@"; do
echo "$i" >> /tmp/initrd/cmd.sh
done
}
mkdir -p /tmp/initrd
cd /tmp/initrd
mkdir -p \
dev/net \
proc \
sbin \
sys \
tmp \
usr/bin \
usr/sbin
initrd_add_bin \
busybox
initrd_add_mod \
virtio_net \
virtio_pci
initrd_add_file \
/lib/modules/*/modules.dep
# Required for osmo-ggsn
mknod dev/net/tun c 10 200
cp /kernel-test/initrd-init.sh init
# Add project specific files (e.g. osmo-ggsn and gtp kernel module)
. /cache/kernel-test/initrd-project-script.sh
find . -print0 \
| cpio --quiet -o -0 -H newc \
| gzip -1 > /cache/kernel-test/initrd

@ -0,0 +1,38 @@
#!/bin/busybox sh
echo "Running initrd-init.sh"
set -ex
export HOME=/root
export LD_LIBRARY_PATH=/usr/local/lib
export PATH=/usr/local/bin:/usr/bin:/bin:/sbin:/usr/local/sbin:/usr/sbin
export TERM=screen
/bin/busybox --install -s
hostname qemu
mount -t proc proc /proc
mount -t sysfs sys /sys
# Load modules from initrd-build.sh:initrd_add_mod()
if [ -e /modules ]; then
cat /modules | xargs -t -n1 modprobe
fi
ip link set lo up
ip link set eth0 up
if grep -q SMOKE_TEST /proc/cmdline; then
# Called from scripts/kernel-test/prepare.sh:kernel_smoke_test() to
# verify that the kernel + initramfs boot up properly. Output this
# string instead of running the actual commands.
echo "SMOKE_TEST_SUCCESS"
else
# Run project specific commands, added with initrd_add_cmd (see
# inird-ggsn.sh for example). Use '|| true' to avoid "attempting to
# kill init" kernel panic on failure.
/cmd.sh || true
fi
# Avoid kernel panic when init exits
poweroff -f

@ -0,0 +1,49 @@
#!/bin/sh -ex
# Environment variables are described in README.md
KERNEL_REMOTE_NAME="${KERNEL_REMOTE_NAME:-net-next}"
KERNEL_URL="${KERNEL_URL:-https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git}"
KERNEL_BRANCH="${KERNEL_BRANCH:-master}"
KERNEL_DIR=/cache/linux
# Add the kernel repository as git remote, fetch it, checkout the given branch
prepare_git_repo() {
if ! [ -d "$KERNEL_DIR" ]; then
mkdir -p "$KERNEL_DIR"
git -C "$KERNEL_DIR" init
fi
cd "$KERNEL_DIR"
if ! git remote | grep -q "^$KERNEL_REMOTE_NAME$"; then
git remote add "$KERNEL_REMOTE_NAME" "$KERNEL_URL"
fi
git fetch "$KERNEL_REMOTE_NAME"
git checkout "$KERNEL_REMOTE_NAME/$KERNEL_BRANCH"
}
update_kernel_config() {
local previous="/cache/kernel-test/previous.config"
local fragment="/cache/kernel-test/fragment.config"
cd "$KERNEL_DIR"
make "$KERNEL_CONFIG_BASE"
scripts/kconfig/merge_config.sh -m .config "$fragment"
make olddefconfig
if [ -e "$previous" ] && ! diff -q "$previous" .config; then
# Remove everything built with previous config
echo "Kernel config changed, running 'make clean'"
make clean
fi
cp .config "$previous"
}
prepare_git_repo
update_kernel_config
make "-j$(nproc)"
cp arch/x86/boot/bzImage /cache/kernel-test/linux

@ -0,0 +1,23 @@
#!/bin/sh -ex
KERNEL_BUILD="${KERNEL_BUILD:-0}"
# Test if the kernel boots up, and initd code runs through without error
kernel_smoke_test() {
local log=/cache/kernel-test/smoke_test.log
/kernel-test/run-qemu.sh SMOKE_TEST > "$log" 2>&1 || true
if ! grep -q SMOKE_TEST_SUCCESS "$log"; then
cat "$log"
echo "ERROR: failed to boot the kernel and initrd in QEMU!"
exit 1
fi
}
/kernel-test/initrd-build.sh
if [ "$KERNEL_BUILD" = 1 ]; then
/kernel-test/kernel-build.sh
else
cp /boot/vmlinuz-* /cache/kernel-test/linux
fi
kernel_smoke_test

@ -0,0 +1,9 @@
#!/bin/sh -e
br=br-test
qemu_if=$1
echo "[host] qemu-ifdown: $br and $qemu_if"
set +x
ip link set "$br" down
brctl delbr $br

@ -0,0 +1,18 @@
#!/bin/sh -e
br=br-test
docker_if=eth0
qemu_if=$1
echo "[host] qemu-ifup: $br, $qemu_if, $docker_if"
set +x
ip link set "$qemu_if" up
brctl addbr "$br"
brctl addif "$br" "$qemu_if"
brctl addif "$br" "$docker_if"
ip link set "$br" up
ip a
ip route

@ -0,0 +1,30 @@
#!/bin/sh -ex
# Arguments are appended to the kernel cmdline
random_mac() {
printf "52:54:"
date "+%c %N" | sha1sum | sed 's/\(.\{2\}\)/\1:/g' | cut -d: -f 1-4
}
KERNEL_CMDLINE="
root=/dev/ram0
console=ttyS0
panic=-1
$@
"
qemu-system-x86_64 \
-machine pc,accel=kvm \
-smp 1 \
-m 512M \
-nodefconfig -no-user-config -nodefaults -display none \
-gdb unix:/cache/kernel-test/gdb.pipe,server,nowait \
-no-reboot \
-kernel /cache/kernel-test/linux \
-initrd /cache/kernel-test/initrd \
-append "${KERNEL_CMDLINE}" \
-serial stdio \
-chardev socket,id=charserial1,path=/cache/kernel-test/gdb-serial.pipe,server,nowait \
-device isa-serial,chardev=charserial1,id=serial1 \
-netdev tap,id=nettest,script=/kernel-test/qemu-ifup.sh,downscript=/kernel-test/qemu-ifdown.sh \
-device virtio-net-pci,netdev=nettest,mac="$(random_mac)"

@ -0,0 +1,268 @@
# CONFIG_ACPI_BGRT is not set
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_SHA1=y
# CONFIG_EFI_STUB is not set
CONFIG_FAILOVER=y
CONFIG_FDDI=y
CONFIG_GTP=y
CONFIG_HAMRADIO=y
CONFIG_HYPERVISOR_GUEST=y
CONFIG_INPUT_MOUSEDEV=y
CONFIG_IP_NF_NAT=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_SET=y
CONFIG_LEGACY_VSYSCALL_EMULATE=y
# CONFIG_LEGACY_VSYSCALL_XONLY is not set
CONFIG_LIBCRC32C=y
CONFIG_MICROCODE_OLD_INTERFACE=y
CONFIG_NETFILTER_ADVANCED=y
CONFIG_NETFILTER_NETLINK_GLUE_CT=y
CONFIG_NETFILTER_XT_MARK=y
CONFIG_NETFILTER_XT_NAT=y
CONFIG_NETFILTER_XT_TARGET_LOG=y
CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y
CONFIG_NET_9P=y
CONFIG_NET_FAILOVER=y
CONFIG_NF_LOG_COMMON=y
CONFIG_NF_LOG_IPV4=y
CONFIG_NF_LOG_IPV6=y
CONFIG_OVERLAY_FS=y
CONFIG_PAGE_REPORTING=y
CONFIG_PARTITION_ADVANCED=y
CONFIG_PCIEAER=y
# CONFIG_R8169 is not set
# CONFIG_RANDOMIZE_BASE is not set
CONFIG_RAS=y
# CONFIG_RCU_TRACE is not set
# CONFIG_REALTEK_PHY is not set
CONFIG_SND_HDA_PREALLOC_SIZE=64
CONFIG_SND_OSSEMUL=y
# CONFIG_STRICT_DEVMEM is not set
CONFIG_UEVENT_HELPER=y
# CONFIG_USB is not set
CONFIG_VIRTIO_MMIO=y
CONFIG_VIRTIO_PCI=y
CONFIG_9P_FS=y
CONFIG_9P_FS_POSIX_ACL=y
CONFIG_9P_FS_SECURITY=y
# CONFIG_ACORN_PARTITION is not set
# CONFIG_ACPI_EXTLOG is not set
# CONFIG_ACRN_GUEST is not set
# CONFIG_AIX_PARTITION is not set
CONFIG_AMIGA_PARTITION=y
CONFIG_ARCH_CPUIDLE_HALTPOLL=y
# CONFIG_ATARI_PARTITION is not set
# CONFIG_AX25 is not set
CONFIG_BALLOON_COMPACTION=y
CONFIG_BLK_MQ_VIRTIO=y
CONFIG_BSD_DISKLABEL=y
# CONFIG_CMDLINE_PARTITION is not set
# CONFIG_CPU_IDLE_GOV_HALTPOLL is not set
CONFIG_CRYPTO_DEV_VIRTIO=y
CONFIG_CRYPTO_ENGINE=y
CONFIG_CRYPTO_LIB_DES=y
# CONFIG_DEFXX is not set
# CONFIG_DRM_VIRTIO_GPU is not set
CONFIG_EDAC=y
# CONFIG_EDAC_AMD64 is not set
# CONFIG_EDAC_DEBUG is not set
CONFIG_EDAC_DECODE_MCE=y
# CONFIG_EDAC_E752X is not set
# CONFIG_EDAC_I10NM is not set
# CONFIG_EDAC_I3000 is not set
# CONFIG_EDAC_I3200 is not set
# CONFIG_EDAC_I5000 is not set
# CONFIG_EDAC_I5100 is not set
# CONFIG_EDAC_I5400 is not set
# CONFIG_EDAC_I7300 is not set
# CONFIG_EDAC_I7CORE is not set
# CONFIG_EDAC_I82975X is not set
# CONFIG_EDAC_IE31200 is not set
# CONFIG_EDAC_IGEN6 is not set
CONFIG_EDAC_LEGACY_SYSFS=y
# CONFIG_EDAC_PND2 is not set
# CONFIG_EDAC_SBRIDGE is not set
# CONFIG_EDAC_SKX is not set
# CONFIG_EDAC_X38 is not set
CONFIG_HALTPOLL_CPUIDLE=y
# CONFIG_HW_RANDOM_VIRTIO is not set
# CONFIG_HYPERV is not set
# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_IP6_NF_MATCH_AH is not set
# CONFIG_IP6_NF_MATCH_EUI64 is not set
# CONFIG_IP6_NF_MATCH_FRAG is not set
# CONFIG_IP6_NF_MATCH_HL is not set
# CONFIG_IP6_NF_MATCH_MH is not set
# CONFIG_IP6_NF_MATCH_OPTS is not set
# CONFIG_IP6_NF_MATCH_RPFILTER is not set
# CONFIG_IP6_NF_MATCH_RT is not set
# CONFIG_IP6_NF_MATCH_SRH is not set
CONFIG_IP6_NF_NAT=y
# CONFIG_IP6_NF_SECURITY is not set
# CONFIG_IP6_NF_TARGET_HL is not set
CONFIG_IP6_NF_TARGET_MASQUERADE=y
# CONFIG_IP6_NF_TARGET_NPT is not set
# CONFIG_IP6_NF_TARGET_SYNPROXY is not set
# CONFIG_IP_NF_ARPTABLES is not set
# CONFIG_IP_NF_MATCH_AH is not set
# CONFIG_IP_NF_MATCH_ECN is not set
# CONFIG_IP_NF_MATCH_RPFILTER is not set
# CONFIG_IP_NF_MATCH_TTL is not set
# CONFIG_IP_NF_SECURITY is not set
# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
# CONFIG_IP_NF_TARGET_ECN is not set
# CONFIG_IP_NF_TARGET_NETMAP is not set
# CONFIG_IP_NF_TARGET_REDIRECT is not set
# CONFIG_IP_NF_TARGET_SYNPROXY is not set
# CONFIG_IP_NF_TARGET_TTL is not set
# CONFIG_IP_SET_BITMAP_IP is not set
# CONFIG_IP_SET_BITMAP_IPMAC is not set
# CONFIG_IP_SET_BITMAP_PORT is not set
# CONFIG_IP_SET_HASH_IP is not set
# CONFIG_IP_SET_HASH_IPMAC is not set
# CONFIG_IP_SET_HASH_IPMARK is not set
# CONFIG_IP_SET_HASH_IPPORT is not set
# CONFIG_IP_SET_HASH_IPPORTIP is not set
# CONFIG_IP_SET_HASH_IPPORTNET is not set
# CONFIG_IP_SET_HASH_MAC is not set
# CONFIG_IP_SET_HASH_NET is not set
# CONFIG_IP_SET_HASH_NETIFACE is not set
# CONFIG_IP_SET_HASH_NETNET is not set
# CONFIG_IP_SET_HASH_NETPORT is not set
# CONFIG_IP_SET_HASH_NETPORTNET is not set
# CONFIG_IP_SET_LIST_SET is not set
CONFIG_IP_SET_MAX=256
# CONFIG_JAILHOUSE_GUEST is not set
CONFIG_KARMA_PARTITION=y
CONFIG_KVM_GUEST=y
# CONFIG_LDM_PARTITION is not set
CONFIG_MAC_PARTITION=y
CONFIG_MEMORY_BALLOON=y
CONFIG_MINIX_SUBPARTITION=y
CONFIG_MMU_GATHER_RCU_TABLE_FREE=y
CONFIG_MMU_GATHER_TABLE_FREE=y
# CONFIG_MOUSE_PS2_VMMOUSE is not set
# CONFIG_NETFILTER_NETLINK_ACCT is not set
# CONFIG_NETFILTER_NETLINK_OSF is not set
# CONFIG_NETFILTER_NETLINK_QUEUE is not set
CONFIG_NETFILTER_XT_CONNMARK=y
# CONFIG_NETFILTER_XT_MATCH_BPF is not set
# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set
# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set
# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set
# CONFIG_NETFILTER_XT_MATCH_CONNLABEL is not set
# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set
# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set
# CONFIG_NETFILTER_XT_MATCH_CPU is not set
# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
# CONFIG_NETFILTER_XT_MATCH_DEVGROUP is not set
# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
# CONFIG_NETFILTER_XT_MATCH_ECN is not set
# CONFIG_NETFILTER_XT_MATCH_ESP is not set
# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
# CONFIG_NETFILTER_XT_MATCH_HELPER is not set
# CONFIG_NETFILTER_XT_MATCH_HL is not set
# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set
# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set
# CONFIG_NETFILTER_XT_MATCH_L2TP is not set
# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set
# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set
# CONFIG_NETFILTER_XT_MATCH_MAC is not set
CONFIG_NETFILTER_XT_MATCH_MARK=y
# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set
# CONFIG_NETFILTER_XT_MATCH_NFACCT is not set
# CONFIG_NETFILTER_XT_MATCH_OSF is not set
# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set
# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
# CONFIG_NETFILTER_XT_MATCH_REALM is not set
# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set
# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set
# CONFIG_NETFILTER_XT_MATCH_STRING is not set
# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set
# CONFIG_NETFILTER_XT_MATCH_TIME is not set
# CONFIG_NETFILTER_XT_MATCH_U32 is not set
# CONFIG_NETFILTER_XT_SET is not set
# CONFIG_NETFILTER_XT_TARGET_AUDIT is not set
# CONFIG_NETFILTER_XT_TARGET_CHECKSUM is not set
# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set
# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
# CONFIG_NETFILTER_XT_TARGET_HL is not set
# CONFIG_NETFILTER_XT_TARGET_HMARK is not set
# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set
# CONFIG_NETFILTER_XT_TARGET_LED is not set
# CONFIG_NETFILTER_XT_TARGET_MARK is not set
# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
# CONFIG_NETFILTER_XT_TARGET_TEE is not set
# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set
# CONFIG_NET_9P_DEBUG is not set
CONFIG_NET_9P_VIRTIO=y
# CONFIG_NET_ACT_CONNMARK is not set
# CONFIG_NET_ACT_CTINFO is not set
# CONFIG_NET_EMATCH_IPSET is not set
CONFIG_NET_UDP_TUNNEL=y
# CONFIG_NF_CONNTRACK_AMANDA is not set
# CONFIG_NF_CONNTRACK_EVENTS is not set
# CONFIG_NF_CONNTRACK_H323 is not set
CONFIG_NF_CONNTRACK_MARK=y
# CONFIG_NF_CONNTRACK_PPTP is not set
# CONFIG_NF_CONNTRACK_SANE is not set
# CONFIG_NF_CONNTRACK_SNMP is not set
# CONFIG_NF_CONNTRACK_TFTP is not set
# CONFIG_NF_CONNTRACK_TIMEOUT is not set
# CONFIG_NF_CONNTRACK_TIMESTAMP is not set
# CONFIG_NF_CONNTRACK_ZONES is not set
CONFIG_NF_CT_PROTO_DCCP=y
CONFIG_NF_CT_PROTO_SCTP=y
CONFIG_NF_CT_PROTO_UDPLITE=y
CONFIG_OSF_PARTITION=y
# CONFIG_OVERLAY_FS_INDEX is not set
# CONFIG_OVERLAY_FS_METACOPY is not set
CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW=y
CONFIG_OVERLAY_FS_REDIRECT_DIR=y
# CONFIG_OVERLAY_FS_XINO_AUTO is not set
CONFIG_PARAVIRT=y
CONFIG_PARAVIRT_CLOCK=y
# CONFIG_PARAVIRT_DEBUG is not set
# CONFIG_PARAVIRT_SPINLOCKS is not set
# CONFIG_PARAVIRT_TIME_ACCOUNTING is not set
# CONFIG_PCIEAER_INJECT is not set
# CONFIG_PCIE_DPC is not set
# CONFIG_PCIE_ECRC is not set
CONFIG_PTP_1588_CLOCK_KVM=y
# CONFIG_PTP_1588_CLOCK_VMW is not set
# CONFIG_PVH is not set
CONFIG_SGI_PARTITION=y
# CONFIG_SKFP is not set
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_SEQ_MIDI_EVENT=y
CONFIG_SOLARIS_X86_PARTITION=y
CONFIG_SOUND_OSS_CORE=y
CONFIG_SOUND_OSS_CORE_PRECLAIM=y
CONFIG_SUN_PARTITION=y
# CONFIG_SYSV68_PARTITION is not set
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
# CONFIG_ULTRIX_PARTITION is not set
CONFIG_UNIXWARE_DISKLABEL=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_BLK=y
CONFIG_VIRTIO_INPUT=y
# CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES is not set
CONFIG_VIRTIO_NET=y
CONFIG_VIRTIO_PCI_LEGACY=y
CONFIG_X86_HV_CALLBACK_VECTOR=y
# CONFIG_X86_X2APIC is not set
# CONFIG_XEN is not set

@ -0,0 +1,17 @@
#!/bin/sh
# Sourced by scripts/kernel-test/initrd-build.sh
initrd_add_mod \
gtp \
tun
initrd_add_bin \
osmo-ggsn
initrd_add_file \
/data/osmo-ggsn.cfg
initrd_add_cmd \
"ip addr add 172.18.3.201/24 brd 172.18.3.255 dev eth0" \
"ip route add default via 172.18.3.1 dev eth0" \
"osmo-ggsn -c /data/osmo-ggsn.cfg"

@ -1,6 +1,14 @@
#!/bin/sh
# Environment variables:
# * KERNEL_TEST: set to 1 to run osmo-ggsn with the kernel module in QEMU
# * KERNEL_BUILD: set to 1 to build the kernel instead of using a pre-built one
# * KERNEL_REMOTE_NAME: git remote name (to add multiple repos in the same local linux clone)
# * KERNEL_URL: git remote url
# * KERNEL_BRANCH: branch to checkout
. ../jenkins-common.sh
KERNEL_TEST="${KERNEL_TEST:-0}"
IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}"
docker_images_require \
"osmo-ggsn-$IMAGE_SUFFIX" \
@ -13,23 +21,48 @@ mkdir $VOL_BASE_DIR/ggsn-tester
cp GGSN_Tests.cfg $VOL_BASE_DIR/ggsn-tester/
mkdir $VOL_BASE_DIR/ggsn
cp osmo-ggsn.cfg $VOL_BASE_DIR/ggsn/
SUBNET=3
network_create $SUBNET
# start container with ggsn in background
GGSN_CMD="osmo-ggsn -c /data/osmo-ggsn.cfg"
GGSN_DOCKER_ARGS=""
if [ "$KERNEL_TEST" = "1" ]; then
cp osmo-ggsn-kernel-gtp.cfg $VOL_BASE_DIR/ggsn/osmo-ggsn.cfg
kernel_test_prepare \
"defconfig" \
"fragment.config" \
"initrd-ggsn.sh" \
"$REPO_USER/osmo-ggsn-$IMAGE_SUFFIX" \
-v $VOL_BASE_DIR/ggsn:/data
GGSN_CMD="/kernel-test/run-qemu.sh"
GGSN_DOCKER_ARGS="
$(docker_network_params $SUBNET 200)
--device /dev/kvm:/dev/kvm
-v "$KERNEL_TEST_DIR:/kernel-test:ro"
-v "$CACHE_DIR:/cache"
"
else
cp osmo-ggsn.cfg $VOL_BASE_DIR/ggsn/
GGSN_DOCKER_ARGS="
$(docker_network_params $SUBNET 201)
"
fi
docker run --cap-add=NET_ADMIN \
--device /dev/net/tun:/dev/net/tun \
--sysctl net.ipv6.conf.all.disable_ipv6=0 \
--rm \
$(docker_network_params $SUBNET 201) \
--ulimit core=-1 \
-v $VOL_BASE_DIR/ggsn:/data \
--name ${BUILD_TAG}-ggsn -d \
$DOCKER_ARGS \
$GGSN_DOCKER_ARGS \
$REPO_USER/osmo-ggsn-$IMAGE_SUFFIX \
/bin/sh -c "osmo-ggsn -c /data/osmo-ggsn.cfg >/data/osmo-ggsn.log 2>&1"
/bin/sh -c "$GGSN_CMD >/data/osmo-ggsn.log 2>&1"
# start docker container with testsuite in foreground
docker run --rm \

@ -0,0 +1,59 @@
!
! OpenGGSN (0.94.1-adac) configuration saved from vty
!!
!
log gsmtap 172.18.3.202
logging level set-all debug
logging filter all 1
!
log stderr
logging filter all 1
logging color 1
logging print category 1
logging timestamp 1
logging print extended-timestamp 1
logging level ip info
logging level tun info
logging level ggsn info
logging level sgsn notice
logging level icmp6 debug
logging level lglobal notice
logging level llapd notice
logging level linp notice
logging level lmux notice
logging level lmi notice
logging level lmib notice
logging level lsms notice
logging level lctrl notice
logging level lgtp info
logging level lstats notice
logging level lgsup notice
logging level loap notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice
logging level lmgcp notice
!
stats interval 5
!
line vty
no login
bind 0.0.0.0
!
ggsn ggsn0
gtp state-dir /tmp
gtp bind-ip 172.18.3.201
apn internet
gtpu-mode kernel-gtp
tun-device tun4
type-support v4
ip prefix dynamic 176.16.222.0/24
ip dns 0 172.18.3.201
ip dns 1 8.8.8.8
ip ifconfig 176.16.222.0/24
no shutdown
# apn inet6
# apn inet46
default-apn internet
no shutdown ggsn
Loading…
Cancel
Save