BSC_Tests: Update readme + source code comments

Change-Id: I7b7d0e504e3e94077d674b464f39bd8851941922
This commit is contained in:
Harald Welte 2017-12-17 19:46:32 +01:00
parent 8d5eead70e
commit 21b46bdb74
2 changed files with 75 additions and 5 deletions

View File

@ -1,5 +1,23 @@
module BSC_Tests {
/* Integration Tests for OsmoBSC
* (C) 2017 by Harald Welte <laforge@gnumonks.org>
* All rights reserved.
*
* Released under the terms of GNU General Public License, Version 2 or
* (at your option) any later version.
*
* This test suite tests OsmoBSC while emulating both multiple BTS + MS as
* well as the MSC. See README for more details.
*
* There are test cases that run in so-called 'handler mode' and test cases
* that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode"
* tests abstract the multiplexing/demultiplexing of multiple SCCP connections
* and/or RSL channels and are hence suitable for higher-level test cases, while
* the "raw" tests directly on top of the CodecPorts are more suitable for lower-
* level testing.
*/
import from General_Types all;
import from Osmocom_Types all;
import from GSM_Types all;
@ -50,37 +68,57 @@ function f_ctrl_get_exp_trx(IPA_CTRL_PT pt, integer bts_nr, integer trx_nr, Ctrl
}
/* per-BTS state which we keep */
type record BTS_State {
/* component reference to the IPA_Client component used for RSL */
IPA_Client rsl
}
type component test_CT extends BSSAP_Adapter_CT {
/* Array of per-BTS state */
var BTS_State bts[NUM_BTS];
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
/* component reference to the IPA_Client component used for CTRL to BSC */
var IPA_Client ctrl;
/* test port for the CTRL interface of the BSC */
port IPA_CTRL_PT IPA_CTRL;
/* are we initialized yet */
var boolean g_initialized := false;
/* global test case guard timer */
timer T_guard := 30.0;
}
modulepar {
/* IP address at which the BSC can be reached */
charstring mp_bsc_ip := "127.0.0.1";
/* port number to which to establish the IPA RSL connections */
integer mp_bsc_rsl_port := 3003;
/* port number to which to establish the IPA CTRL connection */
integer mp_bsc_ctrl_port := 4249;
}
type record IPA_Client {
/* IPA Emulation component reference */
IPA_Emulation_CT vc_IPA,
/* Unit-ID and other CCM parameters to use for IPA client emulation */
IPA_CCM_Parameters ccm_pars,
/* String identifier for this IPA Client */
charstring id,
/* Associated RSL Emulation Component (if any). Only used in "Handler mode" */
RSL_Emulation_CT vc_RSL optional
}
/*! Start the IPA/RSL related bits for one IPA_Client.
* \param clnt IPA_Client for which to establish
* \param bsc_host IP address / hostname of the BSC
* \param bsc_port TCP port number of the BSC
* \param i number identifying this BTS
* \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */
function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i,
boolean handler_mode := false)
runs on test_CT {
@ -124,6 +162,7 @@ runs on test_CT {
}
}
/*! Start the CTRL connection to the specified BSC IP+Port */
function f_ipa_ctrl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i)
runs on test_CT {
timer T := 10.0;
@ -147,7 +186,7 @@ runs on test_CT {
}
}
/* Wait for the OML connection to be brought up by the external osmo-bts-omldummy */
function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT {
timer T := secs_max;
T.start;
@ -168,12 +207,14 @@ function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on t
}
}
/* sleep for given number of (fractional) seconds */
function f_sleep(float seconds) {
timer T := seconds;
T.start;
T.timeout;
}
/* global altstep for global guard timer; also takes care of responding RESET witH RESET-ACK */
altstep as_Tguard() runs on test_CT {
var BSSAP_N_UNITDATA_ind ud_ind;
[] T_guard.timeout { setverdict(fail, "Timeout of T_guard"); }
@ -185,6 +226,9 @@ altstep as_Tguard() runs on test_CT {
}
}
/* global initialization function
* \param nr_bts Number of BTSs we should start/bring up
* \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */
function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false) runs on test_CT {
var integer i;
@ -211,6 +255,7 @@ function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false) runs o
activate(as_Tguard());
}
/* expect to receive a RSL message matching a specified templaten on a given BTS / stream */
function f_exp_ipa_rx(integer bts_nr, template RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0)
runs on test_CT return RSL_Message {
var ASP_RSL_Unitdata rx_rsl_ud;
@ -230,6 +275,7 @@ runs on test_CT return RSL_Message {
return rx_rsl_ud.rsl;
}
/* helper function to transmit RSL on a given BTS/stream */
function f_ipa_tx(integer bts_nr, template RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0)
runs on test_CT {
IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(sid, t_tx));

View File

@ -1,4 +1,24 @@
Integration Tests for OsmoBSC which we can perform from TTCN-3
Integration Tests for OsmoBSC
-----------------------------
This test suite tests OsmoBSC while emulating both multiple BTS + MS as
well as the MSC.
In terms of external entities, you will need to run
* osmo-mgw in order to properly terminate the MGCP commands by the BSC
* osmo-stp as STP between the simulated MSC and osmo-bsc
* 3x osmo-bts-omldummy as this test suite only implements RSL and no OML
The included jenkins.sh script, together with the Dockerfiles from
http://git.osmocom.org/docker-playground/ can be used to run both the
osmo-bsc-under-test as well as the extenal entities and the tester.
Further Test Ideas
------------------
This is a random list of things about things possible to test.
Asterisks '*' are TODO, while 'x' means already implemented.
= exhaustion of resources
@ -28,7 +48,7 @@ x missing CodecList IE
* with no CIC and no AoIP
* with IPv6 Address in AoIP
* with LCLS information
* supported/unsupported/invalid ciphers
x supported/unsupported/invalid ciphers
* supported/unsupported/invalid codecs
* inconsistent channel type + codec + codec-list
* on full BTS -> fail
@ -85,3 +105,7 @@ xxx expect BSC_CTR_PAGING_EXPIRED on T3113 expiration
* changes in BCCH FILLING
* changes in SACCH FILLING
= dynamic TS switching
* TBD