bsc: add TC_assignment_codec_amr_startmode_cruft

Make sure that when a 'start-mode auto' is set, that the previous start
mode setting does not linger in the unused bits.

- after I577ff590d7588fd7e3ee4846c7955ab8f84cf2b1, osmo-bsc sets its
  ICMI bit properly, but passes this test only because it *always* sends
  smod (start-mode) bits as zero.

- in I49691df01745a7c485bf165e897872c35fc4b147, the smod bits are
  properly sent on RSL, but this test shows that when ICMI becomes zero
  for 'start-mode auto', the smod bits will remain whatever start-mode
  was set in the previous osmo-bsc config. Instead, osmo-bsc should
  clear the smod bits for 'start-mode auto' so that its MultiRate Config
  does not vary depending on what was previously configured.

- in I1ec5bad0bce01cc425ee05ecf70c83ec662a226a, clearing smod is
  implemented and this test is expected to pass.

Change-Id: I151678f64e680f30f35b6bb2b0036d63efde9f2c
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 251801b..7c12559 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -3711,6 +3711,42 @@
 	f_vty_amr_start_mode_restore(false);
 }
 
+/* 'amr start-mode auto' should not keep the (unused) 'smod' bits from previous configuration */
+testcase TC_assignment_codec_amr_startmode_cruft() runs on test_CT {
+	var TestHdlrParams pars := f_gen_test_hdlr_pars();
+	var MSC_ConnHdlr vc_conn;
+
+	var RSL_IE_Body mr_conf := {
+		other := {
+			len := 2,
+			payload := '2004'O /* <- expect ICMI=0, smod=00 */
+		}
+	};
+
+	pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F}));
+	pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */
+	pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B;
+	pars.expect_mr_conf_ie := mr_conf;
+
+	f_init(1, true);
+	f_sleep(1.0);
+
+	/* First set nonzero start mode bits */
+	f_vty_amr_start_mode_set(true, "4");
+	/* Now set to auto, and expect the startmode bits to be zero in the message, i.e. ensure that osmo-bsc does not
+	 * let the startmode bits stick around and has deterministic MultiRate config for 'start-mode auto'; that is
+	 * ensured by above '2004'O, where 'x0xx'O indicates ICMI = 0, spare = 0, smod = 00. */
+	f_vty_amr_start_mode_set(true, "auto");
+
+	vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars);
+	vc_conn.done;
+	f_shutdown_helper();
+
+	/* Clear the startmode bits to not affect subsequent tests, in case the bits should indeed stick around. */
+	f_vty_amr_start_mode_set(true, "1");
+	f_vty_amr_start_mode_restore(true);
+}
+
 function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0,
 	charstring start_mode := "1")
 runs on test_CT {
@@ -8415,6 +8451,7 @@
 		execute( TC_assignment_codec_amr_h_S7() );
 		execute( TC_assignment_codec_amr_f_start_mode_auto() );
 		execute( TC_assignment_codec_amr_h_start_mode_auto() );
+		execute( TC_assignment_codec_amr_startmode_cruft() );
 	}
 
 	execute( TC_assignment_codec_fr_exhausted_req_hr() );