diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2020-07-31 16:57:40 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2020-08-13 19:31:23 +0000 |
commit | cb11a97aaf00f71b3e601438e83069acd4284a52 (patch) | |
tree | 544497a232a234abcd9c2de701fb448e111d74b6 | |
parent | ebdecc0309aa777b62177296fda17a49991ea73d (diff) |
bsc CBSP: fix tr_CBSP_KILL_FAIL, no lengthof() on record-of with '*'
Keep a local next_idx so that lengthof() doesn't fail after adding a '*' entry.
Fixes this error in BSC_Tests_CBSP.TC_cbsp_write_then_kill:
Dynamic test case error: Performing lengthof() operation on a template of type @CBSP_Types.CBSP_IEs with no exact length.
Change-Id: I4d95a8ca311f145fa5ea371b6aed099db771d7b8
-rw-r--r-- | library/CBSP_Templates.ttcn | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/library/CBSP_Templates.ttcn b/library/CBSP_Templates.ttcn index 49906fe5..8d627427 100644 --- a/library/CBSP_Templates.ttcn +++ b/library/CBSP_Templates.ttcn @@ -581,20 +581,29 @@ return template CBSP_PDU { tr_CbspMsgId(msg_id), tr_OldSerNo(old_ser_nr) }; + /* As soon as adding a '*' IE item, lengthof() no longer works on the ies record. So keep track of the + * next index to use separately. */ + var integer next_idx := lengthof(ies); if (istemplatekind(compl_list, "*")) { - ies[lengthof(ies)] := *; + ies[next_idx] := *; + next_idx := next_idx + 1; } else if (not istemplatekind(compl_list, "omit")) { - ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); + ies[next_idx] := tr_CbspNumComplList(compl_list); + next_idx := next_idx + 1; } if (istemplatekind(cell_list, "*")) { - ies[lengthof(ies)] := *; + ies[next_idx] := *; + next_idx := next_idx + 1; } else if (not istemplatekind(cell_list, "omit")) { - ies[lengthof(ies)] := tr_CbspCellList(cell_list); + ies[next_idx] := tr_CbspCellList(cell_list); + next_idx := next_idx + 1; } if (istemplatekind(channel_ind, "*")) { - ies[lengthof(ies)] := *; + ies[next_idx] := *; + next_idx := next_idx + 1; } else if (not istemplatekind(channel_ind, "omit")) { - ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); + ies[next_idx] := tr_CbspChannelInd(channel_ind); + next_idx := next_idx + 1; } return tr_CBSP(CBSP_MSGT_KILL_COMPL, ies); } |