blob: 298ef1eed2fb369d291375b77319039ac9b1d7af [file] [log] [blame]
Alexander Couzensc3165722021-01-11 02:51:45 +01001module RAW_NS {
2
3/* Osmocom NS test suite for NS in TTCN-3
4 * (C) 2018-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
13import from Misc_Helpers all;
14import from General_Types all;
15import from Osmocom_Types all;
16import from Osmocom_Gb_Types all;
17import from NS_Emulation all;
18import from NS_Types all;
19import from BSSGP_Types all;
20import from NS_Emulation all;
21import from Native_Functions all;
22import from IPL4asp_Types all;
23import from NS_Provider_IPL4 all;
24#ifdef NS_EMULATION_FR
25import from NS_Provider_FR all;
26#endif
27
28public type component RAW_NS_CT {
29 /* UDP port towards the bottom (IUT) */
30 port NS_PROVIDER_PT NSCP[4];
31 var NS_Provider_IPL4_CT vc_NSP_IP[4];
32#ifdef NS_EMULATION_FR
33 var NS_Provider_FR_CT vc_NSP_FR[4];
34#endif
35 var NSConfiguration g_nsconfig;
36 timer g_T_guard;
37}
38
39public altstep as_Tguard() runs on RAW_NS_CT {
40 [] g_T_guard.timeout {
41 setverdict(fail, "Timeout of T_guard");
42 mtc.stop;
43 }
44}
45
46function f_init_ns_codec(NSConfiguration ns_config, integer idx := 0, float guard_secs := 60.0, charstring id := testcasename()) runs on RAW_NS_CT {
47 var Result res;
48
49 if (not g_T_guard.running) {
50 g_T_guard.start(guard_secs);
51 activate(as_Tguard());
52 }
53
54 if (not isbound(g_nsconfig)) {
55 g_nsconfig := ns_config;
56 }
57
58 if (ischosen(ns_config.nsvc[idx].provider.ip)) {
59 /* Connect the UDP socket */
60 vc_NSP_IP[idx] := NS_Provider_IPL4_CT.create(id & "-provIP");
61 connect(self:NSCP[idx], vc_NSP_IP[idx]:NSE);
62 vc_NSP_IP[idx].start(NS_Provider_IPL4.main(ns_config.nsvc[idx], ns_config, id));
63#ifdef NS_EMULATION_FR
64 } else if (ischosen(ns_config.nsvc[idx].provider.fr)) {
65 vc_NSP_FR[idx] := NS_Provider_FR_CT.create(id & "-provFR");
66 connect(self:NSCP[idx], vc_NSP_FR[idx]:NSE);
67 vc_NSP_FR[idx].start(NS_Provider_FR.main(ns_config.nsvc[idx], ns_config, id));
68#endif
69 } else {
70 Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unsupported NS provider");
71 }
72
73 NSCP[idx].receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP});
74}
75
76function f_clean_ns_codec() runs on RAW_NS_CT {
77 for (var integer i := 0; i < lengthof(vc_NSP_IP); i := i + 1) {
78 vc_NSP_IP[i].stop;
79 }
80#ifdef NS_EMULATION_FR
81 for (var integer i := 0; i < lengthof(vc_NSP_FR); i := i + 1) {
82 vc_NSP_FR[i].stop;
83 }
84#endif NS_EMULATION_FR
85}
86
87public altstep ax_rx_fail_on_any_ns(integer idx := 0) runs on RAW_NS_CT {
88 var PDU_NS nrf;
89 [] NSCP[idx].receive(PDU_NS: ?) -> value nrf {
90 setverdict(fail, "Received unexpected NS: ", nrf);
91 mtc.stop;
92 }
93}
94
95function f_ns_exp(template PDU_NS exp_rx, integer idx := 0) runs on RAW_NS_CT return PDU_NS {
96 var PDU_NS nrf;
97 log("f_ns_exp() expecting ", exp_rx);
98 /* last activated altstep has the lowest priority */
99 var default d := activate(ax_rx_fail_on_any_ns());
100 alt {
101 [] NSCP[idx].receive(PDU_NS: exp_rx) -> value nrf { }
102 }
103 deactivate(d);
104 return nrf;
105}
106
107/* perform outbound NS-ALIVE procedure */
108function f_outgoing_ns_alive(integer idx := 0) runs on RAW_NS_CT {
109 NSCP[idx].send(t_NS_ALIVE);
110 alt {
111 [] NSCP[idx].receive(t_NS_ALIVE_ACK);
112 [] NSCP[idx].receive { repeat; }
113 }
114}
115
116/* perform outbound NS-ALIVE procedure */
117function f_outgoing_ns_alive_no_ack(integer idx := 0, float tout := 10.0) runs on RAW_NS_CT {
118 timer T := tout;
119 NSCP[idx].send(t_NS_ALIVE);
120 T.start;
121 alt {
122 [] NSCP[idx].receive(t_NS_ALIVE_ACK) {
123 setverdict(fail, "Received unexpected NS-ALIVE ACK");
124 }
125 [] NSCP[idx].receive { repeat; }
126 [] T.timeout {
127 setverdict(pass);
128 }
129 }
130}
131
132function f_outgoing_ns_reset(integer idx := 0, float tout := 10.0) runs on RAW_NS_CT {
133 timer T := tout;
134 var template PDU_NS reset := ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig.nsvc[idx].nsvci, g_nsconfig.nsei)
135 NSCP[idx].send(reset);
136 T.start;
137 alt {
138 [] NSCP[idx].receive(ts_NS_RESET_ACK(g_nsconfig.nsvc[idx].nsvci, g_nsconfig.nsei)) {
139 setverdict(pass);
140 }
141 [] NSCP[idx].receive { repeat; }
142 [] T.timeout {
143 setverdict(fail, "Failed to receive a RESET ACK");
144 }
145 }
146}
147
148/* perform outbound NS-BLOCK procedure */
149function f_outgoing_ns_block(NsCause cause, integer idx := 0) runs on RAW_NS_CT {
150 NSCP[idx].send(ts_NS_BLOCK(cause, g_nsconfig.nsvc[idx].nsvci));
151 alt {
152 [] NSCP[idx].receive(tr_NS_BLOCK_ACK(g_nsconfig.nsvc[idx].nsvci));
153 [] NSCP[idx].receive { repeat; }
154 }
155}
156
157/* perform outbound NS-UNBLOCK procedure */
158function f_outgoing_ns_unblock(integer idx := 0) runs on RAW_NS_CT {
159 NSCP[idx].send(t_NS_UNBLOCK);
160 alt {
161 [] NSCP[idx].receive(t_NS_UNBLOCK_ACK);
162 [] NSCP[idx].receive { repeat; }
163 }
164}
165
166/* receive NS-ALIVE and ACK it */
167altstep as_rx_alive_tx_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
168 [] NSCP[idx].receive(t_NS_ALIVE) {
169 NSCP[idx].send(t_NS_ALIVE_ACK);
170 if (not oneshot) { repeat; }
171 }
172}
173
174/* Transmit BSSGP RESET for given BVCI and expect ACK */
175function f_tx_bvc_reset_rx_ack(BssgpBvci bvci, template (omit) BssgpCellId tx_cell_id, template BssgpCellId rx_cell_id,
176 integer idx := 0, boolean exp_ack := true)
177runs on RAW_NS_CT {
178 var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET(BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS, bvci,
179 tx_cell_id));
180 timer T := 5.0;
181 NSCP[idx].send(ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)));
182 T.start;
183 alt {
184 [exp_ack] NSCP[idx].receive(tr_NS_UNITDATA(t_SduCtrlB, 0,
185 decmatch tr_BVC_RESET_ACK(bvci, rx_cell_id))) {
186 setverdict(pass);
187 }
188 [exp_ack] T.timeout {
189 setverdict(fail, "No response to BVC-RESET");
190 }
191 [not exp_ack] T.timeout {
192 setverdict(pass);
193 }
194 [] NSCP[idx].receive { repeat; }
195 }
196}
197
198/* Receive a BSSGP RESET for given BVCI and ACK it */
199altstep as_rx_bvc_reset_tx_ack(BssgpBvci bvci, template BssgpCellId rx_cell_id, template (omit) BssgpCellId tx_cell_id,
200 boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
201 var PDU_NS ns_rf;
202 [] NSCP[idx].receive(tr_NS_UNITDATA(t_SduCtrlB, 0,
203 decmatch tr_BVC_RESET(?, bvci, rx_cell_id)))
204 -> value ns_rf {
205 var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.pDU_NS_Unitdata.nS_SDU);
206 var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET_ACK(bvci, tx_cell_id));
207 NSCP[idx].send(ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)));
208 if (not oneshot) { repeat; }
209 }
210}
211
212
213/* Receive a BSSGP UNBLOCK for given BVCI and ACK it */
214altstep as_rx_bvc_unblock_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
215 var PDU_NS ns_rf;
Pau Espin Pedrol6ee01262021-02-05 13:05:06 +0100216 [] NSCP[idx].receive(tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_UNBLOCK(bvci))) -> value ns_rf {
Alexander Couzensc3165722021-01-11 02:51:45 +0100217 var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.pDU_NS_Unitdata.nS_SDU);
Pau Espin Pedrol6ee01262021-02-05 13:05:06 +0100218 var PDU_BSSGP bssgp_tx := valueof(ts_BVC_UNBLOCK_ACK(bvci));
Alexander Couzensc3165722021-01-11 02:51:45 +0100219 NSCP[idx].send(ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)));
220 if (not oneshot) { repeat; }
221 }
222}
223
224/* Receive a BSSGP FLOW-CONTROL-BVC and ACK it */
225altstep as_rx_bvc_fc_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
226 var PDU_NS ns_rf;
227 [] NSCP[idx].receive(tr_NS_UNITDATA(t_SduCtrlB, bvci,
228 decmatch tr_BVC_FC_BVC))
229 -> value ns_rf {
230 var PDU_BSSGP bssgp_rx := dec_PDU_BSSGP(ns_rf.pDU_NS_Unitdata.nS_SDU);
231 var OCT1 tag := bssgp_rx.pDU_BSSGP_FLOW_CONTROL_BVC.tag.unstructured_Value;
Pau Espin Pedrol6ee01262021-02-05 13:05:06 +0100232 var PDU_BSSGP bssgp_tx := valueof(ts_BVC_FC_BVC_ACK(tag));
Alexander Couzensc3165722021-01-11 02:51:45 +0100233 NSCP[idx].send(ts_NS_UNITDATA(t_SduCtrlB, bvci, enc_PDU_BSSGP(bssgp_tx)));
234 if (not oneshot) { repeat; }
235 }
236}
237
238/**********************************************************************************
239 * Classic Gb/IP bring-up test cases using NS-{RESET,BLOCK,UNBLOCK} and no IP-SNS *
240 **********************************************************************************/
241
242/* Receive a NS-RESET and ACK it */
243public altstep as_rx_ns_reset_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
244 var PDU_NS ns_rf;
245 [] NSCP[idx].receive(tr_NS_RESET(NS_CAUSE_OM_INTERVENTION, g_nsconfig.nsvc[idx].nsvci,
246 g_nsconfig.nsei)) -> value ns_rf {
247 NSCP[idx].send(ts_NS_RESET_ACK(g_nsconfig.nsvc[idx].nsvci, g_nsconfig.nsei));
248 if (not oneshot) { repeat; }
249 }
250}
251/* Receive a NS-UNBLOCK and ACK it */
252public altstep as_rx_ns_unblock_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
253 var PDU_NS ns_rf;
254 [] NSCP[idx].receive(t_NS_UNBLOCK) -> value ns_rf {
255 NSCP[idx].send(t_NS_UNBLOCK_ACK);
256 if (not oneshot) { repeat; }
257 }
258}
259
Alexander Couzens20cd41e2021-01-11 02:56:03 +0100260/* Receive a NS-BLOCK and ACK it */
261public altstep as_rx_ns_block_ack(boolean oneshot := false, integer idx := 0, template NsCause cause := *, template Nsvci nsvci := *) runs on RAW_NS_CT {
262 var PDU_NS ns_rf;
263 [] NSCP[idx].receive(tr_NS_BLOCK(cause, nsvci)) -> value ns_rf {
264 NSCP[idx].send(ts_NS_BLOCK_ACK(oct2int(ns_rf.pDU_NS_Block.nS_VCI.nS_VCI)));
265 if (not oneshot) { repeat; }
266 }
267}
268
Alexander Couzens98ee6f62021-02-03 16:17:08 +0100269/**********************************************************************************
270 * IP Sub-Network Service (SNS)
271 **********************************************************************************/
272
273/* perform inbound SNS-SIZE procedure */
274function f_incoming_sns_size(template (omit) NsCause cause := omit, integer idx := 0)
275runs on RAW_NS_CT {
276 log("f_incoming_sns_size(idx=", idx, ")");
277 var PDU_NS rx;
278 var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx];
279
280 if (nsvc_cfg.provider.ip.address_family == AF_INET) {
281 /* expect one single SNS-SIZE with RESET flag; 4x v4 EP; no v6 EP */
282 rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 8,
283 num_v4 := 4, num_v6 := omit), idx);
284 } else {
285 /* expect one single SNS-SIZE with RESET flag; no v4 EP; 4x v6 EP */
286 rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 8,
287 num_v4 := omit, num_v6 := 4), idx);
288 }
289 NSCP[idx].send(ts_SNS_SIZE_ACK(g_nsconfig.nsei, cause));
290}
291
292/* perform outbound SNS-SIZE procedure */
293function f_outgoing_sns_size(template (omit) NsCause cause := omit, integer idx:= 0)
294runs on RAW_NS_CT {
295 log("f_outgoing_sns_size(idx=", idx, ")");
296 var PDU_NS rx;
297 var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx];
298
299 if (nsvc_cfg.provider.ip.address_family == AF_INET) {
300 NSCP[idx].send(ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 1,
301 num_v4 := 1, num_v6 := omit)
302 );
303 } else {
304 NSCP[idx].send(ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 1,
305 num_v4 := omit, num_v6 := 1)
306 );
307 }
308 /* expect one single SNS-SIZE with RESET flag; 4x v4 EP; no v6 EP */
309 rx := f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig.nsei, cause), idx);
310}
311
312/* perform inbound SNS-CONFIG procedure */
313function f_incoming_sns_config(template (omit) NsCause cause := omit, integer idx := 0)
314runs on RAW_NS_CT {
315 log("f_incoming_sns_config(idx=", idx, ")");
316 var PDU_NS rx;
317 var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx];
318
319 if (nsvc_cfg.provider.ip.address_family == AF_INET) {
320 var template IP4_Elements v4_elem := { tr_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip,
321 nsvc_cfg.provider.ip.remote_udp_port) };
322 rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig.nsei, end_flag := true, v4 := v4_elem), idx);
323 } else {
324 var template IP6_Elements v6_elem := { tr_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip,
325 nsvc_cfg.provider.ip.remote_udp_port) };
326 rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig.nsei, end_flag := true, v6 := v6_elem), idx);
327 }
328 NSCP[idx].send(ts_SNS_CONFIG_ACK(g_nsconfig.nsei, cause));
329}
330
331/* perform outbound SNS-CONFIG procedure */
332function f_outgoing_sns_config(template (omit) NsCause cause := omit, integer idx := 0)
333runs on RAW_NS_CT {
334 log("f_outgoing_sns_config(idx=", idx, ")");
335 var PDU_NS rx;
336 var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx];
337
338 if (nsvc_cfg.provider.ip.address_family == AF_INET) {
339 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
340 nsvc_cfg.provider.ip.local_udp_port) }
341 NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, v4));
342 } else {
343 var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
344 nsvc_cfg.provider.ip.local_udp_port) }
345 NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, omit, v6));
346 }
347 rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig.nsei, cause), idx);
348}
349
350/* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */
351function f_outgoing_sns_config_1c1u(template (omit) NsCause cause := omit, integer idx := 0)
352runs on RAW_NS_CT {
353 log("f_outgoing_sns_config_1c1u(idx=", idx, ")");
354 var PDU_NS rx;
355
356 if (g_nsconfig.nsvc[0].provider.ip.address_family == AF_INET) {
357 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig.nsvc[0].provider.ip.local_ip,
358 g_nsconfig.nsvc[0].provider.ip.local_udp_port, 1, 0),
359 ts_SNS_IPv4(g_nsconfig.nsvc[1].provider.ip.local_ip,
360 g_nsconfig.nsvc[1].provider.ip.local_udp_port, 0, 1) };
361 NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, v4));
362 } else {
363 var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig.nsvc[0].provider.ip.local_ip,
364 g_nsconfig.nsvc[0].provider.ip.local_udp_port, 1, 0),
365 ts_SNS_IPv6(g_nsconfig.nsvc[1].provider.ip.local_ip,
366 g_nsconfig.nsvc[1].provider.ip.local_udp_port, 0, 1) };
367 NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, omit, v6));
368 }
369 rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig.nsei, cause), idx);
370}
371
372/* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */
373function f_outgoing_sns_config_1c1u_separate(template (omit) NsCause cause := omit, integer idx := 0)
374runs on RAW_NS_CT {
375 log("f_outgoing_sns_config_1c1u_separate(idx=", idx, ")");
376 var PDU_NS rx;
377 if (g_nsconfig.nsvc[0].provider.ip.address_family == AF_INET) {
378 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig.nsvc[1].provider.ip.local_ip,
379 g_nsconfig.nsvc[1].provider.ip.local_udp_port, 1, 0),
380 ts_SNS_IPv4(g_nsconfig.nsvc[2].provider.ip.local_ip,
381 g_nsconfig.nsvc[2].provider.ip.local_udp_port, 0, 1) };
382 NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, v4));
383 } else {
384 var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig.nsvc[1].provider.ip.local_ip,
385 g_nsconfig.nsvc[1].provider.ip.local_udp_port, 1, 0),
386 ts_SNS_IPv6(g_nsconfig.nsvc[2].provider.ip.local_ip,
387 g_nsconfig.nsvc[2].provider.ip.local_udp_port, 0, 1) };
388 NSCP[idx].send(ts_SNS_CONFIG(g_nsconfig.nsei, true, omit, v6));
389 }
390 rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig.nsei, cause), idx);
391}
392
393function f_outgoing_sns_add(integer idx_add, uint8_t w_sig := 1, uint8_t w_user := 1, integer idx := 0, template (omit) NsCause cause := omit)
394runs on RAW_NS_CT {
395 log("f_outgoing_sns_add(idx_add=", idx_add, ")");
396 var PDU_NS rx;
397 var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx_add];
398 if (nsvc_cfg.provider.ip.address_family == AF_INET) {
399 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
400 nsvc_cfg.provider.ip.local_udp_port,
401 w_sig, w_user) };
402 NSCP[idx].send(ts_SNS_ADD(g_nsconfig.nsei, 23, v4));
403 rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 23, cause, v4));
404 } else {
405 var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
406 nsvc_cfg.provider.ip.local_udp_port,
407 w_sig, w_user) };
408 NSCP[idx].send(ts_SNS_ADD(g_nsconfig.nsei, 23, omit, v6));
409 rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 23, cause, omit, v6));
410 }
411}
412
413function f_outgoing_sns_del(integer idx_del, uint8_t w_sig := 1, uint8_t w_user := 1, integer idx := 0)
414runs on RAW_NS_CT {
415 log("f_outgoing_sns_del(idx_del=", idx_del, ")");
416 var PDU_NS rx;
417 var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx_del];
418 if (nsvc_cfg.provider.ip.address_family == AF_INET) {
419 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
420 nsvc_cfg.provider.ip.local_udp_port,
421 w_sig, w_user) };
422 NSCP[idx].send(ts_SNS_DEL(g_nsconfig.nsei, 24, omit, v4));
423 rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 24, omit, v4));
424 } else {
425 var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
426 nsvc_cfg.provider.ip.local_udp_port,
427 w_sig, w_user) };
428 NSCP[idx].send(ts_SNS_DEL(g_nsconfig.nsei, 24, omit, omit, v6));
429 rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 24, omit, omit, v6));
430 }
431}
432
433function f_outgoing_sns_chg_weight(integer idx_chg, uint8_t w_sig, uint8_t w_user, integer idx := 0)
434runs on RAW_NS_CT {
435 log("f_outgoing_sns_chg_weight(idx_chg=", idx_chg, ")");
436 var PDU_NS rx;
437 var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx_chg];
438 if (nsvc_cfg.provider.ip.address_family == AF_INET) {
439 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
440 nsvc_cfg.provider.ip.local_udp_port,
441 w_sig, w_user) };
442 NSCP[idx].send(ts_SNS_CHG_WEIGHT(g_nsconfig.nsei, 25, v4));
443 rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 25, omit, v4));
444 } else {
445 var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
446 nsvc_cfg.provider.ip.local_udp_port,
447 w_sig, w_user) };
448 NSCP[idx].send(ts_SNS_CHG_WEIGHT(g_nsconfig.nsei, 25, omit, v6));
449 rx := f_ns_exp(tr_SNS_ACK(g_nsconfig.nsei, 25, omit, omit, v6));
450 }
451}
452
Alexander Couzensc3165722021-01-11 02:51:45 +0100453}