From 78aea10ba6a97438b35d3b85dbe5bfd8d028fe5e Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 24 Apr 2019 17:05:05 +0200 Subject: add osmdevcon2019-iu_3g_testing --- .../bssap_ranap_conditional_altsteps.png | Bin 0 -> 27630 bytes .../bssap_ranap_rename.png | Bin 0 -> 39587 bytes .../cl3_or_initialue.png | Bin 0 -> 20296 bytes .../cl3_or_initialue2.png | Bin 0 -> 44731 bytes .../gsm_control_stack_2g_cs.svg | 635 ++++++++++++++++ .../gsm_control_stack_2g_ps.svg | 620 ++++++++++++++++ .../gsm_control_stack_3g_cs.svg | 823 +++++++++++++++++++++ .../gsm_control_stack_3g_ps.svg | 816 ++++++++++++++++++++ .../msc_iu_testcase.png | Bin 0 -> 94593 bytes .../osmodevcon2019-iu_3g_testing.adoc | 221 ++++++ 10 files changed, 3115 insertions(+) create mode 100644 2019/osmodevcon2019-iu_3g_testing/bssap_ranap_conditional_altsteps.png create mode 100644 2019/osmodevcon2019-iu_3g_testing/bssap_ranap_rename.png create mode 100644 2019/osmodevcon2019-iu_3g_testing/cl3_or_initialue.png create mode 100644 2019/osmodevcon2019-iu_3g_testing/cl3_or_initialue2.png create mode 100644 2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_2g_cs.svg create mode 100644 2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_2g_ps.svg create mode 100644 2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_3g_cs.svg create mode 100644 2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_3g_ps.svg create mode 100644 2019/osmodevcon2019-iu_3g_testing/msc_iu_testcase.png create mode 100644 2019/osmodevcon2019-iu_3g_testing/osmodevcon2019-iu_3g_testing.adoc (limited to '2019/osmodevcon2019-iu_3g_testing') diff --git a/2019/osmodevcon2019-iu_3g_testing/bssap_ranap_conditional_altsteps.png b/2019/osmodevcon2019-iu_3g_testing/bssap_ranap_conditional_altsteps.png new file mode 100644 index 0000000..ceab120 Binary files /dev/null and b/2019/osmodevcon2019-iu_3g_testing/bssap_ranap_conditional_altsteps.png differ diff --git a/2019/osmodevcon2019-iu_3g_testing/bssap_ranap_rename.png b/2019/osmodevcon2019-iu_3g_testing/bssap_ranap_rename.png new file mode 100644 index 0000000..b79a82a Binary files /dev/null and b/2019/osmodevcon2019-iu_3g_testing/bssap_ranap_rename.png differ diff --git a/2019/osmodevcon2019-iu_3g_testing/cl3_or_initialue.png b/2019/osmodevcon2019-iu_3g_testing/cl3_or_initialue.png new file mode 100644 index 0000000..2289ef5 Binary files /dev/null and b/2019/osmodevcon2019-iu_3g_testing/cl3_or_initialue.png differ diff --git a/2019/osmodevcon2019-iu_3g_testing/cl3_or_initialue2.png b/2019/osmodevcon2019-iu_3g_testing/cl3_or_initialue2.png new file mode 100644 index 0000000..2cc8c02 Binary files /dev/null and b/2019/osmodevcon2019-iu_3g_testing/cl3_or_initialue2.png differ diff --git a/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_2g_cs.svg b/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_2g_cs.svg new file mode 100644 index 0000000..88b73a4 --- /dev/null +++ b/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_2g_cs.svg @@ -0,0 +1,635 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_2g_ps.svg b/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_2g_ps.svg new file mode 100644 index 0000000..ffd6aa4 --- /dev/null +++ b/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_2g_ps.svg @@ -0,0 +1,620 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_3g_cs.svg b/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_3g_cs.svg new file mode 100644 index 0000000..dab2e48 --- /dev/null +++ b/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_3g_cs.svg @@ -0,0 +1,823 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_3g_ps.svg b/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_3g_ps.svg new file mode 100644 index 0000000..6dc6219 --- /dev/null +++ b/2019/osmodevcon2019-iu_3g_testing/gsm_control_stack_3g_ps.svg @@ -0,0 +1,816 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/2019/osmodevcon2019-iu_3g_testing/msc_iu_testcase.png b/2019/osmodevcon2019-iu_3g_testing/msc_iu_testcase.png new file mode 100644 index 0000000..87ff311 Binary files /dev/null and b/2019/osmodevcon2019-iu_3g_testing/msc_iu_testcase.png differ diff --git a/2019/osmodevcon2019-iu_3g_testing/osmodevcon2019-iu_3g_testing.adoc b/2019/osmodevcon2019-iu_3g_testing/osmodevcon2019-iu_3g_testing.adoc new file mode 100644 index 0000000..9a2bde6 --- /dev/null +++ b/2019/osmodevcon2019-iu_3g_testing/osmodevcon2019-iu_3g_testing.adoc @@ -0,0 +1,221 @@ +Iu / 3G testing of Osmo{MSC,SGSN,HNBGW} using TTCN-3 +==================================================== +:author: Harald Welte +:copyright: 2019 by Harald Welte (License: CC-BY-SA) +:backend: slidy +:max-width: 45em + + +== Osmocom TTCN-3 Test Suites + +* developed in 2017+2018 +* compiled using Eclipse TITAN +** uses just a command-line compiler + Makefiles +** no IDE needed at all, don't let _Eclipse_ fool you +* containerized in Docker +* executed by Jenkins CI + +== Test Suite Philosophy + +* test one network element (our IUT) +* test external behavior (3GPP and non-3GPP) +* emulate entire environment from TTCN-3 +* don't reuse Osmocom C-code protocol implementations in the tests +* test against independent TTCN-3 implementations! + +== What to test? + +* successful cases +* erroneous cases (no answer, NACK, ...) +** many difficult to reproduce with real phones/devices +* load / resource exhaustion +* spec compliance +* focus on functionality actually relevant to IUT + +== Why TTCN-3 + TITAN + +* TTCN-3 specifically designed for telecom protocol testing +* TITAN team released many telecom protocols in TTCN-3, such as +** BSSAP, L3 (RR/MM/CC), SMS (CP/RP/TP), SS, M3UA, SCCP, GTP, NS, BSSGP, ... +** shortens our test development cycle +** permits us to test against known working industry implementations + +== SGSN_Tests.ttcn so far + +* external interfaces +** Gb (emulates PCU side NS/BSSGP + MS) +** Gp (emulates GGSN) +** GSUP (emulates HLR) +** VTY + +no 3G (IuCS) testing at all + +[graphviz] +---- +digraph G { + rankdir=LR; + SGSN [label="SGSN\nosmo-sgsn",shape="box"]; + ATS [label="ATS\nSGSN_Tests.ttcn"]; + + ATS -> SGSN [label="Gb"]; + SGSN-> ATS [label="Gp (GTP)"]; + ATS -> SGSN [label="VTY"]; +} +---- + +== A vs. Iu + +* In theory, almost identical +** both use one SCCP connection per subscriber / radio channel +** both encapsulate the same Layer3 (DTAP) towards MS/UE +** more or less a 1:1: mapping between BSSMAP and RANAP +*** e.g. COMPLETE LAYER3 INFO -> InitialUeMessage +*** e.g. ASSIGNMENT -> RabAssignment +*** e.g. CLEAR -> IuRelease procedure +* In practise, _things are complicated..._ + +== A interface + +image::gsm_control_stack_2g_cs.svg[width="100%"] + +== Iu-CS interface + +image::gsm_control_stack_3g_cs.svg[width="100%"] + +== What's so special about Iu? + +* not specified in human-readable text/tables, but ASN.1 +* uses rather advanced features of ASN.1 syntax (information object classes) +* uses rather exotic ancoding APER (Aligned Packed Encoding Rules) +* Ericsson didn't release any titan.ProtocolModule.* for Iu + +== TTCN-3 and ASN.1 + +* both TTCN-3 and ASN.1 originate at ITU +** TTCN-3 spec covers "native" use of ASN.1 within TTCN-3 +*** no code generation (e.g. .asn1 -> .ttcn) +*** asn syntax can be directly used from TTCN-3 sources +**** all types are imported into the TTCN3 namespace + +== Name mangling of ASN.1 types in TTCN-3 + +* replace all hyphen with underscore +** e.g. RANAP-PDU -> RANAP_PDU + + +== Eclipse TITAN and ASN.1 + +* Eclipse TITAN can parse the RANAP ASN.1 +** you simply add the *.asn files next to your *.ttcn files when compiling +* ASN.1 compiled directly to C++, no intermediate .ttcn code generated +** makes life a bit hard initially, while you still learn about the mapping of names/types/etc. +* TITAN only supports BER, no other encoding rules like APER + +== BER - APER transcoding + +* we need a transcoder that +** parses RANAP in APER and converts it to BER (Rx) +** parses RANAP in BER and converts it to APER (Tx) +* use which tool to do the job? +** asn1c (APER still not upstream; we don't want to run asn1c on ATS + IUT) +** erlang (we don't want to run an Erlang VM next to every TTCN-3 test) +** ffasn1c (proprietary, but sysmocom has a license and can share generated binary code) + +== libfftranscode + +* binary-only shared library generated by sysmocom, available from http://ftp.osmocom.org/binaries/libfftranscode/ +** contact me if you have a valid use case for running tests on non-x86_64 / non-debian systems +* contains libffasn1c runtime code and ffasn1c-generated code for RANAP, RUA, HNBAP +* can be extended for other APER based protcols like S1AP (LTE) as needed +** contact me if you want to write TTCN3 tests for other protocols + +== Writing RANAP templates + +How to write RANAP templates without a ttcn source file? + +Theory: + +* use binary RANAP packets from pcap files +* feed them into the TITAN decoder +* look at the log output +* copy + paste + customize + +== Problems + +Problems: + + RANAP_Selftests.ttcn:49: Dynamic test case error: While BER-decoding type '@RANAPMIN.RANAP-PDU': While decoding '@RANAPMIN.RANAP-PDU' type: Alternative 'initiatingMessage': While decoding '@RANAPMIN.InitiatingMessage' type: Component 'value_': While checking tags (expecting [2]): Tag mismatch: Received: [UNIVERSAL 16]. + +* somehow TITAN cannot parse the BER generate by ffasn1c :( +** this is where I gave up for ~6 months after the first attempt +** I re-visited this in early April 2018 +** one direction (BER encode) could be fixed by hacking runtime library source +** other direction required fix in compiler +** new version of ffasn1c has been released -> works + +== Integrating with existing test suites + +* existing tests are written without planning for 3G +* a lot of what they test is in L3/DTAP and should work over A + IuCS +* how to reuse them with 3G? + +== BSSAP_Emulation -> RAN_Emulation + +image::bssap_ranap_rename.png[width="100%"] + + +== BSSAP_Emulation -> RAN_Emulation + +* copy + paste + edit `BSSAP_CodecPort` -> `RANAP_CodecPort` +* modularize protocol support (build without MGCP/BSSAP) +* rename `f_bssap_*` to `f_ran_adapter_*` +* add config option `cfg.transport == RANAP_TRANSPORT_IuCS` +* connect lower end of `RAN_Emulation` to `RANAP_CodecPort`, not `BSSAP_CodecPort` + +== How does this look to the test case + +* whenever L3 PDUs (DTA) are sent/received: no change +* whenever BSSMAP is transceived: distinguish BSSMAP vs RANAP +* good abstraction using functions can help + +image::bssap_ranap_conditional_altsteps.png[width="100%"] + +== Abstracting the send side + +image::cl3_or_initialue.png[width="100%"] + +image::cl3_or_initialue2.png[width="100%"] + +== Extending a 2G test case to 3G + +image::msc_iu_testcase.png[width="100%"] + +== OsmoSGSN test suite + +* MSC was easy: IuCS is very much like A. +* as opposed to the A interface (MSC) Gb doesn't use SCCP transport +* no similarity between 2G (Gb) and 3G (IuPS) protocol stack + +== Gb interface + +image::gsm_control_stack_2g_ps.svg[width="100%"] + +== Iu-PS interface + +image::gsm_control_stack_3g_ps.svg[width="100%"] + +== OsmoSGSN test suite + +* no concept of "subscriber connection" in 2G / Gb +* 3G IuPS very much like IuCS: SCCP connection per subscriber +* less common infrastructure that can be shared between 2G and 3G tests + +== Further Reading + +* http://git.osmocom.org/osmo-ttcn3-hacks/ +* http://git.osmocom.org/docker-playground/ +* http://osmocom.org/projects/cellular-infrastructure/wiki/Titan_TTCN3_Notes + +== EOF + +End of File -- cgit v1.2.3