remsim: Add client TC_bank_disconnect + TC_bank_disconnect_reconnect

This extends remsim-client test coverage to situations where the
server removes an existing/established mapping, and possibly later
establishes a new mapping.

Change-Id: I8df29a91718b6b2829415fc040b647a58eb71292
Related: OS#4399
diff --git a/remsim/RemsimClient_Tests.ttcn b/remsim/RemsimClient_Tests.ttcn
index 7bee899..d950152 100644
--- a/remsim/RemsimClient_Tests.ttcn
+++ b/remsim/RemsimClient_Tests.ttcn
@@ -109,6 +109,66 @@
 	f_sleep(1.0);
 }
 
+/* Test if client disconnects from bankd after slotmap delete on server */
+testcase TC_bank_disconnect() runs on client_test_CT {
+	var BankSlot bslot := { 1, 0 };
+	f_init();
+	/* expect inbound connectClientReq */
+	as_connectClientReq();
+	/* configure client to connect to [simulated] bankd */
+	f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4(mp_bankd_ip), mp_bankd_port));
+	/* expect inbound connect on simulated bankd */
+	f_rspro_srv_exp_connect(1);
+	/* expect inbound connectClientReq on simulated bankd */
+	as_connectClientReq(i := 1);
+
+	f_sleep(1.0);
+
+	/* configure client to disconnect from [simulated] bankd */
+	f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4("0.0.0.0"), 0));
+
+	/* expect disconnect of client on simulated bankd side */
+	RSPRO_SRV[1].receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_DOWN));
+	setverdict(pass);
+}
+
+/* Test if client connects to bankd after disconnects from bankd after slotmap delete on server */
+testcase TC_bank_disconnect_reconnect() runs on client_test_CT {
+	var BankSlot bslot := { 1, 0 };
+	f_init();
+	/* expect inbound connectClientReq */
+	as_connectClientReq();
+	/* configure client to connect to [simulated] bankd */
+	f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4(mp_bankd_ip), mp_bankd_port));
+	/* expect inbound connect on simulated bankd */
+	f_rspro_srv_exp_connect(1);
+	/* expect inbound connectClientReq on simulated bankd */
+	as_connectClientReq(i := 1);
+
+	f_sleep(1.0);
+
+	/* configure client to disconnect from [simulated] bankd */
+	f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4("0.0.0.0"), 0));
+
+	/* expect disconnect of client on simulated bankd side */
+	RSPRO_SRV[1].receive(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_DOWN));
+
+	/* re-start the IPA emulation (which terminated itself on the TCP disconnect */
+	f_rspro_srv_init(1, mp_bankd_ip, mp_bankd_port, g_bankd_comp_id, exp_connect := false);
+
+	/* configure client to connect to [simulated] bankd */
+	f_rspro_config_client_bank(bslot, ts_IpPort(ts_IPv4(mp_bankd_ip), mp_bankd_port));
+
+	/* expect inbound connect on simulated bankd */
+	f_rspro_srv_exp_connect(1);
+
+	/* expect inbound connect on simulated bankd */
+	as_connectClientReq(i := 1);
+
+	setverdict(pass);
+}
+
+
 /* TODO:
    * send a configClientBankIpReq and change the bank of an active client
    * send a configClientBankSlotReq and chagne the bank slot of an active client
@@ -125,6 +185,8 @@
 	execute( TC_srv_connectClient_configClientBank() );
 	execute( TC_srv_reconnect() );
 	execute( TC_bank_reconnect() );
+	execute( TC_bank_disconnect() );
+	execute( TC_bank_disconnect_reconnect() );
 }