blob: 49906fe5b30b8294a081851113f3edc6f932b9af [file] [log] [blame]
Harald Welteea260342019-08-01 09:49:38 +02001module CBSP_Templates {
2
3import from Osmocom_Types all;
4import from BSSAP_Types all;
5import from CBSP_Types all;
6
7/* TODO: receive templates must match IEs in any arbitrary order */
8
9/* For some reason the TTCN-3 RAW codec cannot automatically figure out the IEI
10 * that it needs to set for a given union-choice (body). So we have to explicitly
11 * specify the IEI by the caller :( */
12template (value) CBSP_IE ts_CBSP_IE(CBSP_IEI iei, template (value) CBSP_IE_Body body) := {
13 iei := iei,
14 body := body
15}
16
17template CBSP_IE tr_CBSP_IE(template CBSP_IE_Body body) := {
18 iei := ?,
19 body := body
20}
21
22
23template (value) CBSP_IE ts_CbspMsgId(template (value) uint16_t val) :=
24 ts_CBSP_IE(CBSP_IEI_MSG_ID, {msg_id := val});
25template CBSP_IE tr_CbspMsgId(template uint16_t val := ?) :=
26 tr_CBSP_IE({msg_id := val});
27
28template (value) CBSP_IE ts_NewSerNo(template (value) uint16_t val) :=
29 ts_CBSP_IE(CBSP_IEI_NEW_SERIAL_NR, {new_ser_nr := val});
30template CBSP_IE tr_NewSerNo(template uint16_t val := ?) :=
31 tr_CBSP_IE({new_ser_nr := val});
32
33template (value) CBSP_IE ts_OldSerNo(template (value) uint16_t val) :=
34 ts_CBSP_IE(CBSP_IEI_OLD_SERIAL_NR, {old_ser_nr := val});
35template CBSP_IE tr_OldSerNo(template uint16_t val := ?) :=
36 tr_CBSP_IE({old_ser_nr := val});
37
38template (value) CBSP_IE ts_CbspKARepPeriod(template (value) uint8_t rep_per) :=
39 ts_CBSP_IE(CBSP_IEI_KEEP_ALIVE_REP_PERIOD, {keep_alive_rep_period := rep_per});
40template CBSP_IE tr_CbspKARepPeriod(template uint8_t rep_per := ?) :=
41 tr_CBSP_IE({keep_alive_rep_period := rep_per});
42
43function ts_CbspChannelInd(template (omit) uint8_t val) return template (omit) CBSP_IE {
44 var template (omit) CBSP_IE ie;
45 if (istemplatekind(val, "omit")) {
46 ie := omit;
47 } else {
48 ie := ts_CBSP_IE(CBSP_IEI_CHANNEL_IND, {channel_ind := val});
49 }
50 return ie;
51}
52function tr_CbspChannelInd(template uint8_t val := ?) return template CBSP_IE {
53 var template CBSP_IE ie;
54 if (istemplatekind(val, "omit")) {
55 ie := omit;
56 } else if (istemplatekind(val, "*")) {
57 ie := tr_CBSP_IE({channel_ind := ?}) ifpresent;
58 } else {
59 ie := tr_CBSP_IE({channel_ind := val});
60 }
61 return ie;
62}
63
64template (value) CBSP_IE ts_CbspCause(template (value) CBSP_Cause c) :=
65 ts_CBSP_IE(CBSP_IEI_CAUSE, {cause := c});
66template CBSP_IE tr_CbspCause(template CBSP_Cause c := ?) :=
67 tr_CBSP_IE({cause := c});
68
69template (value) CBSP_IE ts_CbspCellList(template (value) BSSMAP_FIELD_CellIdentificationList list) :=
70 ts_CBSP_IE(CBSP_IEI_CELL_LIST, {
71 cell_list := {
72 len := 0,
73 spare1_4 := '0000'B,
74 cell_id_discr := '0000'B,
75 cell_id := list
76 }});
77template CBSP_IE tr_CbspCellList(template BSSMAP_FIELD_CellIdentificationList list := ?) :=
78 tr_CBSP_IE({
79 cell_list := {
80 len := ?,
81 spare1_4 := ?,
82 cell_id_discr := ?,
83 cell_id := list
84 }});
85
86template (value) CBSP_IE ts_CbspCategory(template (value) CBSP_Category cat) :=
87 ts_CBSP_IE(CBSP_IEI_CATEGORY, {category := cat});
88template CBSP_IE tr_CbspCategory(template CBSP_Category cat := ?) :=
89 tr_CBSP_IE({category := cat});
90
91template (value) CBSP_IE ts_CbspRepetitionPeriod(template (value) uint16_t per) :=
92 ts_CBSP_IE(CBSP_IEI_REP_PERIOD, {rep_period := per});
93template CBSP_IE tr_CbspRepetitionPeriod(template uint16_t per := ?) :=
94 tr_CBSP_IE({rep_period := per});
95
96template (value) CBSP_IE ts_CbspNumBcastReq(template (value) uint16_t num) :=
97 ts_CBSP_IE(CBSP_IEI_NUM_BCAST_REQ, {num_bcast_req := num});
98template CBSP_IE tr_CbspNumBcastReq(template uint16_t num := ?) :=
99 tr_CBSP_IE({num_bcast_req := num});
100
101template (value) CBSP_IE ts_CbspNumPages(template (value) uint8_t num) :=
102 ts_CBSP_IE(CBSP_IEI_NUM_OF_PAGES, {num_of_pages := num});
103template CBSP_IE tr_CbspNumPages(template uint16_t num := ?) :=
104 tr_CBSP_IE({num_of_pages := num});
105
106template (value) CBSP_IE ts_EmergencyInd(template (value) uint8_t val) :=
107 ts_CBSP_IE(CBSP_IEI_EMERG_IND, {emerg_ind := val});
108template CBSP_IE tr_EmergencyInd(template uint8_t val := ?) :=
109 tr_CBSP_IE({emerg_ind := val});
110
111template (value) CBSP_IE ts_WarningType(template (value) uint16_t val) :=
112 ts_CBSP_IE(CBSP_IEI_WARN_TYPE, {warn_type := val});
113template CBSP_IE tr_WarningType(template uint16_t val) :=
114 tr_CBSP_IE({warn_type := val});
115
116template (value) CBSP_IE ts_WarnSecInfo(template (value) octetstring payl := ''O) :=
117 ts_CBSP_IE(CBSP_IEI_WARN_SEC_INFO, {warn_sec_info := payl});
118template CBSP_IE tr_WarnSecInfo(template octetstring payl := ?) :=
119 tr_CBSP_IE({warn_sec_info := payl});
120
121template (value) CBSP_IE ts_WarningPeriod(template (value) uint8_t val) :=
122 ts_CBSP_IE(CBSP_IEI_WARNING_PERIOD, {warning_period := val});
123template CBSP_IE tr_WarningPeriod(template uint8_t val := ?) :=
124 tr_CBSP_IE({warning_period := val});
125
126template (value) CBSP_IE ts_CbspFailList(template (value) CBSP_FailureListItems items) :=
127 ts_CBSP_IE(CBSP_IEI_FAILURE_LIST, {failure_list := {
128 len := 0,
129 list := items
130 }});
131template CBSP_IE tr_CbspFailList(template CBSP_FailureListItems items := ?) :=
132 tr_CBSP_IE({failure_list := {
Harald Welte09538f82019-08-01 09:50:25 +0200133 len := ?,
Harald Welteea260342019-08-01 09:49:38 +0200134 list := items
135 }});
136
137template (value) CBSP_IE ts_CbspNumComplList(template (value) CBSP_IE_NumBcastComplList list) :=
138 ts_CBSP_IE(CBSP_IEI_NUM_BCAST_COMPL_LIST, {num_bcast_compl_list := list});
139template CBSP_IE tr_CbspNumComplList(template CBSP_IE_NumBcastComplList list := ?) :=
140 tr_CBSP_IE({num_bcast_compl_list := list});
141
142template (value) CBSP_IE ts_CbspBcastMsgType(template (value) CBSP_BcastMsgType bi) :=
143 ts_CBSP_IE(CBSP_IEI_BCAST_MSG_TYPE, {bcast_msg_type := {
144 spare1_4 := '0000'B,
145 msg_type := bi
146 }});
147template CBSP_IE tr_CbspBcastMsgType(template CBSP_BcastMsgType bi := ?) :=
148 tr_CBSP_IE({bcast_msg_type := {
149 spare1_4 := ?,
150 msg_type := bi
151 }});
152
153template (value) CBSP_IE ts_CbspRecoveryInd(template (value) CBSP_RecoveryInd ri) :=
154 ts_CBSP_IE(CBSP_IEI_RECOVERY_IND, {recovery_ind := {
155 spare1_4 := '0000'B,
156 recovery := ri
157 }});
158template CBSP_IE tr_CbspRecoveryInd(template CBSP_RecoveryInd ri) :=
159 tr_CBSP_IE({recovery_ind := {
160 spare1_4 := ?,
161 recovery := ri
162 }});
163
164template (value) CBSP_IE ts_CbspMsgContent(template (value) octetstring payload, uint8_t user_len) :=
165 ts_CBSP_IE(CBSP_IEI_MSG_CONTENT, {msg_content := {
166 user_len := user_len,
167 val := payload
168 }});
169template CBSP_IE tr_CbspMsgContent(template octetstring payload := ?, template uint8_t user_len := ?) :=
170 tr_CBSP_IE({msg_content := {
171 user_len := user_len,
172 val := payload
173 }});
174
175template (value) CBSP_IE ts_CbspDCS(template (value) uint8_t dcs) :=
176 ts_CBSP_IE(CBSP_IEI_DCS, {dcs := dcs});
177template CBSP_IE tr_CbspDCS(template uint8_t dcs := ?) :=
178 tr_CBSP_IE({dcs := dcs});
179
180
181template (value) CBSP_PDU ts_CBSP(CBSP_MessageType msg_type, template (value) CBSP_IEs ies) := {
182 msg_type := msg_type,
183 len := 0, /* overwritten */
184 ies := ies
185}
186template CBSP_PDU tr_CBSP(template CBSP_MessageType msg_type := ?, template CBSP_IEs ies := *) := {
187 msg_type := msg_type,
188 len := ?,
189 ies := ies
190}
191
192
193
194/* 8.1.3.1 WRITE REPLACE */
195function ts_CBSP_WRITE_CBS(template (value) uint16_t msg_id,
196 template (value) uint16_t new_ser_nr,
197 template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
198 template (value) uint8_t channel_ind,
199 template (value) CBSP_Category category,
200 template (value) uint16_t rep_period,
201 template (value) uint16_t num_bcast_req,
202 template (value) uint8_t dcs,
203 template (value) CBSP_IEs content) return template (value) CBSP_PDU {
204 var template (value) CBSP_IEs ies := {
205 ts_CbspMsgId(msg_id),
206 ts_NewSerNo(new_ser_nr),
207 ts_CbspCellList(cell_list),
208 ts_CbspChannelInd(channel_ind),
209 ts_CbspCategory(category),
210 ts_CbspRepetitionPeriod(rep_period),
211 ts_CbspNumBcastReq(num_bcast_req),
212 ts_CbspDCS(dcs),
213 ts_CbspNumPages(lengthof(content))
214 };
215 return ts_CBSP(CBSP_MSGT_WRITE_REPLACE, valueof(ies) & valueof(content));
216}
217template CBSP_PDU tr_CBSP_WRITE_CBS(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?,
218 template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
219 template uint8_t channel_ind := ?,
220 template CBSP_Category category := ?,
221 template uint16_t rep_period := ?,
222 template uint16_t num_bcast_req := ?,
223 template uint8_t dcs := ?,
224 template CBSP_IEs content := ?
225 ) :=
226 tr_CBSP(CBSP_MSGT_WRITE_REPLACE, ({
227 tr_CbspMsgId(msg_id),
228 tr_NewSerNo(new_ser_nr),
229 tr_CbspCellList(cell_list),
230 tr_CbspChannelInd(channel_ind),
231 tr_CbspCategory(category),
232 tr_CbspRepetitionPeriod(rep_period),
233 tr_CbspNumBcastReq(num_bcast_req),
234 tr_CbspDCS(dcs),
235 tr_CbspNumPages(lengthof(content)), all from content }));
236
237
238function ts_CBSP_REPLACE_CBS(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr,
239 template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
240 template (value) uint8_t channel_ind,
241 template (value) CBSP_Category category,
242 template (value) uint16_t rep_period,
243 template (value) uint16_t num_bcast_req,
244 template (value) uint8_t dcs,
245 template (value) CBSP_IEs content) return template (value) CBSP_PDU {
246 var template (value) CBSP_IEs ies := {
247 ts_CbspMsgId(msg_id),
248 ts_NewSerNo(new_ser_nr),
249 ts_OldSerNo(old_ser_nr),
250 ts_CbspCellList(cell_list),
251 ts_CbspChannelInd(channel_ind),
252 ts_CbspCategory(category),
253 ts_CbspRepetitionPeriod(rep_period),
254 ts_CbspNumBcastReq(num_bcast_req),
255 ts_CbspDCS(dcs),
256 ts_CbspNumPages(lengthof(content))
257 };
258 return ts_CBSP(CBSP_MSGT_WRITE_REPLACE, valueof(ies) & valueof(content));
259}
260template CBSP_PDU tr_CBSP_REPLACE_CBS(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?,
261 template uint16_t old_ser_nr := ?,
262 template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
263 template uint8_t channel_ind := ?,
264 template CBSP_Category category := ?,
265 template uint16_t rep_period := ?,
266 template uint16_t num_bcast_req := ?,
267 template uint8_t dcs := ?,
268 template CBSP_IEs content := ?
269 ) :=
270 tr_CBSP(CBSP_MSGT_WRITE_REPLACE, ({
271 tr_CbspMsgId(msg_id),
272 tr_NewSerNo(new_ser_nr),
273 tr_OldSerNo(old_ser_nr),
274 tr_CbspCellList(cell_list),
275 tr_CbspChannelInd(channel_ind),
276 tr_CbspCategory(category),
277 tr_CbspRepetitionPeriod(rep_period),
278 tr_CbspNumBcastReq(num_bcast_req),
279 tr_CbspDCS(dcs),
280 tr_CbspNumPages(lengthof(content)), all from content }));
281
282template (value) CBSP_PDU ts_CBSP_WRITE_EMERG(uint16_t msg_id, uint16_t new_ser_nr,
283 template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
284 template (value) uint8_t emerg_ind,
285 template (value) uint16_t warn_type,
Harald Welteea260342019-08-01 09:49:38 +0200286 template (value) uint8_t warn_per
287 ) :=
288 ts_CBSP(CBSP_MSGT_WRITE_REPLACE, {
289 ts_CbspMsgId(msg_id),
290 ts_NewSerNo(new_ser_nr),
291 ts_CbspCellList(cell_list),
292 ts_EmergencyInd(emerg_ind),
293 ts_WarningType(warn_type),
294 ts_WarnSecInfo,
295 ts_WarningPeriod(warn_per) });
296template CBSP_PDU tr_CBSP_WRITE_EMERG(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?,
297 template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
298 template uint8_t emerg_ind := ?,
299 template uint16_t warn_type := ?,
300 template uint16_t num_bcast_req := ?,
301 template uint8_t warn_per := ?
302 ) :=
303 tr_CBSP(CBSP_MSGT_WRITE_REPLACE, {
304 tr_CbspMsgId(msg_id),
305 tr_NewSerNo(new_ser_nr),
306 tr_CbspCellList(cell_list),
307 tr_EmergencyInd(emerg_ind),
308 tr_WarningType(warn_type),
309 tr_WarnSecInfo,
310 tr_WarningPeriod(warn_per) });
311
312
313template (value) CBSP_PDU ts_CBSP_REPLACE_EMERG(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr,
314 template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
315 template (value) uint8_t emerg_ind,
316 template (value) uint16_t warn_type,
317 template (value) uint16_t num_bcast_req,
318 template (value) uint8_t warn_per
319 ) :=
320 ts_CBSP(CBSP_MSGT_WRITE_REPLACE, {
321 ts_CbspMsgId(msg_id),
322 ts_NewSerNo(new_ser_nr),
323 ts_OldSerNo(old_ser_nr),
324 ts_CbspCellList(cell_list),
325 ts_EmergencyInd(emerg_ind),
326 ts_WarningType(warn_type),
327 ts_WarnSecInfo,
328 ts_WarningPeriod(warn_per) });
329template CBSP_PDU tr_CBSP_REPLACE_EMERG(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?,
330 template uint16_t old_ser_nr := ?,
331 template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
332 template uint8_t emerg_ind := ?,
333 template uint16_t warn_type := ?,
334 template uint16_t num_bcast_req := ?,
335 template uint8_t warn_per := ?
336 ) :=
337 tr_CBSP(CBSP_MSGT_WRITE_REPLACE, {
338 tr_CbspMsgId(msg_id),
339 tr_NewSerNo(new_ser_nr),
340 tr_OldSerNo(old_ser_nr),
341 tr_CbspCellList(cell_list),
342 tr_EmergencyInd(emerg_ind),
343 tr_WarningType(warn_type),
344 tr_WarnSecInfo,
345 tr_WarningPeriod(warn_per) });
346
347/* 8.1.3.2 WRITE-REPLACE COMPLETE */
348function ts_CBSP_WRITE_CBS_COMPL(uint16_t msg_id, uint16_t new_ser_nr,
349 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
350 template (value) uint8_t channel_ind)
351return template (value) CBSP_PDU {
352 var template (value) CBSP_IEs ies := {
353 ts_CbspMsgId(msg_id),
354 ts_NewSerNo(new_ser_nr)
355 };
356 if (not istemplatekind(cell_list, "omit")) {
357 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
358 }
359 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
360 return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
361}
362function tr_CBSP_WRITE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr,
363 template BSSMAP_FIELD_CellIdentificationList cell_list,
364 template uint8_t channel_ind)
365return template CBSP_PDU {
366 var template CBSP_IEs ies := {
367 tr_CbspMsgId(msg_id),
368 tr_NewSerNo(new_ser_nr)
369 };
370 if (istemplatekind(cell_list, "*")) {
Harald Weltee53a23d2020-04-20 18:01:00 +0200371 testcase.stop("TITAN > 6.5.0 doesn't support this");
372 //ies[lengthof(ies)] := tr_CbspCellList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200373 } else if (istemplatekind(cell_list, "?")) {
374 ies[lengthof(ies)] := tr_CbspCellList(?);
375 } else if (not istemplatekind(cell_list, "omit")) {
376 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
377 }
Harald Welte25a60752019-09-06 23:08:23 +0200378 if (not istemplatekind(channel_ind, "omit")) {
379 ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
380 }
Harald Welteea260342019-08-01 09:49:38 +0200381 return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
382}
383
384
385function ts_CBSP_REPLACE_CBS_COMPL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr,
386 template (value) CBSP_IE_NumBcastComplList compl_list,
387 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
388 template (value) uint8_t channel_ind)
389return template (value) CBSP_PDU {
390 var template (value) CBSP_IEs ies := {
391 ts_CbspMsgId(msg_id),
392 ts_NewSerNo(new_ser_nr),
393 ts_OldSerNo(old_ser_nr),
394 ts_CbspNumComplList(compl_list)
395 };
396 if (not istemplatekind(cell_list, "omit")) {
397 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
398 }
399 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
400 return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
401}
402function tr_CBSP_REPLACE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr,
403 template uint16_t old_ser_nr,
404 template CBSP_IE_NumBcastComplList compl_list,
405 template BSSMAP_FIELD_CellIdentificationList cell_list,
406 template uint8_t channel_ind)
407return template CBSP_PDU {
408 var template CBSP_IEs ies := {
409 tr_CbspMsgId(msg_id),
410 tr_NewSerNo(new_ser_nr),
411 tr_OldSerNo(old_ser_nr),
412 tr_CbspNumComplList(compl_list)
413 };
414 if (istemplatekind(cell_list, "*")) {
Harald Weltee53a23d2020-04-20 18:01:00 +0200415 testcase.stop("TITAN > 6.5.0 doesn't support this");
416 //ies[lengthof(ies)] := tr_CbspCellList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200417 } else if (istemplatekind(cell_list, "?")) {
418 ies[lengthof(ies)] := tr_CbspCellList(?);
419 } else if (not istemplatekind(cell_list, "omit")) {
420 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
421 }
Harald Welte25a60752019-09-06 23:08:23 +0200422 if (not istemplatekind(channel_ind, "omit")) {
423 ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
424 }
Harald Welteea260342019-08-01 09:49:38 +0200425 return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies);
426}
427
428
429/* 8.1.3.3 WRITE-REPLACE FAILURE */
430function ts_CBSP_WRITE_CBS_FAIL(uint16_t msg_id, uint16_t new_ser_nr,
431 template (value) CBSP_FailureListItems fail_list,
432 template (omit) CBSP_IE_NumBcastComplList compl_list,
433 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
434 template (value) uint8_t channel_ind)
435return template (value) CBSP_PDU {
436 var template (value) CBSP_IEs ies := {
437 ts_CbspMsgId(msg_id),
438 ts_NewSerNo(new_ser_nr),
439 ts_CbspFailList(fail_list)
440 };
441 if (not istemplatekind(compl_list, "omit")) {
442 ies[lengthof(ies)] := ts_CbspNumComplList(compl_list);
443 }
444 if (not istemplatekind(cell_list, "omit")) {
445 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
446 }
447 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
448 return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies);
449}
450function tr_CBSP_WRITE_CBS_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr,
451 template CBSP_FailureListItems fail_list,
452 template CBSP_IE_NumBcastComplList compl_list,
453 template BSSMAP_FIELD_CellIdentificationList cell_list,
454 template uint8_t channel_ind)
455return template CBSP_PDU {
456 var template CBSP_IEs ies := {
457 tr_CbspMsgId(msg_id),
458 tr_NewSerNo(new_ser_nr),
459 tr_CbspFailList(fail_list)
460 };
461 if (istemplatekind(compl_list, "*")) {
Harald Welteb5223232019-09-05 11:13:56 +0200462 //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200463 } else if (istemplatekind(compl_list, "?")) {
464 ies[lengthof(ies)] := tr_CbspNumComplList(?);
465 } else if (not istemplatekind(compl_list, "omit")) {
466 ies[lengthof(ies)] := tr_CbspNumComplList(compl_list);
467 }
468 if (istemplatekind(cell_list, "*")) {
Harald Weltee53a23d2020-04-20 18:01:00 +0200469 testcase.stop("TITAN > 6.5.0 doesn't support this");
470 //ies[lengthof(ies)] := tr_CbspCellList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200471 } else if (istemplatekind(cell_list, "?")) {
472 ies[lengthof(ies)] := tr_CbspCellList(?);
473 } else if (not istemplatekind(cell_list, "omit")) {
474 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
475 }
Harald Welte25a60752019-09-06 23:08:23 +0200476 if (not istemplatekind(channel_ind, "omit")) {
477 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
478 }
Harald Welteea260342019-08-01 09:49:38 +0200479 return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies);
480}
481
482
483function ts_CBSP_REPLACE_CBS_FAIL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr,
484 template (value) CBSP_FailureListItems fail_list,
485 template (omit) CBSP_IE_NumBcastComplList compl_list,
486 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
487 template (value) uint8_t channel_ind)
488return template (value) CBSP_PDU {
489 var template (value) CBSP_IEs ies := {
490 ts_CbspMsgId(msg_id),
491 ts_NewSerNo(new_ser_nr),
492 ts_OldSerNo(old_ser_nr),
493 ts_CbspFailList(fail_list)
494 };
495 if (not istemplatekind(compl_list, "omit")) {
496 ies[lengthof(ies)] := ts_CbspNumComplList(compl_list);
497 }
498 if (not istemplatekind(cell_list, "omit")) {
499 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
500 }
501 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
502 return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies);
503}
504function tr_CBSP_REPLACE_CBS_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr,
505 template uint16_t old_ser_nr,
506 template CBSP_FailureListItems fail_list,
507 template CBSP_IE_NumBcastComplList compl_list,
508 template BSSMAP_FIELD_CellIdentificationList cell_list,
509 template uint8_t channel_ind)
510return template CBSP_PDU {
511 var template CBSP_IEs ies := {
512 tr_CbspMsgId(msg_id),
513 tr_NewSerNo(new_ser_nr),
514 tr_OldSerNo(old_ser_nr),
515 tr_CbspFailList(fail_list)
516 };
517 if (istemplatekind(compl_list, "*")) {
Harald Welteb5223232019-09-05 11:13:56 +0200518 //ies[lengthof(ies)] := tr_CbspCellList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200519 } else if (istemplatekind(compl_list, "?")) {
520 ies[lengthof(ies)] := tr_CbspNumComplList(?);
521 } else if (not istemplatekind(compl_list, "omit")) {
522 ies[lengthof(ies)] := tr_CbspNumComplList(compl_list);
523 }
524 if (istemplatekind(cell_list, "*")) {
Harald Welteb5223232019-09-05 11:13:56 +0200525 //ies[lengthof(ies)] := tr_CbspCellList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200526 } else if (istemplatekind(cell_list, "?")) {
527 ies[lengthof(ies)] := tr_CbspCellList(?);
528 } else if (not istemplatekind(cell_list, "omit")) {
529 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
530 }
531 ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
532 return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies);
533}
534
535/* 8.1.3.4 KILL */
536template (value) CBSP_PDU ts_CBSP_KILL(template (value) uint16_t msg_id,
537 template (value) uint16_t old_ser_nr,
538 template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
539 template (omit) uint8_t channel_ind) :=
540 ts_CBSP(CBSP_MSGT_KILL, {
541 ts_CbspMsgId(msg_id),
542 ts_OldSerNo(old_ser_nr),
543 ts_CbspCellList(cell_list),
544 ts_CbspChannelInd(channel_ind)});
545template CBSP_PDU tr_CBSP_KILL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?,
546 template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
547 template uint8_t channel_ind := ?) :=
548 tr_CBSP(CBSP_MSGT_KILL, {
549 tr_CbspMsgId(msg_id),
550 tr_OldSerNo(old_ser_nr),
551 tr_CbspCellList(cell_list),
552 tr_CbspChannelInd(channel_ind) });
553
554/* 8.1.3.5 KILL COMPLETE */
555function ts_CBSP_KILL_COMPL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr,
556 template (omit) CBSP_IE_NumBcastComplList compl_list,
557 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
558 template (omit) uint8_t channel_ind)
559return template (value) CBSP_PDU {
560 var template (value) CBSP_IEs ies := {
561 ts_CbspMsgId(msg_id),
562 ts_OldSerNo(old_ser_nr)
563 };
564 if (not istemplatekind(compl_list, "omit")) {
565 ies[lengthof(ies)] := ts_CbspNumComplList(compl_list);
566 }
567 if (not istemplatekind(cell_list, "omit")) {
568 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
569 }
570 if (not istemplatekind(channel_ind, "omit")) {
571 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
572 }
573 return ts_CBSP(CBSP_MSGT_KILL_COMPL, ies);
574}
575function tr_CBSP_KILL_COMPL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?,
576 template CBSP_IE_NumBcastComplList compl_list := ?,
577 template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
578 template uint8_t channel_ind)
579return template CBSP_PDU {
580 var template CBSP_IEs ies := {
581 tr_CbspMsgId(msg_id),
582 tr_OldSerNo(old_ser_nr)
583 };
584 if (istemplatekind(compl_list, "*")) {
585 ies[lengthof(ies)] := *;
586 } else if (not istemplatekind(compl_list, "omit")) {
587 ies[lengthof(ies)] := tr_CbspNumComplList(compl_list);
588 }
589 if (istemplatekind(cell_list, "*")) {
590 ies[lengthof(ies)] := *;
591 } else if (not istemplatekind(cell_list, "omit")) {
592 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
593 }
594 if (istemplatekind(channel_ind, "*")) {
595 ies[lengthof(ies)] := *;
596 } else if (not istemplatekind(channel_ind, "omit")) {
597 ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
598 }
599 return tr_CBSP(CBSP_MSGT_KILL_COMPL, ies);
600}
601
602/* 8.1.3.6 KILL FAILURE */
603function ts_CBSP_KILL_FAIL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr,
604 template (value) CBSP_FailureListItems fail_list,
605 template (omit) CBSP_IE_NumBcastComplList compl_list,
606 template (omit) BSSMAP_FIELD_CellIdentificationList cell_list,
607 template (omit) uint8_t channel_ind)
608return template (value) CBSP_PDU {
609 var template (value) CBSP_IEs ies := {
610 ts_CbspMsgId(msg_id),
611 ts_OldSerNo(old_ser_nr),
612 ts_CbspFailList(fail_list)
613 };
614 if (not istemplatekind(compl_list, "omit")) {
615 ies[lengthof(ies)] := ts_CbspNumComplList(compl_list);
616 }
617 if (not istemplatekind(cell_list, "omit")) {
618 ies[lengthof(ies)] := ts_CbspCellList(cell_list);
619 }
620 if (not istemplatekind(channel_ind, "omit")) {
621 ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind);
622 }
623 return ts_CBSP(CBSP_MSGT_KILL_FAIL, ies);
624}
625function tr_CBSP_KILL_FAIL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?,
626 template CBSP_FailureListItems fail_list := ?,
627 template CBSP_IE_NumBcastComplList compl_list := *,
628 template BSSMAP_FIELD_CellIdentificationList cell_list := *,
629 template uint8_t channel_ind := *)
630return template CBSP_PDU {
631 var template CBSP_IEs ies := {
632 tr_CbspMsgId(msg_id),
633 tr_OldSerNo(old_ser_nr),
634 tr_CbspFailList(fail_list)
635 };
636 if (istemplatekind(compl_list, "*")) {
Harald Welteb5223232019-09-05 11:13:56 +0200637 //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200638 } else if (not istemplatekind(compl_list, "omit")) {
639 ies[lengthof(ies)] := tr_CbspNumComplList(compl_list);
640 }
Harald Welte885de1c2020-04-20 17:50:22 +0200641 if (istemplatekind(cell_list, "*")) {
Harald Welteb5223232019-09-05 11:13:56 +0200642 //ies[lengthof(ies)] := tr_CbspCellList ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200643 } else if (not istemplatekind(cell_list, "omit")) {
644 ies[lengthof(ies)] := tr_CbspCellList(cell_list);
645 }
646 if (istemplatekind(channel_ind, "*")) {
Harald Weltee53a23d2020-04-20 18:01:00 +0200647 testcase.stop("TITAN > 6.5.0 doesn't support this");
648 //ies[lengthof(ies)] := tr_CbspChannelInd(?) ifpresent;
Harald Welteea260342019-08-01 09:49:38 +0200649 } else if (not istemplatekind(channel_ind, "omit")) {
650 ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind);
651 }
652 return tr_CBSP(CBSP_MSGT_KILL_FAIL, ies);
653}
654
655
656/* 8.1.3.16 RESET */
657template (value) CBSP_PDU ts_CBSP_RESET(template (value) BSSMAP_FIELD_CellIdentificationList cell_list) :=
658 ts_CBSP(CBSP_MSGT_RESET, {
659 ts_CbspCellList(cell_list)
660 });
661template CBSP_PDU tr_CBSP_RESET(template BSSMAP_FIELD_CellIdentificationList cell_list := ?) :=
662 tr_CBSP(CBSP_MSGT_RESET, {
663 tr_CbspCellList(cell_list)
664 });
665
666/* 8.1.3.17 RESET COMPLETE */
667template (value) CBSP_PDU ts_CBSP_RESET_COMPL(template (value) BSSMAP_FIELD_CellIdentificationList cell_list) :=
668 ts_CBSP(CBSP_MSGT_RESET_COMPL, {
669 ts_CbspCellList(cell_list)
670 });
671template CBSP_PDU tr_CBSP_RESET_COMPL(template BSSMAP_FIELD_CellIdentificationList cell_list := ?) :=
672 tr_CBSP(CBSP_MSGT_RESET_COMPL, {
673 tr_CbspCellList(cell_list)
674 });
675
676/* 8.1.3.18 RESET FAILURE */
677template (value) CBSP_PDU ts_CBSP_RESET_FAIL(template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
678 template (value) CBSP_FailureListItems fail_items) :=
679 ts_CBSP(CBSP_MSGT_RESET_FAIL, {
680 ts_CbspFailList(fail_items),
681 ts_CbspCellList(cell_list)
682 });
683
684template CBSP_PDU tr_CBSP_RESET_FAIL(template BSSMAP_FIELD_CellIdentificationList cell_list,
685 template CBSP_FailureListItems fail_items) :=
686 tr_CBSP(CBSP_MSGT_RESET_FAIL, {
687 tr_CbspFailList(fail_items),
688 tr_CbspCellList(cell_list)
689 });
690
691/* 8.1.3.18a KEEP-ALIVE */
692template (value) CBSP_PDU ts_CBSP_KEEP_ALIVE(uint8_t rep_period) :=
693 ts_CBSP(CBSP_MSGT_KEEP_ALIVE, {ts_CbspKARepPeriod(rep_period)});
694template CBSP_PDU tr_CBSP_KEEP_ALIVE(template uint8_t rep_period := ?) :=
695 tr_CBSP(CBSP_MSGT_KEEP_ALIVE, {tr_CbspKARepPeriod(rep_period)});
696
697/* 8.1.3.18b KEEP-ALIVE COMPLETE */
698template (value) CBSP_PDU ts_CBSP_KEEP_ALIVE_COMPL :=
699 ts_CBSP(CBSP_MSGT_KEEP_ALIVE_COMPL, {});
700template CBSP_PDU tr_CBSP_KEEP_ALIVE_COMPL :=
701 tr_CBSP(CBSP_MSGT_KEEP_ALIVE_COMPL, {});
702
703/* 8.1.3.19 RESTART */
704template (value) CBSP_PDU ts_CBSP_RESTART(template (value) BSSMAP_FIELD_CellIdentificationList cell_list,
705 template (value) CBSP_BcastMsgType msg_type,
706 template (value) CBSP_RecoveryInd rec_ind) :=
707 ts_CBSP(CBSP_MSGT_RESTART, {
708 ts_CbspCellList(cell_list),
709 ts_CbspBcastMsgType(msg_type),
710 ts_CbspRecoveryInd(rec_ind)
711 });
712template CBSP_PDU tr_CBSP_RESTART(template BSSMAP_FIELD_CellIdentificationList cell_list := ?,
713 template CBSP_BcastMsgType msg_type := ?,
714 template CBSP_RecoveryInd rec_ind := ?) :=
715 tr_CBSP(CBSP_MSGT_RESTART, {
716 tr_CbspCellList(cell_list),
717 tr_CbspBcastMsgType(msg_type),
718 tr_CbspRecoveryInd(rec_ind)
719 });
720
721/* 8.1.3.20 FAILURE */
722template (value) CBSP_PDU ts_CBSP_FAILURE(template (value) CBSP_FailureListItems fail_list,
723 template (value) CBSP_BcastMsgType msg_type) :=
724 ts_CBSP(CBSP_MSGT_FAILURE, {
725 ts_CbspFailList(fail_list),
726 ts_CbspBcastMsgType(msg_type)
727 });
728template CBSP_PDU tr_CBSP_FAILURE(template CBSP_FailureListItems fail_list := ?,
729 template CBSP_BcastMsgType msg_type := ?) :=
730 tr_CBSP(CBSP_MSGT_FAILURE, {
731 tr_CbspFailList(fail_list),
732 tr_CbspBcastMsgType(msg_type)
733 });
734
735/* 8.1.3.21 ERROR INDICATION */
736template (value) CBSP_PDU ts_CBSP_ERROR_IND(CBSP_Cause cause) :=
737 ts_CBSP(CBSP_MSGT_ERROR_IND, {ts_CbspCause(cause)});
738template CBSP_PDU tr_CBSP_ERROR_IND(template CBSP_Cause cause) :=
739 tr_CBSP(CBSP_MSGT_ERROR_IND, {tr_CbspCause(cause), *});
740
741
742function f_cbsp_find_ie(CBSP_PDU msg, CBSP_IEI iei, out CBSP_IE ret) return boolean {
743 for (var integer i := 0; i < sizeof(msg.ies); i := i+1) {
744 if (msg.ies[i].iei == iei) {
745 ret := msg.ies[i];
746 return true;
747 }
748 }
749 return false;
750}
751
752
753}