summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-03-13 14:15:23 +0100
committerHarald Welte <laforge@gnumonks.org>2019-03-19 13:29:31 +0000
commitd0e64b07dda3c551a485eb60a243ba04f2e9d720 (patch)
treef2416d7eb3c9c49bfcb33f5c730e64fc45aafb36
parent806f8f1fb48798277501aab786085dc11bcc6a2a (diff)
BSC_Tests: add testcases to verify S15-S0 handling
The handling of the AMR rate configuration bits S15-S0 is currently only superficially checked. Lets add more some more elaborated testcases to check through varios different situations. Also make sure that the resulting mr configuration IE is verified Change-Id: Ica323deb9836deea72982e093c9cb31deb5a216b Related: SYS#4470
-rw-r--r--bsc/BSC_Tests.ttcn222
-rw-r--r--bsc/MSC_ConnectionHandler.ttcn2
-rw-r--r--library/Osmocom_VTY_Functions.ttcn6
3 files changed, 230 insertions, 0 deletions
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 58001e5..659b3f6 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1953,6 +1953,10 @@ private function f_TC_assignment_codec(charstring id) runs on MSC_ConnHdlr {
ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list;
exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] :=
g_pars.ass_codec_list.codecElements[0];
+ if (isvalue(g_pars.expect_mr_s0_s7)) {
+ exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 :=
+ g_pars.expect_mr_s0_s7;
+ }
}
ass_cmd.pdu.bssmap.assignmentRequest.channelType :=
f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]);
@@ -1994,6 +1998,22 @@ private function f_TC_assignment_codec(charstring id) runs on MSC_ConnHdlr {
}
}
+private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr {
+
+ var PDU_BSSAP ass_cmd := f_gen_ass_req();
+ var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail;
+
+ /* puzzle together the ASSIGNMENT REQ for given codec[s] */
+ if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) {
+ ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list;
+ }
+ ass_cmd.pdu.bssmap.assignmentRequest.channelType :=
+ f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]);
+ log("expecting ASS FAIL like this: ", exp_fail);
+
+ f_establish_fully(ass_cmd, exp_fail);
+}
+
testcase TC_assignment_codec_fr() runs on test_CT {
var TestHdlrParams pars := f_gen_test_hdlr_pars();
var MSC_ConnHdlr vc_conn;
@@ -2030,6 +2050,37 @@ testcase TC_assignment_codec_efr() runs on test_CT {
vc_conn.done;
}
+/* Allow 5,90k only (current default config) */
+private function f_allow_amr_rate_5_90k() runs on test_CT {
+ f_vty_enter_cfg_msc(BSCVTY, 0);
+ f_vty_transceive(BSCVTY, "amr-config 12_2k forbidden");
+ f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden");
+ f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden");
+ f_vty_transceive(BSCVTY, "amr-config 7_40k forbidden");
+ f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden");
+ f_vty_transceive(BSCVTY, "amr-config 5_90k allowed");
+ f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden");
+ f_vty_transceive(BSCVTY, "amr-config 4_75k forbidden");
+ f_vty_transceive(BSCVTY, "exit");
+ f_vty_transceive(BSCVTY, "exit");
+}
+
+/* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates
+ * ("Config-NB-Code = 1") */
+private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT {
+ f_vty_enter_cfg_msc(BSCVTY, 0);
+ f_vty_transceive(BSCVTY, "amr-config 12_2k allowed");
+ f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden");
+ f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden");
+ f_vty_transceive(BSCVTY, "amr-config 7_40k allowed");
+ f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden");
+ f_vty_transceive(BSCVTY, "amr-config 5_90k allowed");
+ f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden");
+ f_vty_transceive(BSCVTY, "amr-config 4_75k allowed");
+ f_vty_transceive(BSCVTY, "exit");
+ f_vty_transceive(BSCVTY, "exit");
+}
+
testcase TC_assignment_codec_amr_f() runs on test_CT {
var TestHdlrParams pars := f_gen_test_hdlr_pars();
var MSC_ConnHdlr vc_conn;
@@ -2080,6 +2131,160 @@ testcase TC_assignment_codec_amr_h() runs on test_CT {
vc_conn.done;
}
+function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0)
+runs on test_CT {
+
+ var TestHdlrParams pars := f_gen_test_hdlr_pars();
+ var MSC_ConnHdlr vc_conn;
+
+ /* See note above */
+ var RSL_IE_Body mr_conf := {
+ other := {
+ len := lengthof(mrconf),
+ payload := mrconf
+ }
+ };
+
+ if (fr) {
+ pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F}));
+ } else {
+ pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H}));
+ }
+ pars.ass_codec_list.codecElements[0].s0_7 := s8_s0;
+ pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B;
+ pars.expect_mr_conf_ie := mr_conf;
+ pars.expect_mr_s0_s7 := exp_s8_s0;
+
+ f_init(1, true);
+ f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k();
+ f_sleep(1.0);
+
+ vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars);
+ vc_conn.done;
+ f_allow_amr_rate_5_90k();
+}
+
+function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0)
+runs on test_CT {
+
+ var TestHdlrParams pars := f_gen_test_hdlr_pars();
+ var MSC_ConnHdlr vc_conn;
+
+ if (fr) {
+ pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F}));
+ } else {
+ pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H}));
+ }
+ pars.ass_codec_list.codecElements[0].s0_7 := s8_s0;
+ pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B;
+
+ f_init(1, true);
+ f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k();
+ f_sleep(1.0);
+
+ vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars);
+ vc_conn.done;
+ f_allow_amr_rate_5_90k();
+}
+
+
+/* Set S1, we expect an AMR multirate configuration IE with all four rates
+ * set. */
+testcase TC_assignment_codec_amr_f_S1() runs on test_CT {
+ f_TC_assignment_codec_amr(true, '289520882208'O, '00000010'B, '00000010'B);
+}
+
+/* Set S1, we expect an AMR multirate configuration IE with the lower three
+ * rates set. */
+testcase TC_assignment_codec_amr_h_S1() runs on test_CT {
+ f_TC_assignment_codec_amr(false, '2815208820'O, '00000010'B, '00000010'B);
+}
+
+/* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with
+ * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */
+testcase TC_assignment_codec_amr_f_S124() runs on test_CT {
+ f_TC_assignment_codec_amr(true, '289520882208'O, '00010110'B, '00000010'B);
+}
+
+/* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with
+ * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */
+testcase TC_assignment_codec_amr_h_S124() runs on test_CT {
+ f_TC_assignment_codec_amr(false, '2815208820'O, '00010110'B, '00000010'B);
+}
+
+/* The following block of tests selects more and more rates until all four
+ * possible rates are in the active set (full rate) */
+testcase TC_assignment_codec_amr_f_S0() runs on test_CT {
+ f_TC_assignment_codec_amr(true, '2801'O, '00000001'B, '00000001'B);
+}
+
+testcase TC_assignment_codec_amr_f_S02() runs on test_CT {
+ f_TC_assignment_codec_amr(true, '28052080'O, '00000101'B, '00000101'B);
+}
+
+testcase TC_assignment_codec_amr_f_S024() runs on test_CT {
+ f_TC_assignment_codec_amr(true, '2815208820'O, '00010101'B, '00010101'B);
+}
+
+testcase TC_assignment_codec_amr_f_S0247() runs on test_CT {
+ f_TC_assignment_codec_amr(true, '289520882208'O, '10010101'B, '10010101'B);
+}
+
+/* The following block of tests selects more and more rates until all three
+ * possible rates are in the active set (half rate) */
+testcase TC_assignment_codec_amr_h_S0() runs on test_CT {
+ f_TC_assignment_codec_amr(false, '2801'O, '00000001'B, '00000001'B);
+}
+
+testcase TC_assignment_codec_amr_h_S02() runs on test_CT {
+ f_TC_assignment_codec_amr(false, '28052080'O, '00000101'B, '00000101'B);
+}
+
+testcase TC_assignment_codec_amr_h_S024() runs on test_CT {
+ f_TC_assignment_codec_amr(false, '2815208820'O, '00010101'B, '00010101'B);
+}
+
+/* The following block tests what happens when the MSC does offer rate
+ * configurations that are not supported by the BSC. Normally such situations
+ * should not happen because the MSC gets informed by the BSC in advance via
+ * the L3 COMPLETE message which rates are applicable. The MSC should not try
+ * to offer rates that are not applicable anyway. */
+
+testcase TC_assignment_codec_amr_h_S0247() runs on test_CT {
+ /* Try to include 12,2k in into the active set even though the channel
+ * is half rate only. The BSC is expected to remove the 12,0k */
+ f_TC_assignment_codec_amr(false, '2815208820'O, '10010101'B, '00010101'B);
+}
+
+testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT {
+ /* See what happens when all rates are selected at once. Since then
+ * Also S1 is selected, this setting will be prefered and we should
+ * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */
+ f_TC_assignment_codec_amr(true, '289520882208'O, '11111111'B, '00000010'B);
+}
+
+testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT {
+ /* Same as above, but with S1 missing, the MSC is then expected to
+ * select the currently supported rates, which are also 12.2k, 7,40k,
+ * 5,90k, and 4,75k, into the active set. */
+ f_TC_assignment_codec_amr(true, '289520882208'O, '11111101'B, '10010101'B);
+}
+
+testcase TC_assignment_codec_amr_f_zero() runs on test_CT {
+ /* Try to select no rates at all */
+ f_TC_assignment_codec_amr_fail(true, '00000000'B);
+}
+
+testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT {
+ /* Try to select only unsupported rates */
+ f_TC_assignment_codec_amr_fail(true, '01101000'B);
+}
+
+testcase TC_assignment_codec_amr_h_S7() runs on test_CT {
+ /* Try to select 12,2k for half rate */
+ f_TC_assignment_codec_amr_fail(false, '10000000'B);
+}
+
private function f_disable_all_tch_f() runs on test_CT {
f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken");
f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken");
@@ -3753,6 +3958,23 @@ control {
execute( TC_assignment_codec_efr() );
execute( TC_assignment_codec_amr_f() );
execute( TC_assignment_codec_amr_h() );
+ execute( TC_assignment_codec_amr_f_S1() );
+ execute( TC_assignment_codec_amr_h_S1() );
+ execute( TC_assignment_codec_amr_f_S124() );
+ execute( TC_assignment_codec_amr_h_S124() );
+ execute( TC_assignment_codec_amr_f_S0() );
+ execute( TC_assignment_codec_amr_f_S02() );
+ execute( TC_assignment_codec_amr_f_S024() );
+ execute( TC_assignment_codec_amr_f_S0247() );
+ execute( TC_assignment_codec_amr_h_S0() );
+ execute( TC_assignment_codec_amr_h_S02() );
+ execute( TC_assignment_codec_amr_h_S024() );
+ execute( TC_assignment_codec_amr_h_S0247() );
+ execute( TC_assignment_codec_amr_f_S01234567() );
+ execute( TC_assignment_codec_amr_f_S0234567() );
+ execute( TC_assignment_codec_amr_f_zero() );
+ execute( TC_assignment_codec_amr_f_unsupp() );
+ execute( TC_assignment_codec_amr_h_S7() );
execute( TC_assignment_codec_fr_exhausted_req_hr() );
execute( TC_assignment_codec_fr_exhausted_req_fr() );
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 0ea73a0..96797c9 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -426,6 +426,7 @@ type record TestHdlrParams {
integer media_nr, /* determins MGCP EP, port numbers */
BSSMAP_IE_SpeechCodecList ass_codec_list optional,
RSL_IE_Body expect_mr_conf_ie optional, /* typically present for AMR codecs */
+ bitstring expect_mr_s0_s7 optional, /* typically present for AMR codecs */
TestHdlrEncrParams encr optional,
TestHdlrParamsLcls lcls,
TestHdlrParamsHandover handover optional,
@@ -443,6 +444,7 @@ template (value) TestHdlrParams t_def_TestHdlrPars := {
media_nr := 1,
ass_codec_list := omit,
expect_mr_conf_ie := omit,
+ expect_mr_s0_s7 := omit,
encr := omit,
lcls := {
gcr := omit,
diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn
index 4f795ad..fde05b3 100644
--- a/library/Osmocom_VTY_Functions.ttcn
+++ b/library/Osmocom_VTY_Functions.ttcn
@@ -90,6 +90,7 @@ module Osmocom_VTY_Functions {
type integer BtsNr (0..255);
type integer BtsTrxNr (0..255);
type integer BtsTimeslotNr (0..7);
+ type integer MscNr (0..255);
type charstring BtsGprsMode ("none", "gprs", "egrps");
@@ -118,6 +119,11 @@ module Osmocom_VTY_Functions {
f_vty_transceive(pt, "timeslot " & int2str(ts));
}
+ function f_vty_enter_cfg_msc(TELNETasp_PT pt, MscNr msc := 0) {
+ f_vty_enter_config(pt);
+ f_vty_transceive(pt, "msc " & int2str(msc));
+ }
+
type record of charstring rof_charstring;
function f_vty_config2(TELNETasp_PT pt, rof_charstring config_nodes, charstring cmd)
{