Project

General

Profile

Titan TTCN3 Notes

Some notes about developing in Titan TTCN3, specifically regarding test cases in the Osmocom universe.

Building / Using test caes

Dependencies

  • You'll need recent enough eclipse-titan installed: 6.2.0 is working fine, 5.5.1 is too old.
    • if you're using Debian packages, you might run into a compile error "The version of GCC does not match the expected version". If you do, it is suggested you edit /usr/include/titan/cversion.h and comment out the related #error line.
  • You'll need a checkout/clone of http://git.osmocom.org/osmo-ttcn3-hacks/

Titan Modules required

The osmo-ttcn3-hacks depend on a variety of other TTCN-3 modules that you have to clone from their respective repositories. Each test suite contains a gen_links.sh script that will generate symlinks from those cloned repositories to the local directory. If you look at gen_links.sh you will see which dependencies the respective test suite has (but not their clone URLs, sorry).

For example, sysinfo/gen_links.sh needs following repositories under BASEDIR directory:

git clone https://github.com/eclipse/titan.TestPorts.IPL4asp.git
git clone https://github.com/eclipse/titan.TestPorts.TELNETasp.git
git clone https://github.com/eclipse/titan.TestPorts.Common_Components.Socket-API.git
git clone https://github.com/eclipse/titan.Libraries.TCCUsefulFunctions.git

See http://git.osmocom.org/docker-playground/tree/debian-stretch-titan/Dockerfile for a full list of dependencies

Test run

For example, to run sysinfo tests do the following:
  • adjust BASEDIR in sysinfo/gen_links.sh to match your environment
  • adjust test configuration in sysinfo/Test.cfg if necessary
    cd sysinfo
    ./gen_links.sh
    ./regen_makefile.sh
    make -j1 compile && make -j8
    cd ..
    ./start-testsuite.sh sysinfo/Test sysinfo/Test.cfg
    

See also https://git.osmocom.org/docker-playground/tree/ttcn3-nitb-sysinfo/

Log files

you will receive log files in the current working directory. You can use the ttcn3_logmerge tool to merge multiple log files based on their timestamps, and you can use the ttcn3_logformat tool to do some human-friendly formatting of the log files. Harald often runs his test suite like:

rm *.log && make -j1 compile && make -j8 && ../start-testsuite.sh MGCP_Test MGCP_Test.cfg && ttcn3_logformat *.log

Development related bits

RAW coder

A lot of the messages (GSMTAP, LAPDm, L1CTL, ...) are described using the Titan extensions to the TTCN-3 type language and the associated RAW coder.

Section 4.23 of the Programmer's Technical Reference Guide for the TITAN TTCN-3 Toolset contains the description of this RAW coder

FIELDORDER

This determines the order of fields within a record or set type.

In (not only) GSM specs, typically the messages are described from first field at top to the last field at the bottom, so the logical choice here is to set "FIELDORDER" as we do in the GMS_Types.ttcn and other files. However, there's one CAVEAT: In GSM 04.08 (and derived specs), Information Elements with 1/2 (4bit) length are ordered un-intitively.

Example: TS 44.018 SYSTEM INFORMATION TYPE 4:

  • L1 Pseudl Length (1)
  • protocol descriptor (1/2)
  • skip indicator (1/2)
  • Message Type (1)

which then translates to:

        type record RrHeader {
                L2PseudoLength  l2_plen,
                uint4_t         skip_indicator,
                uint4_t         rr_protocol_discriminator,
                RrMessageType   message_type
        } with { variant "FIELDORDER(msb)" };

Note the skip_indicator and rr_protocol_discriminator fields are swapped in their order compared to the spec!