Change in osmo-ttcn3-hacks[master]: BSC_Tests: Add tests to check channel allocator

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Jan 29 12:49:47 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/12620 )

Change subject: BSC_Tests: Add tests to check channel allocator
......................................................................

BSC_Tests: Add tests to check channel allocator

When a channel is assigned via the assignment request throught the A
interface, the MSC may offer either FR, HR or both. When FR and HR are
permitted, a preference is set on one of the two.

At the moment we do not check how the bsc is reacting to those
preferences and its also not checked how the behavior is when the
preferred rate is not available because all lchan of that type are
already in use. Lets add a set of tests to verify this.

Change-Id: I109d986dd7ece1a56422a669ca64353ed46f7ed6
Depends: osmo-bsc I397e68e26d6a1727890353fa34f4897b54795866
Related: OS#3503
---
M bsc/BSC_Tests.ttcn
M bsc/expected-results.xml
2 files changed, 304 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 77da306..a6f9f7d 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -2053,6 +2053,289 @@
 	vc_conn.done;
 }
 
+private function f_disable_all_tch_f() runs on test_CT {
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 disable");
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 disable");
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 disable");
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 disable");
+}
+
+private function f_disable_all_tch_h() runs on test_CT {
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 disable");
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 1 disable");
+}
+
+private function f_enable_all_tch() runs on test_CT {
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 enable");
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 enable");
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 enable");
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 enable");
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 enable");
+	f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 1 enable");
+}
+
+/* Allow HR only */
+private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR}));
+	f_establish_fully(ass_cmd, exp_compl);
+}
+
+/* Allow FR only */
+private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
+	f_establish_fully(ass_cmd, exp_compl);
+}
+
+/* Allow HR only (expect assignment failure) */
+private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail;
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR}));
+	f_establish_fully(ass_cmd, exp_fail);
+}
+
+/* Allow FR only (expect assignment failure) */
+private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail;
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
+	f_establish_fully(ass_cmd, exp_fail);
+}
+
+/* Allow FR and HR, but prefer FR */
+private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR}));
+	exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */
+	f_establish_fully(ass_cmd, exp_compl);
+}
+
+/* Allow FR and HR, but prefer HR */
+private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR}));
+	exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */
+	f_establish_fully(ass_cmd, exp_compl);
+}
+
+/* Allow FR and HR, but prefer FR */
+private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR}));
+	exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */
+	f_establish_fully(ass_cmd, exp_compl);
+}
+
+/* Allow FR and HR, but prefer HR */
+private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR}));
+	exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */
+	f_establish_fully(ass_cmd, exp_compl);
+}
+
+/* Request a HR channel while all FR channels are exhausted, this is expected
+ * to work without conflicts */
+testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	f_enable_all_tch();
+	f_disable_all_tch_f();
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr));
+	vc_conn.done;
+	f_enable_all_tch();
+	setverdict(pass);
+}
+
+/* Request a FR channel while all FR channels are exhausted, this is expected
+ * to fail. */
+testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	f_enable_all_tch();
+	f_disable_all_tch_f();
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail));
+	vc_conn.done;
+	f_enable_all_tch();
+	setverdict(pass);
+}
+
+/* Request a FR (prefered) or alternatively a HR channel while all FR channels
+ * are exhausted, this is expected to be resolved by selecting a HR channel. */
+testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	f_enable_all_tch();
+	f_disable_all_tch_f();
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr));
+	vc_conn.done;
+	f_enable_all_tch();
+	setverdict(pass);
+}
+
+/* Request a HR (prefered) or alternatively a FR channel while all FR channels
+ * are exhausted, this is expected to work without conflicts. */
+testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	f_enable_all_tch();
+	f_disable_all_tch_f();
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr));
+	vc_conn.done;
+	f_enable_all_tch();
+	setverdict(pass);
+}
+
+/* Request a FR channel while all HR channels are exhausted, this is expected
+ * to work without conflicts */
+testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	f_enable_all_tch();
+	f_disable_all_tch_h();
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr));
+	vc_conn.done;
+	f_enable_all_tch();
+	setverdict(pass);
+}
+
+/* Request a HR channel while all HR channels are exhausted, this is expected
+ * to fail. */
+testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	f_enable_all_tch();
+	f_disable_all_tch_h();
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail));
+	vc_conn.done;
+	f_enable_all_tch();
+	setverdict(pass);
+}
+
+/* Request a HR (prefered) or alternatively a FR channel while all HR channels
+ * are exhausted, this is expected to be resolved by selecting a FR channel. */
+testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	f_enable_all_tch();
+	f_disable_all_tch_h();
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr));
+	vc_conn.done;
+	f_enable_all_tch();
+	setverdict(pass);
+}
+
+/* Request a FR (prefered) or alternatively a HR channel while all HR channels
+ * are exhausted, this is expected to work without conflicts. */
+testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	f_enable_all_tch();
+	f_disable_all_tch_h();
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr));
+	vc_conn.done;
+	f_enable_all_tch();
+	setverdict(pass);
+}
+
+/* Allow FR and HR, but prefer HR */
+private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR}));
+	exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */
+	f_establish_fully(ass_cmd, exp_compl);
+}
+
+/* Allow FR and HR, but prefer FR */
+private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O;
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR}));
+	exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */
+	f_establish_fully(ass_cmd, exp_compl);
+}
+
+/* Request a HR (prefered) or alternatively a FR channel, it is expected that
+ * HR, which is the prefered type, is selected. */
+testcase TC_assignment_codec_req_hr_fr() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	f_enable_all_tch();
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr));
+	vc_conn.done;
+	setverdict(pass);
+}
+
+/* Request a FR (prefered) or alternatively a HR channel, it is expected that
+ * FR, which is the prefered type, is selected. */
+testcase TC_assignment_codec_req_fr_hr() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	f_init(1, true);
+	f_sleep(1.0);
+	f_enable_all_tch();
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr));
+	vc_conn.done;
+	setverdict(pass);
+}
+
 /* test the procedure of the MSC requesting a Classmark Update:
  * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY,
  * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */
@@ -3444,6 +3727,17 @@
 	execute( TC_assignment_codec_amr_f() );
 	execute( TC_assignment_codec_amr_h() );
 
+	execute( TC_assignment_codec_fr_exhausted_req_hr() );
+	execute( TC_assignment_codec_fr_exhausted_req_fr() );
+	execute( TC_assignment_codec_fr_exhausted_req_fr_hr() );
+	execute( TC_assignment_codec_fr_exhausted_req_hr_fr() );
+	execute( TC_assignment_codec_hr_exhausted_req_fr() );
+	execute( TC_assignment_codec_hr_exhausted_req_hr() );
+	execute( TC_assignment_codec_hr_exhausted_req_hr_fr() );
+	execute( TC_assignment_codec_hr_exhausted_req_fr_hr() );
+	execute( TC_assignment_codec_req_hr_fr() );
+	execute( TC_assignment_codec_req_fr_hr() );
+
 	/* RLL Establish Indication on inactive DCHAN / SAPI */
 	execute( TC_rll_est_ind_inact_lchan() );
 	execute( TC_rll_est_ind_inval_sapi1() );
diff --git a/bsc/expected-results.xml b/bsc/expected-results.xml
index ccd2928..dadb349 100644
--- a/bsc/expected-results.xml
+++ b/bsc/expected-results.xml
@@ -35,6 +35,16 @@
   <testcase classname='BSC_Tests' name='TC_assignment_codec_efr' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_assignment_codec_amr_f' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_assignment_codec_amr_h' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_codec_fr_exhausted_req_hr' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_codec_fr_exhausted_req_fr' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_codec_fr_exhausted_req_fr_hr' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_codec_fr_exhausted_req_hr_fr' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_codec_hr_exhausted_req_fr' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_codec_hr_exhausted_req_hr' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_codec_hr_exhausted_req_hr_fr' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_codec_hr_exhausted_req_fr_hr' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_codec_req_hr_fr' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_codec_req_fr_hr' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_rll_est_ind_inact_lchan' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_rll_est_ind_inval_sapi1' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_rll_est_ind_inval_sapi3' time='MASKED'/>

-- 
To view, visit https://gerrit.osmocom.org/12620
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I109d986dd7ece1a56422a669ca64353ed46f7ed6
Gerrit-Change-Number: 12620
Gerrit-PatchSet: 5
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190129/64ab5f4a/attachment.htm>


More information about the gerrit-log mailing list