remsim: New TC_slotmap_del_active_client() test

This test verifies that a slotmap delete via REST will not only
delete it from the bankd, but also from the client.

Change-Id: I8c4e53231b5386b00fe2938cde2091aa8b2e2027
Related: OS#4399
This commit is contained in:
Harald Welte 2020-02-16 15:35:07 +01:00
parent 5a012eed43
commit 77cde21fb5
1 changed files with 54 additions and 1 deletions

View File

@ -390,7 +390,7 @@ testcase TC_slotmap_del_unack() runs on test_CT {
f_ensure_slotmaps({});
}
/* simple delete of a 'ACTIVE' slotmap */
/* simple delete of a 'ACTIVE' slotmap from server + bankd */
testcase TC_slotmap_del_active() runs on test_CT {
var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, testcasename()));
f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
@ -429,6 +429,58 @@ testcase TC_slotmap_del_active() runs on test_CT {
}
/* simple delete of a 'ACTIVE' slotmap from client */
testcase TC_slotmap_del_active_client() runs on test_CT {
var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, testcasename()));
f_rspro_init(rspro[0], mp_server_ip, mp_server_port, rspro_id, 0);
rspro[0].rspro_bank_id := 1;
rspro[0].rspro_bank_nslots := 8;
rspro_id := valueof(ts_CompId(remsimClient, testcasename()));
f_rspro_init(rspro[1], mp_server_ip, mp_server_port, rspro_id, 1);
rspro[1].rspro_client_slot := valueof(ts_ClientSlot(3,4));
f_rsres_init();
var JsSlotmap sm := valueof(ts_JsSlotmap(ts_BankSlot(1,2), ts_ClientSlot(3,4)));
var HTTPResponse res;
/* Create a new slotmap via HTTP */
res := f_rsres_post_slotmap(sm);
/* verify that the slotmap exists and is NEW */
f_ensure_slotmap_exists_only(sm.client, sm.bank, NEW);
/* connect a bankd for that slotmap */
f_rspro_connect_client(0);
/* connect a client for that slotmap */
f_rspro_connect_client(1);
/* expect the slotmap to be pushed to bank and ACK it */
as_rspro_create_mapping(0, sm.client, sm.bank);
/* verify that the slotmap exists and is ACTIVE */
f_ensure_slotmap_exists_only(sm.client, sm.bank, ACTIVE);
/* expect the client to be configured with bankd side settings */
as_rspro_cfg_client_bank(1, sm.bank, ?/*FIXME*/);
f_sleep(1.0);
/* delete the slotmap via REST */
res := f_rsres_delete_slotmap(sm.bank);
/* verify the slotmap is gone from REST interface immediately */
f_ensure_slotmaps({});
/* verify the slotmap is removed from bankd */
as_rspro_remove_mapping(0, sm.client, sm.bank);
/* verify the slotmap is removed from client by setting IP/port to '0' */
as_rspro_cfg_client_bank(1, ?, tr_IpPort(ts_IPv4("0.0.0.0"), 0));
}
/* Add a slotmap to a currently active bank */
testcase TC_slotmap_add_active_bank() runs on test_CT {
var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, testcasename()));
@ -478,6 +530,7 @@ control {
execute( TC_slotmap_del_new() );
execute( TC_slotmap_del_unack() );
execute( TC_slotmap_del_active() );
execute( TC_slotmap_del_active_client() );
execute( TC_slotmap_add_active_bank() );
}