Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 1 | module CBSP_Templates { |
| 2 | |
| 3 | import from Osmocom_Types all; |
| 4 | import from BSSAP_Types all; |
| 5 | import 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 :( */ |
| 12 | template (value) CBSP_IE ts_CBSP_IE(CBSP_IEI iei, template (value) CBSP_IE_Body body) := { |
| 13 | iei := iei, |
| 14 | body := body |
| 15 | } |
| 16 | |
| 17 | template CBSP_IE tr_CBSP_IE(template CBSP_IE_Body body) := { |
| 18 | iei := ?, |
| 19 | body := body |
| 20 | } |
| 21 | |
| 22 | |
| 23 | template (value) CBSP_IE ts_CbspMsgId(template (value) uint16_t val) := |
| 24 | ts_CBSP_IE(CBSP_IEI_MSG_ID, {msg_id := val}); |
| 25 | template CBSP_IE tr_CbspMsgId(template uint16_t val := ?) := |
| 26 | tr_CBSP_IE({msg_id := val}); |
| 27 | |
| 28 | template (value) CBSP_IE ts_NewSerNo(template (value) uint16_t val) := |
| 29 | ts_CBSP_IE(CBSP_IEI_NEW_SERIAL_NR, {new_ser_nr := val}); |
| 30 | template CBSP_IE tr_NewSerNo(template uint16_t val := ?) := |
| 31 | tr_CBSP_IE({new_ser_nr := val}); |
| 32 | |
| 33 | template (value) CBSP_IE ts_OldSerNo(template (value) uint16_t val) := |
| 34 | ts_CBSP_IE(CBSP_IEI_OLD_SERIAL_NR, {old_ser_nr := val}); |
| 35 | template CBSP_IE tr_OldSerNo(template uint16_t val := ?) := |
| 36 | tr_CBSP_IE({old_ser_nr := val}); |
| 37 | |
| 38 | template (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}); |
| 40 | template CBSP_IE tr_CbspKARepPeriod(template uint8_t rep_per := ?) := |
| 41 | tr_CBSP_IE({keep_alive_rep_period := rep_per}); |
| 42 | |
| 43 | function 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 | } |
| 52 | function 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, "*")) { |
Harald Welte | 0833230 | 2019-08-01 09:54:40 +0200 | [diff] [blame] | 57 | ie := tr_CBSP_IE({channel_ind := ?}); //ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 58 | } else { |
| 59 | ie := tr_CBSP_IE({channel_ind := val}); |
| 60 | } |
| 61 | return ie; |
| 62 | } |
| 63 | |
| 64 | template (value) CBSP_IE ts_CbspCause(template (value) CBSP_Cause c) := |
| 65 | ts_CBSP_IE(CBSP_IEI_CAUSE, {cause := c}); |
| 66 | template CBSP_IE tr_CbspCause(template CBSP_Cause c := ?) := |
| 67 | tr_CBSP_IE({cause := c}); |
| 68 | |
| 69 | template (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 | }}); |
| 77 | template 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 | |
| 86 | template (value) CBSP_IE ts_CbspCategory(template (value) CBSP_Category cat) := |
| 87 | ts_CBSP_IE(CBSP_IEI_CATEGORY, {category := cat}); |
| 88 | template CBSP_IE tr_CbspCategory(template CBSP_Category cat := ?) := |
| 89 | tr_CBSP_IE({category := cat}); |
| 90 | |
| 91 | template (value) CBSP_IE ts_CbspRepetitionPeriod(template (value) uint16_t per) := |
| 92 | ts_CBSP_IE(CBSP_IEI_REP_PERIOD, {rep_period := per}); |
| 93 | template CBSP_IE tr_CbspRepetitionPeriod(template uint16_t per := ?) := |
| 94 | tr_CBSP_IE({rep_period := per}); |
| 95 | |
| 96 | template (value) CBSP_IE ts_CbspNumBcastReq(template (value) uint16_t num) := |
| 97 | ts_CBSP_IE(CBSP_IEI_NUM_BCAST_REQ, {num_bcast_req := num}); |
| 98 | template CBSP_IE tr_CbspNumBcastReq(template uint16_t num := ?) := |
| 99 | tr_CBSP_IE({num_bcast_req := num}); |
| 100 | |
| 101 | template (value) CBSP_IE ts_CbspNumPages(template (value) uint8_t num) := |
| 102 | ts_CBSP_IE(CBSP_IEI_NUM_OF_PAGES, {num_of_pages := num}); |
| 103 | template CBSP_IE tr_CbspNumPages(template uint16_t num := ?) := |
| 104 | tr_CBSP_IE({num_of_pages := num}); |
| 105 | |
| 106 | template (value) CBSP_IE ts_EmergencyInd(template (value) uint8_t val) := |
| 107 | ts_CBSP_IE(CBSP_IEI_EMERG_IND, {emerg_ind := val}); |
| 108 | template CBSP_IE tr_EmergencyInd(template uint8_t val := ?) := |
| 109 | tr_CBSP_IE({emerg_ind := val}); |
| 110 | |
| 111 | template (value) CBSP_IE ts_WarningType(template (value) uint16_t val) := |
| 112 | ts_CBSP_IE(CBSP_IEI_WARN_TYPE, {warn_type := val}); |
| 113 | template CBSP_IE tr_WarningType(template uint16_t val) := |
| 114 | tr_CBSP_IE({warn_type := val}); |
| 115 | |
| 116 | template (value) CBSP_IE ts_WarnSecInfo(template (value) octetstring payl := ''O) := |
| 117 | ts_CBSP_IE(CBSP_IEI_WARN_SEC_INFO, {warn_sec_info := payl}); |
| 118 | template CBSP_IE tr_WarnSecInfo(template octetstring payl := ?) := |
| 119 | tr_CBSP_IE({warn_sec_info := payl}); |
| 120 | |
| 121 | template (value) CBSP_IE ts_WarningPeriod(template (value) uint8_t val) := |
| 122 | ts_CBSP_IE(CBSP_IEI_WARNING_PERIOD, {warning_period := val}); |
| 123 | template CBSP_IE tr_WarningPeriod(template uint8_t val := ?) := |
| 124 | tr_CBSP_IE({warning_period := val}); |
| 125 | |
| 126 | template (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 | }}); |
| 131 | template CBSP_IE tr_CbspFailList(template CBSP_FailureListItems items := ?) := |
| 132 | tr_CBSP_IE({failure_list := { |
Harald Welte | 09538f8 | 2019-08-01 09:50:25 +0200 | [diff] [blame] | 133 | len := ?, |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 134 | list := items |
| 135 | }}); |
| 136 | |
Pau Espin Pedrol | 2b33d4e | 2022-06-10 17:00:30 +0200 | [diff] [blame^] | 137 | template (present) CBSP_FailureListItem CBSP_FailureListItem_LAC_CI( |
| 138 | template (present) BSSMAP_FIELD_CellIdentification_LAC_CI lac_ci := ?, |
| 139 | template (present) CBSP_Cause cause := ?) := |
| 140 | { |
| 141 | spare1_4 := '0000'B, |
| 142 | cell_id_discr := '0001'B, |
| 143 | cell_id := { |
| 144 | cI_LAC_CI := lac_ci |
| 145 | }, |
| 146 | cause := cause |
| 147 | }; |
| 148 | |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 149 | template (value) CBSP_IE ts_CbspNumComplList(template (value) CBSP_IE_NumBcastComplList list) := |
| 150 | ts_CBSP_IE(CBSP_IEI_NUM_BCAST_COMPL_LIST, {num_bcast_compl_list := list}); |
| 151 | template CBSP_IE tr_CbspNumComplList(template CBSP_IE_NumBcastComplList list := ?) := |
| 152 | tr_CBSP_IE({num_bcast_compl_list := list}); |
| 153 | |
| 154 | template (value) CBSP_IE ts_CbspBcastMsgType(template (value) CBSP_BcastMsgType bi) := |
| 155 | ts_CBSP_IE(CBSP_IEI_BCAST_MSG_TYPE, {bcast_msg_type := { |
| 156 | spare1_4 := '0000'B, |
| 157 | msg_type := bi |
| 158 | }}); |
| 159 | template CBSP_IE tr_CbspBcastMsgType(template CBSP_BcastMsgType bi := ?) := |
| 160 | tr_CBSP_IE({bcast_msg_type := { |
| 161 | spare1_4 := ?, |
| 162 | msg_type := bi |
| 163 | }}); |
| 164 | |
| 165 | template (value) CBSP_IE ts_CbspRecoveryInd(template (value) CBSP_RecoveryInd ri) := |
| 166 | ts_CBSP_IE(CBSP_IEI_RECOVERY_IND, {recovery_ind := { |
| 167 | spare1_4 := '0000'B, |
| 168 | recovery := ri |
| 169 | }}); |
| 170 | template CBSP_IE tr_CbspRecoveryInd(template CBSP_RecoveryInd ri) := |
| 171 | tr_CBSP_IE({recovery_ind := { |
| 172 | spare1_4 := ?, |
| 173 | recovery := ri |
| 174 | }}); |
| 175 | |
| 176 | template (value) CBSP_IE ts_CbspMsgContent(template (value) octetstring payload, uint8_t user_len) := |
| 177 | ts_CBSP_IE(CBSP_IEI_MSG_CONTENT, {msg_content := { |
| 178 | user_len := user_len, |
| 179 | val := payload |
| 180 | }}); |
| 181 | template CBSP_IE tr_CbspMsgContent(template octetstring payload := ?, template uint8_t user_len := ?) := |
| 182 | tr_CBSP_IE({msg_content := { |
| 183 | user_len := user_len, |
| 184 | val := payload |
| 185 | }}); |
| 186 | |
| 187 | template (value) CBSP_IE ts_CbspDCS(template (value) uint8_t dcs) := |
| 188 | ts_CBSP_IE(CBSP_IEI_DCS, {dcs := dcs}); |
| 189 | template CBSP_IE tr_CbspDCS(template uint8_t dcs := ?) := |
| 190 | tr_CBSP_IE({dcs := dcs}); |
| 191 | |
| 192 | |
| 193 | template (value) CBSP_PDU ts_CBSP(CBSP_MessageType msg_type, template (value) CBSP_IEs ies) := { |
| 194 | msg_type := msg_type, |
| 195 | len := 0, /* overwritten */ |
| 196 | ies := ies |
| 197 | } |
| 198 | template CBSP_PDU tr_CBSP(template CBSP_MessageType msg_type := ?, template CBSP_IEs ies := *) := { |
| 199 | msg_type := msg_type, |
| 200 | len := ?, |
| 201 | ies := ies |
| 202 | } |
| 203 | |
| 204 | |
| 205 | |
| 206 | /* 8.1.3.1 WRITE REPLACE */ |
| 207 | function ts_CBSP_WRITE_CBS(template (value) uint16_t msg_id, |
| 208 | template (value) uint16_t new_ser_nr, |
| 209 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 210 | template (value) uint8_t channel_ind, |
| 211 | template (value) CBSP_Category category, |
| 212 | template (value) uint16_t rep_period, |
| 213 | template (value) uint16_t num_bcast_req, |
| 214 | template (value) uint8_t dcs, |
| 215 | template (value) CBSP_IEs content) return template (value) CBSP_PDU { |
| 216 | var template (value) CBSP_IEs ies := { |
| 217 | ts_CbspMsgId(msg_id), |
| 218 | ts_NewSerNo(new_ser_nr), |
| 219 | ts_CbspCellList(cell_list), |
| 220 | ts_CbspChannelInd(channel_ind), |
| 221 | ts_CbspCategory(category), |
| 222 | ts_CbspRepetitionPeriod(rep_period), |
| 223 | ts_CbspNumBcastReq(num_bcast_req), |
| 224 | ts_CbspDCS(dcs), |
| 225 | ts_CbspNumPages(lengthof(content)) |
| 226 | }; |
| 227 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE, valueof(ies) & valueof(content)); |
| 228 | } |
| 229 | template CBSP_PDU tr_CBSP_WRITE_CBS(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?, |
| 230 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 231 | template uint8_t channel_ind := ?, |
| 232 | template CBSP_Category category := ?, |
| 233 | template uint16_t rep_period := ?, |
| 234 | template uint16_t num_bcast_req := ?, |
| 235 | template uint8_t dcs := ?, |
| 236 | template CBSP_IEs content := ? |
| 237 | ) := |
| 238 | tr_CBSP(CBSP_MSGT_WRITE_REPLACE, ({ |
| 239 | tr_CbspMsgId(msg_id), |
| 240 | tr_NewSerNo(new_ser_nr), |
| 241 | tr_CbspCellList(cell_list), |
| 242 | tr_CbspChannelInd(channel_ind), |
| 243 | tr_CbspCategory(category), |
| 244 | tr_CbspRepetitionPeriod(rep_period), |
| 245 | tr_CbspNumBcastReq(num_bcast_req), |
| 246 | tr_CbspDCS(dcs), |
| 247 | tr_CbspNumPages(lengthof(content)), all from content })); |
| 248 | |
| 249 | |
| 250 | function ts_CBSP_REPLACE_CBS(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 251 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 252 | template (value) uint8_t channel_ind, |
| 253 | template (value) CBSP_Category category, |
| 254 | template (value) uint16_t rep_period, |
| 255 | template (value) uint16_t num_bcast_req, |
| 256 | template (value) uint8_t dcs, |
| 257 | template (value) CBSP_IEs content) return template (value) CBSP_PDU { |
| 258 | var template (value) CBSP_IEs ies := { |
| 259 | ts_CbspMsgId(msg_id), |
| 260 | ts_NewSerNo(new_ser_nr), |
| 261 | ts_OldSerNo(old_ser_nr), |
| 262 | ts_CbspCellList(cell_list), |
| 263 | ts_CbspChannelInd(channel_ind), |
| 264 | ts_CbspCategory(category), |
| 265 | ts_CbspRepetitionPeriod(rep_period), |
| 266 | ts_CbspNumBcastReq(num_bcast_req), |
| 267 | ts_CbspDCS(dcs), |
| 268 | ts_CbspNumPages(lengthof(content)) |
| 269 | }; |
| 270 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE, valueof(ies) & valueof(content)); |
| 271 | } |
| 272 | template CBSP_PDU tr_CBSP_REPLACE_CBS(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?, |
| 273 | template uint16_t old_ser_nr := ?, |
| 274 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 275 | template uint8_t channel_ind := ?, |
| 276 | template CBSP_Category category := ?, |
| 277 | template uint16_t rep_period := ?, |
| 278 | template uint16_t num_bcast_req := ?, |
| 279 | template uint8_t dcs := ?, |
| 280 | template CBSP_IEs content := ? |
| 281 | ) := |
| 282 | tr_CBSP(CBSP_MSGT_WRITE_REPLACE, ({ |
| 283 | tr_CbspMsgId(msg_id), |
| 284 | tr_NewSerNo(new_ser_nr), |
| 285 | tr_OldSerNo(old_ser_nr), |
| 286 | tr_CbspCellList(cell_list), |
| 287 | tr_CbspChannelInd(channel_ind), |
| 288 | tr_CbspCategory(category), |
| 289 | tr_CbspRepetitionPeriod(rep_period), |
| 290 | tr_CbspNumBcastReq(num_bcast_req), |
| 291 | tr_CbspDCS(dcs), |
| 292 | tr_CbspNumPages(lengthof(content)), all from content })); |
| 293 | |
| 294 | template (value) CBSP_PDU ts_CBSP_WRITE_EMERG(uint16_t msg_id, uint16_t new_ser_nr, |
| 295 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 296 | template (value) uint8_t emerg_ind, |
| 297 | template (value) uint16_t warn_type, |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 298 | template (value) uint8_t warn_per |
| 299 | ) := |
| 300 | ts_CBSP(CBSP_MSGT_WRITE_REPLACE, { |
| 301 | ts_CbspMsgId(msg_id), |
| 302 | ts_NewSerNo(new_ser_nr), |
| 303 | ts_CbspCellList(cell_list), |
| 304 | ts_EmergencyInd(emerg_ind), |
| 305 | ts_WarningType(warn_type), |
| 306 | ts_WarnSecInfo, |
| 307 | ts_WarningPeriod(warn_per) }); |
| 308 | template CBSP_PDU tr_CBSP_WRITE_EMERG(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?, |
| 309 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 310 | template uint8_t emerg_ind := ?, |
| 311 | template uint16_t warn_type := ?, |
| 312 | template uint16_t num_bcast_req := ?, |
| 313 | template uint8_t warn_per := ? |
| 314 | ) := |
| 315 | tr_CBSP(CBSP_MSGT_WRITE_REPLACE, { |
| 316 | tr_CbspMsgId(msg_id), |
| 317 | tr_NewSerNo(new_ser_nr), |
| 318 | tr_CbspCellList(cell_list), |
| 319 | tr_EmergencyInd(emerg_ind), |
| 320 | tr_WarningType(warn_type), |
| 321 | tr_WarnSecInfo, |
| 322 | tr_WarningPeriod(warn_per) }); |
| 323 | |
| 324 | |
| 325 | template (value) CBSP_PDU ts_CBSP_REPLACE_EMERG(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 326 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 327 | template (value) uint8_t emerg_ind, |
| 328 | template (value) uint16_t warn_type, |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 329 | template (value) uint8_t warn_per |
| 330 | ) := |
| 331 | ts_CBSP(CBSP_MSGT_WRITE_REPLACE, { |
| 332 | ts_CbspMsgId(msg_id), |
| 333 | ts_NewSerNo(new_ser_nr), |
| 334 | ts_OldSerNo(old_ser_nr), |
| 335 | ts_CbspCellList(cell_list), |
| 336 | ts_EmergencyInd(emerg_ind), |
| 337 | ts_WarningType(warn_type), |
| 338 | ts_WarnSecInfo, |
| 339 | ts_WarningPeriod(warn_per) }); |
| 340 | template CBSP_PDU tr_CBSP_REPLACE_EMERG(template uint16_t msg_id := ?, template uint16_t new_ser_nr := ?, |
| 341 | template uint16_t old_ser_nr := ?, |
| 342 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 343 | template uint8_t emerg_ind := ?, |
| 344 | template uint16_t warn_type := ?, |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 345 | template uint8_t warn_per := ? |
| 346 | ) := |
| 347 | tr_CBSP(CBSP_MSGT_WRITE_REPLACE, { |
| 348 | tr_CbspMsgId(msg_id), |
| 349 | tr_NewSerNo(new_ser_nr), |
| 350 | tr_OldSerNo(old_ser_nr), |
| 351 | tr_CbspCellList(cell_list), |
| 352 | tr_EmergencyInd(emerg_ind), |
| 353 | tr_WarningType(warn_type), |
| 354 | tr_WarnSecInfo, |
| 355 | tr_WarningPeriod(warn_per) }); |
| 356 | |
| 357 | /* 8.1.3.2 WRITE-REPLACE COMPLETE */ |
| 358 | function ts_CBSP_WRITE_CBS_COMPL(uint16_t msg_id, uint16_t new_ser_nr, |
| 359 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 360 | template (value) uint8_t channel_ind) |
| 361 | return template (value) CBSP_PDU { |
| 362 | var template (value) CBSP_IEs ies := { |
| 363 | ts_CbspMsgId(msg_id), |
| 364 | ts_NewSerNo(new_ser_nr) |
| 365 | }; |
| 366 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 367 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 368 | } |
| 369 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 370 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 371 | } |
| 372 | function tr_CBSP_WRITE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 373 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 374 | template uint8_t channel_ind) |
| 375 | return template CBSP_PDU { |
| 376 | var template CBSP_IEs ies := { |
| 377 | tr_CbspMsgId(msg_id), |
| 378 | tr_NewSerNo(new_ser_nr) |
| 379 | }; |
| 380 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 381 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 382 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 383 | } else if (istemplatekind(cell_list, "?")) { |
| 384 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 385 | } else if (not istemplatekind(cell_list, "omit")) { |
| 386 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 387 | } |
Harald Welte | 25a6075 | 2019-09-06 23:08:23 +0200 | [diff] [blame] | 388 | if (not istemplatekind(channel_ind, "omit")) { |
| 389 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 390 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 391 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 392 | } |
| 393 | |
| 394 | |
| 395 | function ts_CBSP_REPLACE_CBS_COMPL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 396 | template (value) CBSP_IE_NumBcastComplList compl_list, |
| 397 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 398 | template (value) uint8_t channel_ind) |
| 399 | return template (value) CBSP_PDU { |
| 400 | var template (value) CBSP_IEs ies := { |
| 401 | ts_CbspMsgId(msg_id), |
| 402 | ts_NewSerNo(new_ser_nr), |
| 403 | ts_OldSerNo(old_ser_nr), |
| 404 | ts_CbspNumComplList(compl_list) |
| 405 | }; |
| 406 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 407 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 408 | } |
| 409 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 410 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 411 | } |
| 412 | function tr_CBSP_REPLACE_CBS_COMPL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 413 | template uint16_t old_ser_nr, |
| 414 | template CBSP_IE_NumBcastComplList compl_list, |
| 415 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 416 | template uint8_t channel_ind) |
| 417 | return template CBSP_PDU { |
| 418 | var template CBSP_IEs ies := { |
| 419 | tr_CbspMsgId(msg_id), |
| 420 | tr_NewSerNo(new_ser_nr), |
Harald Welte | d686941 | 2022-04-27 17:50:13 +0200 | [diff] [blame] | 421 | tr_OldSerNo(old_ser_nr) |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 422 | }; |
Harald Welte | d686941 | 2022-04-27 17:50:13 +0200 | [diff] [blame] | 423 | if (istemplatekind(compl_list, "*")) { |
| 424 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 425 | //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent; |
| 426 | } else if (istemplatekind(compl_list, "?")) { |
| 427 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 428 | } else if (not istemplatekind(compl_list, "omit")) { |
| 429 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 430 | } |
| 431 | |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 432 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 433 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 434 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 435 | } else if (istemplatekind(cell_list, "?")) { |
| 436 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 437 | } else if (not istemplatekind(cell_list, "omit")) { |
| 438 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 439 | } |
Harald Welte | 25a6075 | 2019-09-06 23:08:23 +0200 | [diff] [blame] | 440 | if (not istemplatekind(channel_ind, "omit")) { |
| 441 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 442 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 443 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_COMPL, ies); |
| 444 | } |
| 445 | |
| 446 | |
| 447 | /* 8.1.3.3 WRITE-REPLACE FAILURE */ |
| 448 | function ts_CBSP_WRITE_CBS_FAIL(uint16_t msg_id, uint16_t new_ser_nr, |
| 449 | template (value) CBSP_FailureListItems fail_list, |
| 450 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 451 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 452 | template (value) uint8_t channel_ind) |
| 453 | return template (value) CBSP_PDU { |
| 454 | var template (value) CBSP_IEs ies := { |
| 455 | ts_CbspMsgId(msg_id), |
| 456 | ts_NewSerNo(new_ser_nr), |
| 457 | ts_CbspFailList(fail_list) |
| 458 | }; |
| 459 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 460 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 461 | } |
| 462 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 463 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 464 | } |
| 465 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 466 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 467 | } |
| 468 | function tr_CBSP_WRITE_CBS_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 469 | template CBSP_FailureListItems fail_list, |
| 470 | template CBSP_IE_NumBcastComplList compl_list, |
| 471 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 472 | template uint8_t channel_ind) |
| 473 | return template CBSP_PDU { |
| 474 | var template CBSP_IEs ies := { |
| 475 | tr_CbspMsgId(msg_id), |
| 476 | tr_NewSerNo(new_ser_nr), |
| 477 | tr_CbspFailList(fail_list) |
| 478 | }; |
| 479 | if (istemplatekind(compl_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 480 | //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 481 | } else if (istemplatekind(compl_list, "?")) { |
| 482 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 483 | } else if (not istemplatekind(compl_list, "omit")) { |
| 484 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 485 | } |
| 486 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 487 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 488 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 489 | } else if (istemplatekind(cell_list, "?")) { |
| 490 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 491 | } else if (not istemplatekind(cell_list, "omit")) { |
| 492 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 493 | } |
Harald Welte | 25a6075 | 2019-09-06 23:08:23 +0200 | [diff] [blame] | 494 | if (not istemplatekind(channel_ind, "omit")) { |
| 495 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 496 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 497 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 498 | } |
| 499 | |
| 500 | |
| 501 | function ts_CBSP_REPLACE_CBS_FAIL(uint16_t msg_id, uint16_t new_ser_nr, uint16_t old_ser_nr, |
| 502 | template (value) CBSP_FailureListItems fail_list, |
| 503 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 504 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 505 | template (value) uint8_t channel_ind) |
| 506 | return template (value) CBSP_PDU { |
| 507 | var template (value) CBSP_IEs ies := { |
| 508 | ts_CbspMsgId(msg_id), |
| 509 | ts_NewSerNo(new_ser_nr), |
| 510 | ts_OldSerNo(old_ser_nr), |
| 511 | ts_CbspFailList(fail_list) |
| 512 | }; |
| 513 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 514 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 515 | } |
| 516 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 517 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 518 | } |
| 519 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 520 | return ts_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 521 | } |
| 522 | function tr_CBSP_REPLACE_CBS_FAIL(template uint16_t msg_id, template uint16_t new_ser_nr, |
| 523 | template uint16_t old_ser_nr, |
| 524 | template CBSP_FailureListItems fail_list, |
| 525 | template CBSP_IE_NumBcastComplList compl_list, |
| 526 | template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 527 | template uint8_t channel_ind) |
| 528 | return template CBSP_PDU { |
| 529 | var template CBSP_IEs ies := { |
| 530 | tr_CbspMsgId(msg_id), |
| 531 | tr_NewSerNo(new_ser_nr), |
| 532 | tr_OldSerNo(old_ser_nr), |
| 533 | tr_CbspFailList(fail_list) |
| 534 | }; |
| 535 | if (istemplatekind(compl_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 536 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 537 | } else if (istemplatekind(compl_list, "?")) { |
| 538 | ies[lengthof(ies)] := tr_CbspNumComplList(?); |
| 539 | } else if (not istemplatekind(compl_list, "omit")) { |
| 540 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 541 | } |
| 542 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 543 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 544 | } else if (istemplatekind(cell_list, "?")) { |
| 545 | ies[lengthof(ies)] := tr_CbspCellList(?); |
| 546 | } else if (not istemplatekind(cell_list, "omit")) { |
| 547 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 548 | } |
| 549 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 550 | return tr_CBSP(CBSP_MSGT_WRITE_REPLACE_FAIL, ies); |
| 551 | } |
| 552 | |
| 553 | /* 8.1.3.4 KILL */ |
Harald Welte | 4a788a0 | 2022-04-27 16:57:24 +0200 | [diff] [blame] | 554 | function ts_CBSP_KILL(template (value) uint16_t msg_id, |
| 555 | template (value) uint16_t old_ser_nr, |
| 556 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 557 | template (omit) uint8_t channel_ind) |
| 558 | return template (value) CBSP_PDU { |
| 559 | var template (value) CBSP_IEs ies := { |
| 560 | ts_CbspMsgId(msg_id), |
| 561 | ts_OldSerNo(old_ser_nr), |
| 562 | ts_CbspCellList(cell_list) |
| 563 | }; |
| 564 | if (not istemplatekind(channel_ind, "omit")) { |
| 565 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 566 | } |
| 567 | return ts_CBSP(CBSP_MSGT_KILL, ies); |
| 568 | } |
Harald Welte | 0833230 | 2019-08-01 09:54:40 +0200 | [diff] [blame] | 569 | function tr_CBSP_KILL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?, |
| 570 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 571 | template uint8_t channel_ind := ?) |
| 572 | return template (present) CBSP_PDU { |
| 573 | var template CBSP_IEs ies := { |
| 574 | tr_CbspMsgId(msg_id), |
| 575 | tr_OldSerNo(old_ser_nr), |
| 576 | tr_CbspCellList(cell_list) |
| 577 | }; |
| 578 | if (not istemplatekind(channel_ind, "omit")) { |
| 579 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 580 | } |
| 581 | return tr_CBSP(CBSP_MSGT_KILL, ies); |
| 582 | } |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 583 | |
| 584 | /* 8.1.3.5 KILL COMPLETE */ |
| 585 | function ts_CBSP_KILL_COMPL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 586 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 587 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 588 | template (omit) uint8_t channel_ind) |
| 589 | return template (value) CBSP_PDU { |
| 590 | var template (value) CBSP_IEs ies := { |
| 591 | ts_CbspMsgId(msg_id), |
| 592 | ts_OldSerNo(old_ser_nr) |
| 593 | }; |
| 594 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 595 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 596 | } |
| 597 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 598 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 599 | } |
| 600 | if (not istemplatekind(channel_ind, "omit")) { |
| 601 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 602 | } |
| 603 | return ts_CBSP(CBSP_MSGT_KILL_COMPL, ies); |
| 604 | } |
| 605 | function tr_CBSP_KILL_COMPL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?, |
| 606 | template CBSP_IE_NumBcastComplList compl_list := ?, |
| 607 | template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 608 | template uint8_t channel_ind) |
| 609 | return template CBSP_PDU { |
| 610 | var template CBSP_IEs ies := { |
| 611 | tr_CbspMsgId(msg_id), |
| 612 | tr_OldSerNo(old_ser_nr) |
| 613 | }; |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 614 | /* As soon as adding a '*' IE item, lengthof() no longer works on the ies record. So keep track of the |
| 615 | * next index to use separately. */ |
| 616 | var integer next_idx := lengthof(ies); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 617 | if (istemplatekind(compl_list, "*")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 618 | ies[next_idx] := *; |
| 619 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 620 | } else if (not istemplatekind(compl_list, "omit")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 621 | ies[next_idx] := tr_CbspNumComplList(compl_list); |
| 622 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 623 | } |
| 624 | if (istemplatekind(cell_list, "*")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 625 | ies[next_idx] := *; |
| 626 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 627 | } else if (not istemplatekind(cell_list, "omit")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 628 | ies[next_idx] := tr_CbspCellList(cell_list); |
| 629 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 630 | } |
| 631 | if (istemplatekind(channel_ind, "*")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 632 | ies[next_idx] := *; |
| 633 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 634 | } else if (not istemplatekind(channel_ind, "omit")) { |
Neels Hofmeyr | cb11a97 | 2020-07-31 16:57:40 +0200 | [diff] [blame] | 635 | ies[next_idx] := tr_CbspChannelInd(channel_ind); |
| 636 | next_idx := next_idx + 1; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 637 | } |
| 638 | return tr_CBSP(CBSP_MSGT_KILL_COMPL, ies); |
| 639 | } |
| 640 | |
| 641 | /* 8.1.3.6 KILL FAILURE */ |
| 642 | function ts_CBSP_KILL_FAIL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 643 | template (value) CBSP_FailureListItems fail_list, |
| 644 | template (omit) CBSP_IE_NumBcastComplList compl_list, |
| 645 | template (omit) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 646 | template (omit) uint8_t channel_ind) |
| 647 | return template (value) CBSP_PDU { |
| 648 | var template (value) CBSP_IEs ies := { |
| 649 | ts_CbspMsgId(msg_id), |
| 650 | ts_OldSerNo(old_ser_nr), |
| 651 | ts_CbspFailList(fail_list) |
| 652 | }; |
| 653 | if (not istemplatekind(compl_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 654 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 655 | } |
| 656 | if (not istemplatekind(cell_list, "omit")) { |
Harald Welte | afd87ef | 2020-08-21 12:22:31 +0200 | [diff] [blame] | 657 | ies[lengthof(ies)] := ts_CbspCellList(valueof(cell_list)); |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 658 | } |
| 659 | if (not istemplatekind(channel_ind, "omit")) { |
| 660 | ies[lengthof(ies)] := ts_CbspChannelInd(channel_ind); |
| 661 | } |
| 662 | return ts_CBSP(CBSP_MSGT_KILL_FAIL, ies); |
| 663 | } |
| 664 | function tr_CBSP_KILL_FAIL(template uint16_t msg_id := ?, template uint16_t old_ser_nr := ?, |
| 665 | template CBSP_FailureListItems fail_list := ?, |
| 666 | template CBSP_IE_NumBcastComplList compl_list := *, |
| 667 | template BSSMAP_FIELD_CellIdentificationList cell_list := *, |
| 668 | template uint8_t channel_ind := *) |
| 669 | return template CBSP_PDU { |
| 670 | var template CBSP_IEs ies := { |
| 671 | tr_CbspMsgId(msg_id), |
| 672 | tr_OldSerNo(old_ser_nr), |
| 673 | tr_CbspFailList(fail_list) |
| 674 | }; |
| 675 | if (istemplatekind(compl_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 676 | //ies[lengthof(ies)] := tr_CbspNumComplList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 677 | } else if (not istemplatekind(compl_list, "omit")) { |
| 678 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 679 | } |
Harald Welte | 885de1c | 2020-04-20 17:50:22 +0200 | [diff] [blame] | 680 | if (istemplatekind(cell_list, "*")) { |
Harald Welte | b522323 | 2019-09-05 11:13:56 +0200 | [diff] [blame] | 681 | //ies[lengthof(ies)] := tr_CbspCellList ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 682 | } else if (not istemplatekind(cell_list, "omit")) { |
| 683 | ies[lengthof(ies)] := tr_CbspCellList(cell_list); |
| 684 | } |
| 685 | if (istemplatekind(channel_ind, "*")) { |
Harald Welte | e53a23d | 2020-04-20 18:01:00 +0200 | [diff] [blame] | 686 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 687 | //ies[lengthof(ies)] := tr_CbspChannelInd(?) ifpresent; |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 688 | } else if (not istemplatekind(channel_ind, "omit")) { |
| 689 | ies[lengthof(ies)] := tr_CbspChannelInd(channel_ind); |
| 690 | } |
| 691 | return tr_CBSP(CBSP_MSGT_KILL_FAIL, ies); |
| 692 | } |
| 693 | |
Harald Welte | 562d28e | 2022-03-28 21:29:04 +0200 | [diff] [blame] | 694 | /* 8.1.3.10 MESSAGE STATUS QUERY */ |
| 695 | template (value) CBSP_PDU |
| 696 | ts_CBSP_MSG_STATUS_QUERY(template (value) uint16_t msg_id, |
| 697 | template (value) uint16_t old_ser_nr, |
| 698 | template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 699 | template (value) uint8_t channel_ind) := |
| 700 | ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY, { |
| 701 | ts_CbspMsgId(msg_id), |
| 702 | ts_OldSerNo(old_ser_nr), |
| 703 | ts_CbspCellList(cell_list), |
| 704 | ts_CbspChannelInd(channel_ind)}); |
| 705 | template (present) CBSP_PDU |
| 706 | tr_CBSP_MSG_STATUS_QUERY(template (present) uint16_t msg_id := ?, |
| 707 | template (present) uint16_t old_ser_nr := ?, |
| 708 | template (present) BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 709 | template (present) uint8_t channel_ind := ?) := |
| 710 | ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY, { |
| 711 | ts_CbspMsgId(msg_id), |
| 712 | ts_OldSerNo(old_ser_nr), |
| 713 | ts_CbspCellList(cell_list), |
| 714 | ts_CbspChannelInd(channel_ind)}); |
| 715 | |
| 716 | /* 8.1.3.11 MESSAGE STATUS QUERY COMPLETE */ |
| 717 | template (value) CBSP_PDU |
| 718 | ts_CBSP_MSG_STATUS_QUERY_COMPL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 719 | template (value) CBSP_IE_NumBcastComplList compl_list, |
| 720 | template (value) uint8_t channel_ind) := |
| 721 | ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_COMPL, { |
| 722 | ts_CbspMsgId(msg_id), |
| 723 | ts_OldSerNo(old_ser_nr), |
| 724 | ts_CbspNumComplList(valueof(compl_list)), |
| 725 | ts_CbspChannelInd(channel_ind)}); |
| 726 | template (present) CBSP_PDU |
| 727 | tr_CBSP_MSG_STATUS_QUERY_COMPL(template (present) uint16_t msg_id, template (present) uint16_t old_ser_nr, |
| 728 | template (present) CBSP_IE_NumBcastComplList compl_list, |
| 729 | template (present) uint8_t channel_ind) := |
| 730 | tr_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_COMPL, { |
| 731 | tr_CbspMsgId(msg_id), |
| 732 | tr_OldSerNo(old_ser_nr), |
| 733 | tr_CbspNumComplList(compl_list), |
| 734 | tr_CbspChannelInd(channel_ind)}); |
| 735 | |
| 736 | /* 8.1.3.12 MESSAGE STATUS QUERY FAILURE */ |
| 737 | function ts_CBSP_MSG_STATUS_QUERY_FAIL(template (value) uint16_t msg_id, template (value) uint16_t old_ser_nr, |
| 738 | template (value) CBSP_FailureListItems fail_list, |
| 739 | template (value) uint8_t channel_ind, |
| 740 | template (omit) CBSP_IE_NumBcastComplList compl_list) |
| 741 | return template (value) CBSP_PDU { |
| 742 | var template (value) CBSP_IEs ies := { |
| 743 | ts_CbspMsgId(msg_id), |
| 744 | ts_OldSerNo(old_ser_nr), |
| 745 | ts_CbspFailList(fail_list), |
| 746 | ts_CbspChannelInd(channel_ind) |
| 747 | }; |
| 748 | if (not istemplatekind(compl_list, "omit")) { |
| 749 | ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
| 750 | } |
| 751 | return ts_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_FAIL, ies); |
| 752 | } |
| 753 | function tr_CBSP_MSG_STATUS_QUERY_FAIL(template (present) uint16_t msg_id := ?, template (present) uint16_t old_ser_nr := ?, |
| 754 | template (present) CBSP_FailureListItems fail_list := ?, |
| 755 | template (present) uint8_t channel_ind := ?, |
| 756 | template CBSP_IE_NumBcastComplList compl_list := *) |
| 757 | return template (present) CBSP_PDU { |
| 758 | var template (present) CBSP_IEs ies := { |
| 759 | tr_CbspMsgId(msg_id), |
| 760 | tr_OldSerNo(old_ser_nr), |
| 761 | tr_CbspFailList(fail_list), |
| 762 | tr_CbspChannelInd(channel_ind) |
| 763 | }; |
| 764 | if (istemplatekind(compl_list, "*")) { |
| 765 | testcase.stop("TITAN > 6.5.0 doesn't support this"); |
| 766 | //ies[lengthof(ies)] := ts_CbspNumComplList(valueof(compl_list)); |
| 767 | } else if (not istemplatekind(compl_list, "omit")) { |
| 768 | ies[lengthof(ies)] := tr_CbspNumComplList(compl_list); |
| 769 | } |
| 770 | return tr_CBSP(CBSP_MSGT_MSG_STATUS_QUERY_FAIL, ies); |
| 771 | } |
| 772 | |
Harald Welte | ea26034 | 2019-08-01 09:49:38 +0200 | [diff] [blame] | 773 | |
| 774 | /* 8.1.3.16 RESET */ |
| 775 | template (value) CBSP_PDU ts_CBSP_RESET(template (value) BSSMAP_FIELD_CellIdentificationList cell_list) := |
| 776 | ts_CBSP(CBSP_MSGT_RESET, { |
| 777 | ts_CbspCellList(cell_list) |
| 778 | }); |
| 779 | template CBSP_PDU tr_CBSP_RESET(template BSSMAP_FIELD_CellIdentificationList cell_list := ?) := |
| 780 | tr_CBSP(CBSP_MSGT_RESET, { |
| 781 | tr_CbspCellList(cell_list) |
| 782 | }); |
| 783 | |
| 784 | /* 8.1.3.17 RESET COMPLETE */ |
| 785 | template (value) CBSP_PDU ts_CBSP_RESET_COMPL(template (value) BSSMAP_FIELD_CellIdentificationList cell_list) := |
| 786 | ts_CBSP(CBSP_MSGT_RESET_COMPL, { |
| 787 | ts_CbspCellList(cell_list) |
| 788 | }); |
| 789 | template CBSP_PDU tr_CBSP_RESET_COMPL(template BSSMAP_FIELD_CellIdentificationList cell_list := ?) := |
| 790 | tr_CBSP(CBSP_MSGT_RESET_COMPL, { |
| 791 | tr_CbspCellList(cell_list) |
| 792 | }); |
| 793 | |
| 794 | /* 8.1.3.18 RESET FAILURE */ |
| 795 | template (value) CBSP_PDU ts_CBSP_RESET_FAIL(template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 796 | template (value) CBSP_FailureListItems fail_items) := |
| 797 | ts_CBSP(CBSP_MSGT_RESET_FAIL, { |
| 798 | ts_CbspFailList(fail_items), |
| 799 | ts_CbspCellList(cell_list) |
| 800 | }); |
| 801 | |
| 802 | template CBSP_PDU tr_CBSP_RESET_FAIL(template BSSMAP_FIELD_CellIdentificationList cell_list, |
| 803 | template CBSP_FailureListItems fail_items) := |
| 804 | tr_CBSP(CBSP_MSGT_RESET_FAIL, { |
| 805 | tr_CbspFailList(fail_items), |
| 806 | tr_CbspCellList(cell_list) |
| 807 | }); |
| 808 | |
| 809 | /* 8.1.3.18a KEEP-ALIVE */ |
| 810 | template (value) CBSP_PDU ts_CBSP_KEEP_ALIVE(uint8_t rep_period) := |
| 811 | ts_CBSP(CBSP_MSGT_KEEP_ALIVE, {ts_CbspKARepPeriod(rep_period)}); |
| 812 | template CBSP_PDU tr_CBSP_KEEP_ALIVE(template uint8_t rep_period := ?) := |
| 813 | tr_CBSP(CBSP_MSGT_KEEP_ALIVE, {tr_CbspKARepPeriod(rep_period)}); |
| 814 | |
| 815 | /* 8.1.3.18b KEEP-ALIVE COMPLETE */ |
| 816 | template (value) CBSP_PDU ts_CBSP_KEEP_ALIVE_COMPL := |
| 817 | ts_CBSP(CBSP_MSGT_KEEP_ALIVE_COMPL, {}); |
| 818 | template CBSP_PDU tr_CBSP_KEEP_ALIVE_COMPL := |
| 819 | tr_CBSP(CBSP_MSGT_KEEP_ALIVE_COMPL, {}); |
| 820 | |
| 821 | /* 8.1.3.19 RESTART */ |
| 822 | template (value) CBSP_PDU ts_CBSP_RESTART(template (value) BSSMAP_FIELD_CellIdentificationList cell_list, |
| 823 | template (value) CBSP_BcastMsgType msg_type, |
| 824 | template (value) CBSP_RecoveryInd rec_ind) := |
| 825 | ts_CBSP(CBSP_MSGT_RESTART, { |
| 826 | ts_CbspCellList(cell_list), |
| 827 | ts_CbspBcastMsgType(msg_type), |
| 828 | ts_CbspRecoveryInd(rec_ind) |
| 829 | }); |
| 830 | template CBSP_PDU tr_CBSP_RESTART(template BSSMAP_FIELD_CellIdentificationList cell_list := ?, |
| 831 | template CBSP_BcastMsgType msg_type := ?, |
| 832 | template CBSP_RecoveryInd rec_ind := ?) := |
| 833 | tr_CBSP(CBSP_MSGT_RESTART, { |
| 834 | tr_CbspCellList(cell_list), |
| 835 | tr_CbspBcastMsgType(msg_type), |
| 836 | tr_CbspRecoveryInd(rec_ind) |
| 837 | }); |
| 838 | |
| 839 | /* 8.1.3.20 FAILURE */ |
| 840 | template (value) CBSP_PDU ts_CBSP_FAILURE(template (value) CBSP_FailureListItems fail_list, |
| 841 | template (value) CBSP_BcastMsgType msg_type) := |
| 842 | ts_CBSP(CBSP_MSGT_FAILURE, { |
| 843 | ts_CbspFailList(fail_list), |
| 844 | ts_CbspBcastMsgType(msg_type) |
| 845 | }); |
| 846 | template CBSP_PDU tr_CBSP_FAILURE(template CBSP_FailureListItems fail_list := ?, |
| 847 | template CBSP_BcastMsgType msg_type := ?) := |
| 848 | tr_CBSP(CBSP_MSGT_FAILURE, { |
| 849 | tr_CbspFailList(fail_list), |
| 850 | tr_CbspBcastMsgType(msg_type) |
| 851 | }); |
| 852 | |
| 853 | /* 8.1.3.21 ERROR INDICATION */ |
| 854 | template (value) CBSP_PDU ts_CBSP_ERROR_IND(CBSP_Cause cause) := |
| 855 | ts_CBSP(CBSP_MSGT_ERROR_IND, {ts_CbspCause(cause)}); |
| 856 | template CBSP_PDU tr_CBSP_ERROR_IND(template CBSP_Cause cause) := |
| 857 | tr_CBSP(CBSP_MSGT_ERROR_IND, {tr_CbspCause(cause), *}); |
| 858 | |
| 859 | |
| 860 | function f_cbsp_find_ie(CBSP_PDU msg, CBSP_IEI iei, out CBSP_IE ret) return boolean { |
| 861 | for (var integer i := 0; i < sizeof(msg.ies); i := i+1) { |
| 862 | if (msg.ies[i].iei == iei) { |
| 863 | ret := msg.ies[i]; |
| 864 | return true; |
| 865 | } |
| 866 | } |
| 867 | return false; |
| 868 | } |
| 869 | |
| 870 | |
| 871 | } |