bsc: fix shutdown

Change-Id: I23932927bd6bb9b5e447acbeafc2748a77513a0d
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 07f2ac7..a2111fd 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -110,6 +110,12 @@
 }
 
 private function f_shutdown_helper() runs on test_CT {
+	for (var integer i := 0; i < NUM_BTS; i := i+1) {
+		if (isbound(bts[i]) and isbound(bts[i].rsl)) {
+			f_ipa_rsl_stop(bts[i].rsl);
+		}
+	}
+	f_ipa_ctrl_stop();
 	all port.stop;
 	setverdict(pass);
 }
@@ -195,6 +201,16 @@
 	}
 }
 
+function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT {
+	if (not isbound(clnt) or not isbound(clnt.vc_IPA)) {
+		return;
+	}
+	clnt.vc_IPA.stop;
+	if (isbound(clnt.vc_RSL)) {
+		clnt.vc_RSL.stop;
+	}
+}
+
 /* 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;