Harald Welte | 0db4413 | 2019-10-17 11:09:05 +0200 | [diff] [blame] | 1 | module STP_Tests_M3UA { |
| 2 | |
| 3 | /* Osmocom STP test suite in in TTCN-3 |
| 4 | * (C) 2019 Harald Welte <laforge@gnumonks.org> |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | */ |
| 12 | |
| 13 | friend module STP_Tests; |
| 14 | |
| 15 | import from General_Types all; |
| 16 | import from Osmocom_Types all; |
| 17 | import from IPL4asp_Types all; |
| 18 | |
| 19 | import from Osmocom_VTY_Functions all; |
| 20 | |
| 21 | import from M3UA_Types all; |
| 22 | import from M3UA_Templates all; |
| 23 | import from M3UA_CodecPort all; |
| 24 | import from M3UA_CodecPort_CtrlFunct all; |
| 25 | |
| 26 | import from M3UA_Emulation all; |
| 27 | import from MTP3asp_Types all; |
| 28 | import from MTP3asp_PortType all; |
| 29 | |
| 30 | import from SCCP_Types all; |
| 31 | import from SCCP_Templates all; |
| 32 | import from SCCPasp_Types all; |
| 33 | import from SCCP_Emulation all; |
| 34 | |
| 35 | import from STP_Tests_Common all; |
| 36 | |
| 37 | modulepar { |
| 38 | integer mp_stp_m3ua_port := 2905; |
| 39 | integer mp_local_m3ua_port := 9999; |
| 40 | } |
| 41 | |
| 42 | private const integer NR_M3UA := 3; |
| 43 | |
| 44 | type component RAW_M3UA_CT extends Test_CT { |
| 45 | port M3UA_CODEC_PT M3UA[NR_M3UA]; |
| 46 | var integer g_m3ua_conn_id[NR_M3UA]; |
| 47 | } |
| 48 | |
| 49 | private template PortEvent tr_SctpAssocChange := { |
| 50 | sctpEvent := { |
| 51 | sctpAssocChange := ? |
| 52 | } |
| 53 | } |
| 54 | private template PortEvent tr_SctpPeerAddrChange := { |
| 55 | sctpEvent := { |
| 56 | sctpPeerAddrChange := ? |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | private altstep as_m3ua_sctp() runs on RAW_M3UA_CT { |
| 61 | [] any from M3UA.receive(tr_SctpAssocChange) { repeat; } |
| 62 | [] any from M3UA.receive(tr_SctpPeerAddrChange) { repeat; } |
| 63 | } |
| 64 | |
| 65 | friend function f_M3UA_send(integer idx, template (present) PDU_M3UA msg, template integer stream := 0) |
| 66 | runs on RAW_M3UA_CT { |
| 67 | M3UA[idx].send(t_M3UA_Send(g_m3ua_conn_id[idx], msg, stream)); |
| 68 | } |
| 69 | |
| 70 | friend function f_M3UA_exp(integer idx, template (present) PDU_M3UA msg) runs on RAW_M3UA_CT { |
| 71 | var M3UA_RecvFrom rx; |
| 72 | alt { |
| 73 | [] M3UA[idx].receive(t_M3UA_RecvFrom(msg)) { |
| 74 | setverdict(pass); |
| 75 | } |
| 76 | [] M3UA[idx].receive(t_M3UA_RecvFrom(?)) -> value rx { |
| 77 | setverdict(fail, "Received unexpected M3UA[", idx, "] ", rx, |
| 78 | "while waiting for ", msg); |
| 79 | mtc.stop; |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | friend function f_M3UA_connect(integer i) runs on RAW_M3UA_CT { |
| 85 | var Result res; |
| 86 | res := M3UA_CodecPort_CtrlFunct.f_IPL4_connect(M3UA[i], mp_stp_ip, mp_stp_m3ua_port, |
| 87 | mp_local_ip, mp_local_m3ua_port+i, -1, |
| 88 | {sctp:=valueof(ts_SCTP)}); |
| 89 | if (not ispresent(res.connId)) { |
| 90 | setverdict(fail, "Could not connect M3UA socket, check your configuration"); |
| 91 | mtc.stop; |
| 92 | } |
| 93 | g_m3ua_conn_id[i] := res.connId; |
| 94 | } |
| 95 | |
| 96 | friend function f_init_m3ua() runs on RAW_M3UA_CT { |
| 97 | var integer i; |
| 98 | |
| 99 | f_init_common(); |
| 100 | |
| 101 | activate(as_m3ua_sctp()); |
| 102 | |
| 103 | for (i := 0; i < NR_M3UA; i:=i+1) { |
| 104 | map(self:M3UA[i], system:M3UA_CODEC_PT); |
| 105 | f_M3UA_connect(i); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | /* perform an outbound ASP-UP procedure */ |
| 110 | friend function f_M3UA_asp_up(integer idx, template (omit) OCT4 aspid := omit) runs on RAW_M3UA_CT { |
| 111 | f_M3UA_send(idx, ts_M3UA_ASPUP(aspid)); |
| 112 | f_M3UA_exp(idx, tr_M3UA_ASPUP_ACK); |
| 113 | } |
| 114 | |
| 115 | /* perform an outbound BEAT procedure */ |
| 116 | friend function f_M3UA_beat(integer idx, template (omit) octetstring hbd) runs on RAW_M3UA_CT { |
| 117 | if (istemplatekind(hbd, "omit")) { |
| 118 | f_M3UA_send(idx, ts_M3UA_BEAT(omit)); |
| 119 | f_M3UA_exp(idx, tr_M3UA_BEAT_ACK(omit)); |
| 120 | } else { |
| 121 | f_M3UA_send(idx, ts_M3UA_BEAT(ts_M3UA_hb_data(hbd))); |
| 122 | f_M3UA_exp(idx, tr_M3UA_BEAT_ACK(tr_M3UA_hb_data(hbd))); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | /* perform an outbound ASP-ACTIVATE procedure */ |
| 127 | friend function f_M3UA_asp_act(integer idx, template (omit) M3UA_Traffic_Mode_Type tmt := omit, |
| 128 | template (omit) OCT4 rctx := omit) runs on RAW_M3UA_CT { |
| 129 | f_M3UA_send(idx, ts_M3UA_ASPAC(tmt, rctx)); |
| 130 | f_M3UA_exp(idx, tr_M3UA_ASPAC_ACK(tmt, rctx)); |
| 131 | } |
| 132 | |
| 133 | /* perform outbound ASP-UP and ASP-ACT, optionally expect interemittent NOTIFY */ |
| 134 | friend function f_M3UA_asp_up_act(integer idx, template (omit) M3UA_Traffic_Mode_Type tmt := omit, |
| 135 | template (omit) OCT4 rctx := omit, |
| 136 | template (omit) OCT2 ntfy_after_up := c_M3UA_ST_I_AS_INACTIVE, |
| 137 | template (omit) OCT2 ntfy_after_act := c_M3UA_ST_I_AS_ACTIVE) |
| 138 | runs on RAW_M3UA_CT { |
| 139 | f_M3UA_asp_up(idx, omit); |
| 140 | if (not istemplatekind(ntfy_after_up, "omit")) { |
| 141 | f_M3UA_exp(idx, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, ntfy_after_up, *)); |
| 142 | } |
| 143 | f_M3UA_asp_act(idx, tmt, rctx); |
| 144 | if (not istemplatekind(ntfy_after_act, "omit")) { |
| 145 | f_M3UA_exp(idx, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, ntfy_after_act, *)); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | |
| 150 | /* Test the ASP-UP procedure */ |
| 151 | testcase TC_connect_asp_up() runs on RAW_M3UA_CT { |
| 152 | f_init_m3ua(); |
| 153 | f_M3UA_asp_up(0); |
| 154 | f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_INACTIVE, *)); |
| 155 | } |
| 156 | |
| 157 | /* Test the heartbeat procedure without optional heartbeat data payload */ |
| 158 | testcase TC_beat() runs on RAW_M3UA_CT { |
| 159 | f_init_m3ua(); |
| 160 | f_M3UA_asp_up(0); |
| 161 | f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_INACTIVE, *)); |
| 162 | f_M3UA_beat(0, omit); |
| 163 | } |
| 164 | |
| 165 | /* Test the heartbeat procedure with optional heartbeat data payload */ |
| 166 | testcase TC_beat_payload() runs on RAW_M3UA_CT { |
| 167 | f_init_m3ua(); |
| 168 | f_M3UA_asp_up(0); |
| 169 | f_M3UA_exp(0, tr_M3UA_NOTIFY(c_M3UA_ST_T_STATE_CHG, c_M3UA_ST_I_AS_INACTIVE, *)); |
| 170 | f_M3UA_beat(0, 'a1a2a3a4a5'O); |
| 171 | } |
| 172 | |
| 173 | /* Test the ASP-ACTIVATE procedure (without traffic-mode or routing ctx) */ |
| 174 | testcase TC_asp_act() runs on RAW_M3UA_CT { |
| 175 | f_init_m3ua(); |
| 176 | f_M3UA_asp_up_act(0); |
| 177 | } |
| 178 | |
| 179 | /* Test the ASP-ACTIVATE procedure with traffic-mode override */ |
| 180 | testcase TC_asp_act_override() runs on RAW_M3UA_CT { |
| 181 | f_init_m3ua(); |
| 182 | f_M3UA_asp_up_act(0, c_M3UA_TMT_override, omit); |
| 183 | } |
| 184 | |
| 185 | /* Test the ASP-ACTIVATE procedure with traffic-mode override */ |
| 186 | testcase TC_asp_act_loadshare() runs on RAW_M3UA_CT { |
| 187 | f_init_m3ua(); |
| 188 | f_M3UA_asp_up_act(0, c_M3UA_TMT_loadshare, omit); |
| 189 | } |
| 190 | |
| 191 | /* Test the ASP-ACTIVATE procedure with traffic-mode broadcast */ |
| 192 | testcase TC_asp_act_broadcast() runs on RAW_M3UA_CT { |
| 193 | f_init_m3ua(); |
| 194 | f_M3UA_asp_up_act(0, c_M3UA_TMT_broadcast, omit); |
| 195 | } |
| 196 | |
| 197 | /* Test if traffic is routed from idx_tx/pc_tx to idx_rx/pc_rx */ |
| 198 | private function f_test_traffic(integer idx_tx, template (omit) OCT4 rctx_sender, OCT4 pc_tx, |
| 199 | integer idx_rx, template (omit) OCT4 rctx_receiver, OCT4 pc_rx, |
| 200 | OCT1 si := '23'O, OCT1 ni := '00'O, OCT1 mp := '00'O, OCT1 sls := '00'O) |
| 201 | runs on RAW_M3UA_CT { |
| 202 | var octetstring data := f_rnd_octstring(f_rnd_int(100)); |
| 203 | f_M3UA_send(idx_tx, ts_M3UA_DATA(rctx_sender, |
| 204 | ts_M3UA_protocol_data(pc_tx, pc_rx, si, ni, mp, sls, data)), 1); |
| 205 | f_M3UA_exp(idx_rx, tr_M3UA_DATA(rctx_receiver, |
| 206 | tr_M3UA_protocol_data(pc_tx, pc_rx, si, ni, mp, sls, data))); |
| 207 | } |
| 208 | |
| 209 | |
| 210 | /* test "traffic-mode override" behavior */ |
| 211 | testcase TC_tmt_override() runs on RAW_M3UA_CT { |
| 212 | var OCT4 rctx_sender := int2oct(1023, 4); |
| 213 | var OCT4 pc_sender := int2oct(23, 4); |
| 214 | var OCT4 rctx_receiver := int2oct(1042, 4); |
| 215 | var OCT4 pc_receiver := int2oct(42, 4); |
| 216 | |
| 217 | f_init_m3ua(); |
| 218 | |
| 219 | /* bring up the 'sender' side (single ASP in AS) */ |
| 220 | f_M3UA_asp_up_act(0, omit, omit); |
| 221 | |
| 222 | /* activate the first 'receiver' side ASP */ |
| 223 | f_M3UA_asp_up_act(1, c_M3UA_TMT_override, rctx_receiver); |
| 224 | |
| 225 | /* verify traffic is routed from sender to [sole] receiver */ |
| 226 | f_test_traffic(0, rctx_sender, pc_sender, 1, rctx_receiver, pc_receiver); |
| 227 | |
| 228 | /* activate the second 'receiver' side ASP (no NOTIFY as AS state doesn't change) */ |
| 229 | f_M3UA_asp_up_act(2, c_M3UA_TMT_override, rctx_receiver, omit, omit); |
| 230 | |
| 231 | /* we expect a NOTIFY to the *other* ASP Other/Alternat-ASP-Active */ |
| 232 | f_M3UA_exp(1, tr_M3UA_NOTIFY(c_M3UA_ST_T_OTHER, c_M3UA_ST_I_ALTERNATE_ASP, *)); |
| 233 | |
| 234 | /* verify traffic is routed from sender to new receiver */ |
| 235 | f_test_traffic(0, rctx_sender, pc_sender, 2, rctx_receiver, pc_receiver); |
| 236 | |
| 237 | } |
| 238 | |
| 239 | private altstep as_count_rx(integer idx, template (present) PDU_M3UA exp, inout integer counter) |
| 240 | runs on RAW_M3UA_CT { |
| 241 | [] M3UA[idx].receive(t_M3UA_RecvFrom(exp)) { |
| 242 | counter := counter + 1; |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | /* test "traffic-mode load-share" behavior */ |
| 247 | testcase TC_tmt_loadshare() runs on RAW_M3UA_CT { |
| 248 | var OCT4 rctx_sender := int2oct(1023, 4); |
| 249 | var OCT4 pc_sender := int2oct(23, 4); |
| 250 | var OCT4 rctx_receiver := int2oct(1042, 4); |
| 251 | var OCT4 pc_receiver := int2oct(42, 4); |
| 252 | var integer i; |
| 253 | |
| 254 | f_init_m3ua(); |
| 255 | |
| 256 | /* FIXME: configure the STP via VTY to set traffic-mode */ |
| 257 | |
| 258 | /* bring up the 'sender' side (single ASP in AS) */ |
| 259 | f_M3UA_asp_up_act(0, omit, rctx_sender); |
| 260 | |
| 261 | /* activate the first 'receiver' side ASP */ |
Harald Welte | 0db4413 | 2019-10-17 11:09:05 +0200 | [diff] [blame] | 262 | f_M3UA_asp_up_act(1, c_M3UA_TMT_loadshare, omit); // TODO: rctx |
| 263 | |
| 264 | /* verify traffic is routed from sender to [sole] receiver */ |
| 265 | for (i := 0; i < 10; i := i+1) { |
| 266 | f_test_traffic(0, rctx_sender, pc_sender, 1, rctx_receiver, pc_receiver); |
| 267 | } |
| 268 | |
| 269 | /* activate the second 'receiver' side ASP (no NOTIFY) */ |
| 270 | f_M3UA_asp_up_act(2, c_M3UA_TMT_loadshare, omit, omit, omit); // TODO: rctx |
| 271 | |
| 272 | /* verify traffic is routed from sender to new receiver */ |
| 273 | const integer iter_per_asp := 5; |
| 274 | var integer num_rx[NR_M3UA] := { 0, 0, 0 }; |
| 275 | for (i := 0; i < 2*iter_per_asp; i := i+1) { |
| 276 | var octetstring data := f_rnd_octstring(f_rnd_int(100)); |
| 277 | var template (value) M3UA_Protocol_Data tx_pd; |
| 278 | var template (present) M3UA_Protocol_Data rx_pd; |
| 279 | tx_pd := ts_M3UA_protocol_data(pc_sender, pc_receiver, '23'O, '00'O, '00'O, '00'O, data); |
| 280 | rx_pd := tr_M3UA_protocol_data(pc_sender, pc_receiver, '23'O, '00'O, '00'O, '00'O, data); |
| 281 | f_M3UA_send(0, ts_M3UA_DATA(rctx_sender, tx_pd), 1); |
| 282 | alt { |
| 283 | [] as_count_rx(1, tr_M3UA_DATA(rctx_receiver, rx_pd), num_rx[1]) |
| 284 | [] as_count_rx(2, tr_M3UA_DATA(rctx_receiver, rx_pd), num_rx[2]) |
| 285 | } |
| 286 | } |
| 287 | /* FIXME: check for extraneous messages? */ |
| 288 | for (i := 1; i <= 2; i := i+1) { |
| 289 | if (num_rx[i] != iter_per_asp) { |
| 290 | setverdict(fail, "Received only ", num_rx[i], " out of expected ", iter_per_asp, |
| 291 | "M3UA DATA messages"); |
| 292 | } |
| 293 | } |
| 294 | setverdict(pass); |
| 295 | } |
| 296 | |
| 297 | /* test "traffic-mode broadcast" behavior */ |
| 298 | testcase TC_tmt_broadcast() runs on RAW_M3UA_CT { |
| 299 | var OCT4 rctx_sender := int2oct(1023, 4); |
| 300 | var OCT4 pc_sender := int2oct(23, 4); |
| 301 | var OCT4 rctx_receiver := int2oct(1042, 4); |
| 302 | var OCT4 pc_receiver := int2oct(42, 4); |
| 303 | var integer i; |
| 304 | |
| 305 | f_init_m3ua(); |
| 306 | |
| 307 | /* FIXME: configure the STP via VTY to set traffic-mode */ |
| 308 | |
| 309 | /* bring up the 'sender' side (single ASP in AS) */ |
| 310 | f_M3UA_asp_up_act(0, omit, omit); // TODO: rctx |
| 311 | |
| 312 | /* activate the first 'receiver' side ASP */ |
Harald Welte | 0db4413 | 2019-10-17 11:09:05 +0200 | [diff] [blame] | 313 | f_M3UA_asp_up_act(1, c_M3UA_TMT_broadcast, omit); // TODO: rctx |
| 314 | |
| 315 | /* verify traffic is routed from sender to [sole] receiver */ |
| 316 | for (i := 0; i < 10; i := i+1) { |
| 317 | f_test_traffic(0, rctx_sender, pc_sender, 1, rctx_receiver, pc_receiver); |
| 318 | } |
| 319 | |
| 320 | /* activate the second 'receiver' side ASP */ |
| 321 | f_M3UA_asp_up_act(2, c_M3UA_TMT_broadcast, omit, omit, omit); // TODO: rctx |
| 322 | |
| 323 | /* verify traffic is routed from sender to new receiver */ |
| 324 | for (i := 0; i < 10; i := i+1) { |
| 325 | var octetstring data := f_rnd_octstring(f_rnd_int(100)); |
| 326 | var template (value) M3UA_Protocol_Data tx_pd; |
| 327 | var template (present) M3UA_Protocol_Data rx_pd; |
| 328 | tx_pd := ts_M3UA_protocol_data(pc_sender, pc_receiver, '23'O, '00'O, '00'O, '00'O, data); |
| 329 | rx_pd := tr_M3UA_protocol_data(pc_sender, pc_receiver, '23'O, '00'O, '00'O, '00'O, data); |
| 330 | f_M3UA_send(0, ts_M3UA_DATA(rctx_sender, tx_pd), 1); |
| 331 | /* each message must be received both on 1 and 2 */ |
| 332 | f_M3UA_exp(1, tr_M3UA_DATA(rctx_receiver, rx_pd)); |
| 333 | f_M3UA_exp(2, tr_M3UA_DATA(rctx_receiver, rx_pd)); |
| 334 | } |
| 335 | setverdict(pass); |
| 336 | } |
| 337 | |
| 338 | private function f_M3UA_rkm_register(OCT4 id, OCT3 dpc, OCT4 rctx, |
| 339 | template (present) OCT4 exp_status := c_M3UA_REGSTS_SUCCESS) |
| 340 | runs on RAW_M3UA_CT |
| 341 | { |
| 342 | f_M3UA_send(0, ts_M3UA_REG_REQ({ts_M3UA_rkey(id:=id, dpc:=dpc, rctx:=rctx)})); |
| 343 | f_M3UA_exp(0, tr_M3UA_REG_RSP({tr_M3UA_reg_res(id:=id, status:=exp_status, rctx:=rctx)})); |
| 344 | } |
| 345 | |
| 346 | /* Send RKM registration; expect -EPERM as RCTX doesn't match config and dynamic not permitted */ |
| 347 | testcase TC_rkm_reg_static_notpermitted() runs on RAW_M3UA_CT { |
| 348 | f_init_m3ua(); |
| 349 | |
| 350 | f_M3UA_send(0, ts_M3UA_REG_REQ({ts_M3UA_rkey(id:='00000099'O, dpc:='aabbcc'O)})); |
| 351 | f_M3UA_exp(0, tr_M3UA_REG_RSP({tr_M3UA_reg_res(id:='00000099'O, status:=c_M3UA_REGSTS_ERR_EPERM, |
| 352 | rctx:=?)})); |
| 353 | } |
| 354 | |
| 355 | /* Send RKM registration; expect OK as RCTX does match config */ |
| 356 | testcase TC_rkm_reg_static_permitted() runs on RAW_M3UA_CT { |
| 357 | var OCT3 dpc := int2oct(23, 3); // must match config |
| 358 | var OCT4 rctx := int2oct(1023, 4); // must match config |
| 359 | |
| 360 | f_init_m3ua(); |
| 361 | |
| 362 | f_M3UA_send(0, ts_M3UA_REG_REQ({ts_M3UA_rkey(id:='10000099'O, dpc:=dpc, rctx:=rctx)})); |
| 363 | f_M3UA_exp(0, tr_M3UA_REG_RSP({tr_M3UA_reg_res(id:='10000099'O, status:=c_M3UA_REGSTS_SUCCESS, |
| 364 | rctx:=rctx)})); |
| 365 | } |
| 366 | |
| 367 | /* Send RKM registration; expect OK as dynamic not permitted */ |
| 368 | testcase TC_rkm_reg_dynamic_permitted() runs on RAW_M3UA_CT { |
| 369 | f_init_common(); |
| 370 | f_vty_config2(VTY, {"cs7 instance 0"}, "xua rkm routing-key-allocation dynamic-permitted"); |
| 371 | f_init_m3ua(); |
| 372 | |
| 373 | f_M3UA_send(0, ts_M3UA_REG_REQ({ts_M3UA_rkey(id:='20000099'O, dpc:='aabbcc'O)})); |
| 374 | f_M3UA_exp(0, tr_M3UA_REG_RSP({tr_M3UA_reg_res(id:='20000099'O, status:=c_M3UA_REGSTS_SUCCESS, |
| 375 | rctx:=?)})); |
| 376 | |
| 377 | f_vty_config2(VTY, {"cs7 instance 0"}, "xua rkm routing-key-allocation static-only"); |
| 378 | } |
| 379 | |
| 380 | /* try to de-register a routing key that was never registered -> error */ |
| 381 | testcase TC_rkm_unreg_never_registered() runs on RAW_M3UA_CT { |
| 382 | f_init_m3ua(); |
| 383 | f_M3UA_send(0, ts_M3UA_DEREG_REQ(ts_M3UA_routing_ctx(int2oct(1023,4)))); |
| 384 | f_M3UA_exp(0, tr_M3UA_DEREG_RSP({tr_M3UA_dereg_res(?,c_m3UA_DEREGSTS_ERR_NOT_REG)})); |
| 385 | } |
| 386 | |
| 387 | /* try to de-register a routing key that is invalid (non-existant) -> error */ |
| 388 | testcase TC_rkm_unreg_invalid() runs on RAW_M3UA_CT { |
| 389 | f_init_m3ua(); |
| 390 | f_M3UA_send(0, ts_M3UA_DEREG_REQ(ts_M3UA_routing_ctx(int2oct(1234,4)))); |
| 391 | f_M3UA_exp(0, tr_M3UA_DEREG_RSP({tr_M3UA_dereg_res(?,c_m3UA_DEREGSTS_ERR_INVAL_RCTX)})); |
| 392 | } |
| 393 | |
| 394 | /* try to de-register a routing key that was registered -> OK*/ |
| 395 | testcase TC_rkm_unreg_registered() runs on RAW_M3UA_CT { |
| 396 | f_init_m3ua(); |
| 397 | f_M3UA_send(0, ts_M3UA_DEREG_REQ(ts_M3UA_routing_ctx(int2oct(1023,4)))); |
| 398 | f_M3UA_exp(0, tr_M3UA_DEREG_RSP({tr_M3UA_dereg_res(?,c_m3UA_DEREGSTS_SUCCESS)})); |
| 399 | } |
| 400 | |
| 401 | /* try to de-register a routing key for an active ASP -> ERROR */ |
| 402 | testcase TC_rkm_unreg_active() runs on RAW_M3UA_CT { |
| 403 | var OCT3 dpc := int2oct(23, 3); // must match config |
| 404 | var OCT4 rctx := int2oct(1023, 4); // must match config |
| 405 | |
| 406 | f_init_m3ua(); |
| 407 | |
| 408 | /* first register the routing key */ |
| 409 | f_M3UA_rkm_register(id:='30000099'O, dpc:=dpc, rctx:=rctx); |
| 410 | |
| 411 | /* then activate the ASP */ |
| 412 | f_M3UA_asp_up_act(0); |
| 413 | |
| 414 | /* then try to de-regsiter */ |
| 415 | f_M3UA_send(0, ts_M3UA_DEREG_REQ(ts_M3UA_routing_ctx(rctx))); |
| 416 | f_M3UA_exp(0, tr_M3UA_DEREG_RSP({tr_M3UA_dereg_res(?,c_m3UA_DEREGSTS_ERR_ASP_ACTIVE)})); |
| 417 | /* FIXME: we now may have changed the state on the STP side! */ |
| 418 | } |
| 419 | |
| 420 | |
| 421 | control { |
| 422 | /* M3UA Tests */ |
| 423 | execute( TC_connect_asp_up() ); |
| 424 | execute( TC_beat() ); |
| 425 | execute( TC_beat_payload() ); |
| 426 | execute( TC_asp_act() ); |
| 427 | execute( TC_asp_act_override() ); |
| 428 | execute( TC_asp_act_loadshare() ); |
| 429 | execute( TC_asp_act_broadcast() ); |
| 430 | execute( TC_tmt_override() ); |
| 431 | execute( TC_tmt_loadshare() ); |
| 432 | execute( TC_tmt_broadcast() ); |
| 433 | |
| 434 | /* M3UA RKM tests */ |
| 435 | execute( TC_rkm_reg_static_notpermitted() ); |
| 436 | execute( TC_rkm_reg_static_permitted() ); |
| 437 | execute( TC_rkm_reg_dynamic_permitted() ); |
| 438 | execute( TC_rkm_unreg_never_registered() ); |
| 439 | execute( TC_rkm_unreg_invalid() ); |
| 440 | execute( TC_rkm_unreg_registered() ); |
| 441 | execute( TC_rkm_unreg_active() ); |
| 442 | /* TODO: test RKM with unsupported routing keys: NA, SI, OPC */ |
| 443 | /* TODO: register/unregister multiple routing contexts in one message; including mixed |
| 444 | success/failure situations */ |
| 445 | } |
| 446 | |
| 447 | |
| 448 | |
| 449 | } |