This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Stefan Sperling gerrit-no-reply at lists.osmocom.orgStefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/11241 Change subject: Add a TTCN3 test suite for IPA protocol testing ...................................................................... Add a TTCN3 test suite for IPA protocol testing This new test suite allows us to test IPA code in libosmocore and libosmo-netif. Currently only one test is implemented, which sends a chopped IPA ping message and expects to receive an IPA pong. The system under test is any IPA speaker on any TCP port. The default test configuration uses TCP port 3003 (RSL) and works with osmo-bsc and the osmo-bsc-minimal.cfg sample configuration file shipped with osmo-bsc. Change-Id: I246a405414e36a44dc1e308692faab8bf04da0e6 Related: OS#2010 --- M Makefile A ipa/IPA_Tests.cfg A ipa/IPA_Tests.ttcn A ipa/gen_links.sh A ipa/regen_makefile.sh 5 files changed, 165 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/41/11241/1 diff --git a/Makefile b/Makefile index 074e151..0255b0a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SUBDIRS=bsc bsc-nat bts ggsn_tests hlr lapdm mgw msc pcu sccp selftest sgsn sip sysinfo +SUBDIRS=bsc bsc-nat bts ggsn_tests hlr ipa lapdm mgw msc pcu sccp selftest sgsn sip sysinfo NPROC=$(shell nproc 2>/dev/null) ifeq ($(NPROC),) diff --git a/ipa/IPA_Tests.cfg b/ipa/IPA_Tests.cfg new file mode 100644 index 0000000..dba8762 --- /dev/null +++ b/ipa/IPA_Tests.cfg @@ -0,0 +1,18 @@ +[ORDERED_INCLUDE] +# Common configuration, shared between test suites +"../Common.cfg" + +# Local configuration below + +[LOGGING] + +[TESTPORT_PARAMETERS] + +[MODULE_PARAMETERS] +IPA_Tests.mp_ipa_ip := "127.0.0.1" +IPA_Tests.mp_ipa_tcp_port := 3003 + +[MAIN_CONTROLLER] + +[EXECUTE] +IPA_Tests.control diff --git a/ipa/IPA_Tests.ttcn b/ipa/IPA_Tests.ttcn new file mode 100644 index 0000000..ca69687 --- /dev/null +++ b/ipa/IPA_Tests.ttcn @@ -0,0 +1,114 @@ +/* (C) 2018 by sysmocom s.f.m.c. GmbH <info at sysmocom.de> + * Author: Stefan Sperling <ssperling at sysmocom.de> + * All Rights Reserved + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + */ + +module IPA_Tests { + +import from IPL4asp_Types all; +import from IPL4asp_PortType all; +import from IPA_Types all; +import from Osmocom_Types all; + +modulepar { + charstring mp_ipa_ip := "127.0.0.1"; + integer mp_ipa_tcp_port := 3003; +} + +/* Encoded IPA messages (network byte order) */ +const octetstring ipa_msg_ping := '0001FE00'O; +const octetstring ipa_msg_pong := '0001FE01'O; + +type component system_CT { + port IPL4asp_PT IPL4; +} + +type component IPA_CT { + port IPL4asp_PT IPL4; + timer g_Tguard; +} + +private altstep as_Tguard() runs on IPA_CT { + [] g_Tguard.timeout { + setverdict(fail, "Tguard timeout"); + mtc.stop; + } +} + +function f_send_ipa_data(ConnectionId connId, octetstring data) runs on IPA_CT { + var IPL4asp_Types.Result res; + var ASP_SendTo asp := { + connId := connId, + remName := mp_ipa_ip, + remPort := mp_ipa_tcp_port, + proto := {tcp := {}}, + msg := data + }; + IPL4.send(asp); +} + +template ASP_RecvFrom t_recvfrom(octetstring msg) := { + connId := ?, + remName := ?, + remPort := ?, + locName := ?, + locPort := ?, + proto := {tcp := {}}, + userData := ?, + msg := msg +} + +function f_init() runs on IPA_CT return ConnectionId { + var IPL4asp_Types.Result res; + var ConnectionId connId; + + /* Create an IPA connection over TCP. */ + map(self:IPL4, system:IPL4); + res := IPL4asp_PortType.f_IPL4_connect(IPL4, mp_ipa_ip, mp_ipa_tcp_port, "", -1, 0, { tcp:={} }); + if (not ispresent(res.connId)) { + setverdict(fail, "Could not connect IPA socket to ", mp_ipa_ip, " port ", + mp_ipa_tcp_port, "; check your configuration"); + mtc.stop; + } + + /* Activate guard timer. */ + g_Tguard.start(60.0); + activate(as_Tguard()); + + return res.connId; +} + +testcase TC_chopped_ipa_ping() runs on IPA_CT system system_CT { + const float delay := 6.0; + var ConnectionId connId; + var ASP_RecvFrom asp_rx; + + connId := f_init(); + + /* Send a ping message one byte at a time, waiting for TCP buffer to flush between each byte. */ + for (var integer i := 0; i < lengthof(ipa_msg_ping); i := i + 1) { + log("sending byte ", ipa_msg_ping[i]); + f_send_ipa_data(connId, ipa_msg_ping[i]); + f_sleep(delay); + } + + /* Expect a pong response. */ + alt { + [] IPL4.receive(t_recvfrom(ipa_msg_pong)) -> value asp_rx { + log("received pong: ", asp_rx.msg); + setverdict(pass); + } + [] IPL4.receive { + repeat; + } + } +} + +control { + execute( TC_chopped_ipa_ping() ); +} + +} diff --git a/ipa/gen_links.sh b/ipa/gen_links.sh new file mode 100755 index 0000000..5479d9a --- /dev/null +++ b/ipa/gen_links.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +BASEDIR=../deps + +. ../gen_links.sh.inc + +DIR=$BASEDIR/titan.TestPorts.IPL4asp/src +FILES="IPL4asp_Functions.ttcn IPL4asp_PT.cc IPL4asp_PT.hh IPL4asp_PortType.ttcn IPL4asp_Types.ttcn IPL4asp_discovery.cc IPL4asp_protocol_L234.hh" +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src +FILES="Socket_API_Definitions.ttcn" +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src +FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h" +FILES+=" TCCEncoding_Functions.ttcn TCCEncoding.cc " # GSM 7-bit coding +gen_links $DIR $FILES + +DIR=../library +FILES="General_Types.ttcn Osmocom_Types.ttcn IPA_Types.ttcn" + +gen_links $DIR $FILES + +ignore_pp_results diff --git a/ipa/regen_makefile.sh b/ipa/regen_makefile.sh new file mode 100755 index 0000000..8770145 --- /dev/null +++ b/ipa/regen_makefile.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +FILES="*.ttcn TCCConversion.cc TCCInterface.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCEncoding.cc " + +export CPPFLAGS_TTCN3="" + +../regen-makefile.sh IPA_Tests.ttcn $FILES -- To view, visit https://gerrit.osmocom.org/11241 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I246a405414e36a44dc1e308692faab8bf04da0e6 Gerrit-Change-Number: 11241 Gerrit-PatchSet: 1 Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181005/5a4d1953/attachment.htm>