Change in osmo-ttcn3-hacks[master]: bsc a54 tests

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

Hoernchen gerrit-no-reply at lists.osmocom.org
Wed Jun 9 01:53:37 UTC 2021


Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24630 )


Change subject: bsc a54 tests
......................................................................

bsc a54 tests

Change-Id: I4940d06b55824936b94f97649401b691339c2e7d
Related: SYS#5324
---
M bsc/BSC_Tests.ttcn
M bsc/MSC_ConnectionHandler.ttcn
M bsc/expected-results.xml
M bsc/osmo-bsc.cfg
4 files changed, 53 insertions(+), 15 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/30/24630/1

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 41deea1..66206ee 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -3326,7 +3326,17 @@
 	vc_conn.done;
 	f_shutdown_helper();
 }
+testcase TC_ciph_mode_a5_4() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+	var TestHdlrParams pars := f_gen_test_hdlr_pars();
+	pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16)));
 
+	f_init(1, true);
+	f_sleep(1.0);
+	vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars);
+	vc_conn.done;
+	f_shutdown_helper();
+}
 /* establish initial channel, enable ciphering followed by assignment to ciphered channel */
 private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr {
 	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
@@ -3420,13 +3430,11 @@
 	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
 	var PDU_BSSAP ass_cmd := f_gen_ass_req();
 	const OCT8 kc := '0001020304050607'O;
-	const OCT16 kc128 := kc & kc;
+	g_pars.encr := valueof(t_EncrParams('10'O, kc, kc & kc));
 
 	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
 	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
 	f_establish_fully(ass_cmd, exp_compl);
-	f_cipher_mode('10'O, kc, kc128, true);
-	/* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */
 }
 testcase TC_assignment_fr_a5_4() runs on test_CT {
 	var MSC_ConnHdlr vc_conn;
@@ -3439,6 +3447,30 @@
 	f_shutdown_helper();
 }
 
+private function f_tc_assignment_fr_a5_4_fail(charstring id) runs on MSC_ConnHdlr {
+	g_pars := f_gen_test_hdlr_pars();
+	var template PDU_BSSAP exp_compl := f_gen_exp_compl();
+	var PDU_BSSAP ass_cmd := f_gen_ass_req();
+	const OCT8 kc := '0001020304050607'O;
+
+	ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
+	ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
+	f_establish_fully(ass_cmd, exp_compl);
+
+	g_pars.encr := valueof(t_EncrParams('10'O, kc)); // kc128 missing!
+	f_cipher_mode(g_pars.encr, true);
+}
+
+testcase TC_assignment_fr_a5_4_fail() runs on test_CT {
+	var MSC_ConnHdlr vc_conn;
+
+	f_init(1, true);
+	f_sleep(1.0);
+
+	vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4_fail));
+	vc_conn.done;
+	f_shutdown_helper();
+}
 
 private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr {
 	g_pars := f_gen_test_hdlr_pars();
@@ -6698,7 +6730,7 @@
 		/* start ciphering, if requested */
 		if (ispresent(g_pars.encr)) {
 			f_logp(BSCVTY, "start ciphering");
-			f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key);
+			f_cipher_mode(g_pars.encr);
 		}
 	}
 
@@ -8829,9 +8861,11 @@
 	}
 	execute( TC_assignment_fr_a5_3() );
 	execute( TC_assignment_fr_a5_4() );
+	execute( TC_assignment_fr_a5_4_fail() );
 	execute( TC_ciph_mode_a5_0() );
 	execute( TC_ciph_mode_a5_1() );
 	execute( TC_ciph_mode_a5_3() );
+	execute( TC_ciph_mode_a5_4() );
 
 	execute( TC_assignment_codec_fr() );
 	execute( TC_assignment_codec_fr_by_mode_modify() );
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index c29ccd4..bfb4352 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -544,12 +544,14 @@
 
 type record TestHdlrEncrParams {
 	OCT1		enc_alg,
-	octetstring	enc_key
+	octetstring	enc_key,
+	octetstring	enc_kc128 optional
 };
 
-template (value) TestHdlrEncrParams t_EncrParams(OCT1 alg, octetstring key) := {
+template (value) TestHdlrEncrParams t_EncrParams(OCT1 alg, octetstring key, template (omit) octetstring kc128 := omit) := {
 	enc_alg := alg,
-	enc_key := key
+	enc_key := key,
+	enc_kc128 := kc128
 }
 
 type record TestHdlrParamsLcls {
@@ -709,25 +711,25 @@
 	}
 }
 
-function f_cipher_mode(OCT1 alg, OCT8 key, template OCT16 kc128 := omit, boolean exp_fail := false)
+function f_cipher_mode(TestHdlrEncrParams encrp, boolean exp_fail := false)
 runs on MSC_ConnHdlr {
 	var PDU_BSSAP bssap;
 	var RSL_Message rsl;
 	var RSL_AlgId alg_rsl;
 
-	if (isvalue(kc128)) {
-		BSSAP.send(ts_BSSMAP_CipherModeCmdKc128(alg, key, valueof(kc128)));
+	if (isvalue(encrp.enc_kc128)) {
+		BSSAP.send(ts_BSSMAP_CipherModeCmdKc128(encrp.enc_alg, encrp.enc_key, valueof(encrp.enc_kc128)));
 	} else {
-		BSSAP.send(ts_BSSMAP_CipherModeCmd(alg, key));
+		BSSAP.send(ts_BSSMAP_CipherModeCmd(encrp.enc_alg, encrp.enc_key));
 	}
 
 	/* RSL uses a different representation of the encryption algorithm,
 	 * so we need to convert first */
-	alg_rsl := f_chipher_mode_bssmap_to_rsl(alg);
+	alg_rsl := f_chipher_mode_bssmap_to_rsl(encrp.enc_alg);
 
 	alt {
 	/* RSL/UE Side */
-	[] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg_rsl, key)) -> value rsl {
+	[] RSL.receive(tr_RSL_ENCR_CMD(g_chan_nr, ?, alg_rsl, encrp.enc_key)) -> value rsl {
 		var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[3].body.l3_info.payload);
 		log("Rx L3 from net: ", l3);
 		if (ischosen(l3.msgs.rrm.cipheringModeCommand)) {
@@ -1145,7 +1147,7 @@
 
 	/* start ciphering, if requested */
 	if (ispresent(g_pars.encr)) {
-		f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key);
+			f_cipher_mode(g_pars.encr);
 	}
 
 	/* bail out early if no assignment requested */
diff --git a/bsc/expected-results.xml b/bsc/expected-results.xml
index c98d3c7..42bd955 100644
--- a/bsc/expected-results.xml
+++ b/bsc/expected-results.xml
@@ -48,9 +48,11 @@
   <testcase classname='BSC_Tests' name='TC_assignment_fr_a5_1_codec_missing' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_assignment_fr_a5_3' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_assignment_fr_a5_4' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_assignment_fr_a5_4_fail' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_ciph_mode_a5_0' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_ciph_mode_a5_1' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_ciph_mode_a5_3' time='MASKED'/>
+  <testcase classname='BSC_Tests' name='TC_ciph_mode_a5_4' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_assignment_codec_fr' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_assignment_codec_hr' time='MASKED'/>
   <testcase classname='BSC_Tests' name='TC_assignment_codec_efr' time='MASKED'/>
diff --git a/bsc/osmo-bsc.cfg b/bsc/osmo-bsc.cfg
index b64a63d..7b0fa2a 100644
--- a/bsc/osmo-bsc.cfg
+++ b/bsc/osmo-bsc.cfg
@@ -69,7 +69,7 @@
 network
  network country code 1
  mobile network code 1
- encryption a5 0 1 3
+ encryption a5 0 1 3 4
  neci 1
  paging any use tch 0
  handover 1

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24630
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4940d06b55824936b94f97649401b691339c2e7d
Gerrit-Change-Number: 24630
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210609/c3f8478c/attachment.htm>


More information about the gerrit-log mailing list