remsim: Two new bankd test cases about slotmap re-creation

If a slotmap is re-created with identical client+bankd, we expect
no change and the client-bankd connection to persist.

If a slotmap is overwritten with a create for a different client
than the currently connected one, we expect the client connection
to be closed.

Change-Id: If81e1511521fe478d2367104cd1c7eba254d6450
Related: OS#4278
This commit is contained in:
Harald Welte 2019-12-04 22:09:12 +01:00
parent bca0ecd282
commit beba4e56a0
1 changed files with 84 additions and 0 deletions

View File

@ -201,6 +201,87 @@ testcase TC_createMapping_clientConnect() runs on bankd_test_CT {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, pass);
}
/* first add mapping, then connect client, then change mapping (expect disconnect) */
testcase TC_createMapping_connectClient_changeMapping() runs on bankd_test_CT {
/* FIXME: this would only be done in f_init_client(), but we need it before */
rspro[0].rspro_client_slot := { clientId := 23+0, slotNr := 0 };
f_init();
as_connectBankReq(bid := mp_bank_id, nslots := mp_num_slots);
f_rspro_srv_reset_state(ok);
/* create slotmap */
var BankSlot bs := { bankId := mp_bank_id, slotNr := 0 };
f_rspro_srv_create_slotmap(rspro[0].rspro_client_slot, bs);
f_sleep(1.0);
/* connect client */
f_init_client(0);
f_rspro_connect_client(0, tr_Status_ok_or_nocard);
/* FIXME: how to determine that bank correctly mapped us */
/* create another mapping for the same bank-slot */
var ClientSlot cs := { clientId := 987, slotNr := 654 };
f_rspro_srv_create_slotmap(cs, bs);
/* expect client to be disconnected */
timer T := 5.0;
T.start;
alt {
[] RSPRO[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) {
setverdict(pass);
}
[] RSPRO[0].receive {
setverdict(fail, "Unexpected RSPRO on client connection");
}
[] T.timeout {
setverdict(fail, "Timeout waiting for client being disconnected");
}
}
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, pass);
}
/* first add mapping, then connect client, then re-crete mapping (expect no disconnect) */
testcase TC_createMapping_connectClient_recreateMapping() runs on bankd_test_CT {
/* FIXME: this would only be done in f_init_client(), but we need it before */
rspro[0].rspro_client_slot := { clientId := 23+0, slotNr := 0 };
f_init();
as_connectBankReq(bid := mp_bank_id, nslots := mp_num_slots);
f_rspro_srv_reset_state(ok);
/* create slotmap */
var BankSlot bs := { bankId := mp_bank_id, slotNr := 0 };
f_rspro_srv_create_slotmap(rspro[0].rspro_client_slot, bs);
f_sleep(1.0);
/* connect client */
f_init_client(0);
f_rspro_connect_client(0, tr_Status_ok_or_nocard);
/* FIXME: how to determine that bank correctly mapped us */
/* re-create same mapping for the same bank-slot */
f_rspro_srv_create_slotmap(rspro[0].rspro_client_slot, bs);
/* expect client not to be disconnected */
timer T := 5.0;
T.start;
alt {
[] RSPRO[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) {
setverdict(fail, "Unexpected client disconnect");
}
[] RSPRO[0].receive {
repeat;
}
[] T.timeout {
setverdict(pass);
}
}
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, pass);
}
/* add mapping, connect matching client, disconnect + reconnect */
@ -299,6 +380,9 @@ control {
execute( TC_createMapping_clientReconnect() );
execute( TC_removeMapping_connected() );
execute( TC_createMapping_connectClient_changeMapping() );
execute( TC_createMapping_connectClient_recreateMapping() );
execute( TC_createMapping_exchangeTPDU() );
}