cbc: Refactor and split f_cbsp_write()

Change-Id: I827fad869c6ca5ce80dd39d30c2e3393b2394217
This commit is contained in:
Pau Espin 2022-07-08 17:14:45 +02:00
parent 52aee747b4
commit ac71dbb1e5
1 changed files with 38 additions and 21 deletions

View File

@ -204,8 +204,41 @@ type record CBS_MessageContent {
};
type record of CBS_MessageContent CBS_MessageContents;
private function f_cbsp_tx_write_compl(CBS_Message msg, integer idx := 0,
template (omit) BSSMAP_FIELD_CellIdentificationList tx_cell_list := omit,
template (omit) CBSP_IE_NumBcastComplList tx_compl_list := omit)
runs on test_CT {
var template (value) CBSP_PDU tx;
var template (value) BSSMAP_FIELD_CellIdentificationList tx_list;
if (istemplatekind(tx_cell_list, "omit")) {
/* use the "expected list" when confirming the write-replace */
tx_list := msg.cell_list;
} else {
/* use an user-provided different list of cells */
tx_list := valueof(tx_cell_list);
}
if (istemplatekind(tx_compl_list, "omit")) {
tx := ts_CBSP_WRITE_CBS_COMPL(msg.msg_id, msg.ser_nr, tx_list, msg.channel_ind);
} else {
tx := ts_CBSP_REPLACE_CBS_COMPL(msg.msg_id, msg.ser_nr, msg.old_ser_nr,
valueof(tx_compl_list), tx_list,
msg.channel_ind);
}
CBSP[idx].send(ts_CBSP_Send(g_cbsp_conn_id[idx], tx));
}
private function f_cbsp_tx_write_fail(CBS_Message msg, integer idx := 0,
template (omit) BSSMAP_FIELD_CellIdentificationList tx_cell_list := omit,
template (omit) CBSP_FailureListItems tx_fail_list := omit)
runs on test_CT {
var template (value) CBSP_PDU tx;
tx := ts_CBSP_WRITE_CBS_FAIL(msg.msg_id, msg.ser_nr, valueof(tx_fail_list),
omit, tx_cell_list, msg.channel_ind);
CBSP[idx].send(ts_CBSP_Send(g_cbsp_conn_id[idx], tx));
}
/* handle a CBSP-WRITE-REPLACE and respond to it with COMPLETE or FAILURE depending on arguments */
private function f_cbsp_write(CBS_Message msg, integer idx := 0,
private function f_cbsp_handle_write(CBS_Message msg, integer idx := 0,
template (omit) BSSMAP_FIELD_CellIdentificationList tx_cell_list := omit,
template (omit) CBSP_FailureListItems tx_fail_list := omit,
template (omit) CBSP_IE_NumBcastComplList tx_compl_list := omit)
@ -224,26 +257,10 @@ runs on test_CT {
[] CBSP[idx].receive(tr_CBSP_Recv(g_cbsp_conn_id[idx], rx_templ)) -> value rf {
var template (value) CBSP_PDU tx;
if (istemplatekind(tx_fail_list, "omit")) {
var template (value) BSSMAP_FIELD_CellIdentificationList tx_list;
if (istemplatekind(tx_cell_list, "omit")) {
/* use the "expected list" when confirming the write-replace */
tx_list := msg.cell_list;
} else {
/* use an user-provided different list of cells */
tx_list := valueof(tx_cell_list);
}
if (istemplatekind(tx_compl_list, "omit")) {
tx := ts_CBSP_WRITE_CBS_COMPL(msg.msg_id, msg.ser_nr, tx_list, msg.channel_ind);
} else {
tx := ts_CBSP_REPLACE_CBS_COMPL(msg.msg_id, msg.ser_nr, msg.old_ser_nr,
valueof(tx_compl_list), tx_list,
msg.channel_ind);
}
f_cbsp_tx_write_compl(msg, idx, tx_cell_list, tx_compl_list);
} else {
tx := ts_CBSP_WRITE_CBS_FAIL(msg.msg_id, msg.ser_nr, valueof(tx_fail_list),
omit, tx_cell_list, msg.channel_ind);
f_cbsp_tx_write_fail(msg, idx, tx_cell_list, tx_fail_list);
}
CBSP[idx].send(ts_CBSP_Send(g_cbsp_conn_id[idx], tx));
}
[] as_cbsp_keepalive_ack(idx) { repeat; }
[] CBSP[idx].receive {
@ -302,7 +319,7 @@ testcase TC_write_replace() runs on test_CT {
{ '00'O, 1 }
}
};
f_cbsp_write(msg);
f_cbsp_handle_write(msg);
f_sleep(100.0);
f_shutdown_helper();
}
@ -378,7 +395,7 @@ function f_create_and_delete(CBS_Message msg,
runs on test_CT {
var EcbeCbcMessage ecbe := f_cbs2ecbe(msg, "TTCN-3");
f_ecbe_tx_post_cbs(ecbe);
f_cbsp_write(msg, 0, cell_list_success);
f_cbsp_handle_write(msg, 0, cell_list_success);
f_ecbe_rx_resp(201);
f_sleep(2.0);