blob: 3e4ef2cd4724b2c4d0bc5a58ee11d3f6e1d5a64c [file] [log] [blame]
Harald Weltef7b74072019-02-20 20:48:50 +01001module PCU_Tests_RAW_SNS {
2
3import from Osmocom_Types all;
4import from PCU_Tests all;
5import from PCU_Tests_RAW all;
Harald Weltec4d7beb2019-02-21 18:21:01 +01006import from Osmocom_Gb_Types all;
7import from NS_CodecPort all;
8import from NS_Types all;
Harald Weltef7b74072019-02-20 20:48:50 +01009
10/**********************************************************************************
11 * Modern Gb/IP bring-up test cases using IP Sub-Network Service (SNS)
12 **********************************************************************************/
13
Harald Weltec4d7beb2019-02-21 18:21:01 +010014/* perform inbound SNS-SIZE procedure */
Harald Weltebf768242019-02-21 22:19:21 +010015function f_incoming_sns_size(template (omit) NsCause cause := omit, integer idx := 0)
16runs on RAW_NS_CT {
Harald Weltec4d7beb2019-02-21 18:21:01 +010017 var PDU_NS rx;
18 /* expect one single SNS-SIZE with RESET flag; one remote v4 EP; no v6 EP */
Harald Weltebf768242019-02-21 22:19:21 +010019 rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 8,
20 num_v4 := 4, num_v6 := omit), idx);
21 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_SIZE_ACK(g_nsconfig[idx].nsei, cause)));
Harald Weltec4d7beb2019-02-21 18:21:01 +010022}
23
24/* perform outbound SNS-SIZE procedure */
Harald Weltebf768242019-02-21 22:19:21 +010025function f_outgoing_sns_size(template (omit) NsCause cause := omit, integer idx:= 0)
26runs on RAW_NS_CT {
Harald Weltec4d7beb2019-02-21 18:21:01 +010027 var PDU_NS rx;
Harald Weltebf768242019-02-21 22:19:21 +010028 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 1,
Harald Weltec4d7beb2019-02-21 18:21:01 +010029 num_v4 := 1, num_v6 := omit)
30 ));
31 /* expect one single SNS-SIZE with RESET flag; one remote v4 EP; no v6 EP */
Harald Weltebf768242019-02-21 22:19:21 +010032 rx := f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig[idx].nsei, cause), idx);
Harald Weltec4d7beb2019-02-21 18:21:01 +010033}
34
35/* perform inbound SNS-CONFIG procedure */
Harald Weltebf768242019-02-21 22:19:21 +010036function f_incoming_sns_config(template (omit) NsCause cause := omit, integer idx := 0)
37runs on RAW_NS_CT {
Harald Weltec4d7beb2019-02-21 18:21:01 +010038 var PDU_NS rx;
Harald Weltebf768242019-02-21 22:19:21 +010039 rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig[idx].nsei, end_flag := true, v4 := ?), idx);
40 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause)));
Harald Weltec4d7beb2019-02-21 18:21:01 +010041}
42
43/* perform outbound SNS-CONFIG procedure */
Harald Weltebf768242019-02-21 22:19:21 +010044function f_outgoing_sns_config(template (omit) NsCause cause := omit, integer idx := 0)
45runs on RAW_NS_CT {
Harald Weltec4d7beb2019-02-21 18:21:01 +010046 var PDU_NS rx;
Harald Weltebf768242019-02-21 22:19:21 +010047 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx].local_ip,
48 g_nsconfig[idx].local_udp_port) }
49 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
50 rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
Harald Weltec4d7beb2019-02-21 18:21:01 +010051}
52
Harald Weltebf768242019-02-21 22:19:21 +010053/* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */
54function f_outgoing_sns_config_1c1u(template (omit) NsCause cause := omit, integer idx := 0)
55runs on RAW_NS_CT {
56 var PDU_NS rx;
57 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[0].local_ip,
58 g_nsconfig[0].local_udp_port, 1, 0),
59 ts_SNS_IPv4(g_nsconfig[1].local_ip,
60 g_nsconfig[1].local_udp_port, 0, 1) };
61 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
62 rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
63}
64
65
Harald Weltef7b74072019-02-20 20:48:50 +010066/* PCU-originated SNS-SIZE: successful case */
67testcase TC_sns_po_size_success() runs on RAW_NS_CT {
68 f_init_ns_codec();
69 f_init_pcuif();
70 f_incoming_sns_size();
71 f_sleep(1.0);
72 setverdict(pass);
73}
74
75/* PCU-originated SNS-SIZE: NACK from our side */
76testcase TC_sns_po_size_nack() runs on RAW_NS_CT {
77 f_init_ns_codec();
78 f_init_pcuif();
79 f_incoming_sns_size(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
80 /* FIXME: ensure we don't get a SNS-CONFIG */
81 /* FIXME: ensure we get re-transmitted SNS-SIZE attempts */
82 f_sleep(10.0);
83 setverdict(pass);
84}
85
86/* PCU-originated SNS-CONFIG: successful case */
87testcase TC_sns_po_config_success() runs on RAW_NS_CT {
88 f_init_ns_codec();
89 f_init_pcuif();
90 f_incoming_sns_size();
91 f_incoming_sns_config();
92 f_sleep(1.0);
93 setverdict(pass);
94}
95
96/* PCU-originated SNS-CONFIG: successful case */
97testcase TC_sns_po_config_nack() runs on RAW_NS_CT {
98 f_init_ns_codec();
99 f_init_pcuif();
100 f_incoming_sns_size();
101 f_incoming_sns_config(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
102 /* FIXME: ensure we get re-transmitted SNS-CONFIG attempts */
103 f_sleep(10.0);
104 setverdict(pass);
105}
106
107
108/* SGSN-originated SNS-SIZE: successful case */
109testcase TC_sns_so_config_success() runs on RAW_NS_CT {
110 f_init_ns_codec();
111 f_init_pcuif();
112 f_incoming_sns_size();
113 f_incoming_sns_config();
114 f_outgoing_sns_config();
115
116 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
117 as_rx_alive_tx_ack(oneshot := true);
118 activate(as_rx_alive_tx_ack());
119
120 f_outgoing_ns_alive();
121
122 /* Expect BVC-RESET for signaling (0) and ptp BVCI */
123 as_rx_bvc_reset_tx_ack(0, oneshot := true);
124 as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvci, oneshot := true);
125 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvci, oneshot := true);
126
127 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future */
128 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvci, oneshot := true);
129 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvci));
130 setverdict(pass);
131}
132
133control {
134 execute( TC_sns_po_size_success() );
135 execute( TC_sns_po_size_nack() );
136 execute( TC_sns_po_config_success() );
137 execute( TC_sns_po_config_nack() );
138 execute( TC_sns_so_config_success() );
139}
140
141}