BSC CBSP: apply changes to 'cbc' vty section, switch server<->client modes

With Icaa2775cc20a99227dabe38a775ff808b374cf98, osmo-bsc no longer allows
configuring CBSP as both server and client at the same time, and the 'cbc' VTY
section has a different structure.

Adjust the 'cbc' section in osmo-bsc.cfg.

For each CBSP test init, switch osmo-bsc's CBSP link to server or client mode
by new vty command 'cbc' / 'mode (server|client|disabled)'.

Related: Icaa2775cc20a99227dabe38a775ff808b374cf98 (osmo-bsc)
Related: I9e9760121265b3661f1c179610e975cf7a0873f1 (docker-playground)
Related: OS#4702
Change-Id: I7eea0dd39de50ed80af79e0f10c836b8685d8644
diff --git a/bsc/BSC_Tests_CBSP.ttcn b/bsc/BSC_Tests_CBSP.ttcn
index 498f484..3dd6f02 100644
--- a/bsc/BSC_Tests_CBSP.ttcn
+++ b/bsc/BSC_Tests_CBSP.ttcn
@@ -37,6 +37,9 @@
 import from CBSP_Adapter all;
 import from CBSP_CodecPort all;
 
+import from Osmocom_VTY_Functions all;
+import from TELNETasp_PortType all;
+
 modulepar {
 	charstring mp_cbc_ip := "0.0.0.0";
 	integer mp_cbc_port := 48049;
@@ -102,6 +105,14 @@
 	}
 }
 
+private function f_vty_set_cbsp_mode(TELNETasp_PT pt, charstring mode) {
+	f_vty_enter_config(pt);
+	f_vty_transceive(pt, "cbc");
+	f_vty_transceive(pt, "mode " & mode);
+	f_vty_transceive(pt, "exit");
+	f_vty_transceive(pt, "exit");
+}
+
 private function f_init(float guard_timeout := 30.0) runs on cbsp_test_CT {
 	BSC_Tests.f_init(guard_timeout := guard_timeout);
 	activate(as_IgnRSL((tr_RSL_BCCH_INFO, tr_RSL_SACCH_FILL,
@@ -111,9 +122,9 @@
 }
 private function f_cbsp_init_client() runs on cbsp_test_CT {
 	f_init();
+	f_vty_set_cbsp_mode(BSCVTY, "server");
 	CBSP_Adapter.f_connect(mp_bsc_ip, mp_bsc_cbsp_port, "", -1);
-	/* FIXME: osmo-bsc should probably still send a CBSP RESTART, but to get the current tests running, let's first
-	 * ignore this aspect */
+	CBSP[0].receive(tr_CBSP_Recv(?, tr_CBSP_RESTART(?, CBSP_BC_MSGT_CBS, ?)));
 	setverdict(pass);
 }
 
@@ -122,6 +133,9 @@
 	timer T := 10.0;
 
 	f_init(guard_timeout := guard_timeout);
+
+	f_vty_set_cbsp_mode(BSCVTY, "client");
+
 	CBSP_Adapter.f_bind(mp_cbc_ip, mp_cbc_port);
 
 	T.start;