blob: fb4d8f77834847500b562e57d676e40bf3e3e98a [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 Welteb63c3a12019-02-22 23:27:12 +010017 log("f_incoming_sns_size(idx=", idx, ")");
Harald Weltec4d7beb2019-02-21 18:21:01 +010018 var PDU_NS rx;
19 /* expect one single SNS-SIZE with RESET flag; one remote v4 EP; no v6 EP */
Harald Weltebf768242019-02-21 22:19:21 +010020 rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 8,
21 num_v4 := 4, num_v6 := omit), idx);
22 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 +010023}
24
25/* perform outbound SNS-SIZE procedure */
Harald Weltebf768242019-02-21 22:19:21 +010026function f_outgoing_sns_size(template (omit) NsCause cause := omit, integer idx:= 0)
27runs on RAW_NS_CT {
Harald Welteb63c3a12019-02-22 23:27:12 +010028 log("f_outgoing_sns_size(idx=", idx, ")");
Harald Weltec4d7beb2019-02-21 18:21:01 +010029 var PDU_NS rx;
Harald Weltebf768242019-02-21 22:19:21 +010030 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 +010031 num_v4 := 1, num_v6 := omit)
32 ));
33 /* expect one single SNS-SIZE with RESET flag; one remote v4 EP; no v6 EP */
Harald Weltebf768242019-02-21 22:19:21 +010034 rx := f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig[idx].nsei, cause), idx);
Harald Weltec4d7beb2019-02-21 18:21:01 +010035}
36
37/* perform inbound SNS-CONFIG procedure */
Harald Weltebf768242019-02-21 22:19:21 +010038function f_incoming_sns_config(template (omit) NsCause cause := omit, integer idx := 0)
39runs on RAW_NS_CT {
Harald Welteb63c3a12019-02-22 23:27:12 +010040 log("f_incoming_sns_config(idx=", idx, ")");
Harald Weltec4d7beb2019-02-21 18:21:01 +010041 var PDU_NS rx;
Harald Weltebf768242019-02-21 22:19:21 +010042 rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig[idx].nsei, end_flag := true, v4 := ?), idx);
43 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 +010044}
45
46/* perform outbound SNS-CONFIG procedure */
Harald Weltebf768242019-02-21 22:19:21 +010047function f_outgoing_sns_config(template (omit) NsCause cause := omit, integer idx := 0)
48runs on RAW_NS_CT {
Harald Welteb63c3a12019-02-22 23:27:12 +010049 log("f_outgoing_sns_config(idx=", idx, ")");
Harald Weltec4d7beb2019-02-21 18:21:01 +010050 var PDU_NS rx;
Harald Weltebf768242019-02-21 22:19:21 +010051 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx].local_ip,
52 g_nsconfig[idx].local_udp_port) }
53 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
54 rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
Harald Weltec4d7beb2019-02-21 18:21:01 +010055}
56
Harald Weltebf768242019-02-21 22:19:21 +010057/* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */
58function f_outgoing_sns_config_1c1u(template (omit) NsCause cause := omit, integer idx := 0)
59runs on RAW_NS_CT {
Harald Welteb63c3a12019-02-22 23:27:12 +010060 log("f_outgoing_sns_config_1c1u(idx=", idx, ")");
Harald Weltebf768242019-02-21 22:19:21 +010061 var PDU_NS rx;
62 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[0].local_ip,
63 g_nsconfig[0].local_udp_port, 1, 0),
64 ts_SNS_IPv4(g_nsconfig[1].local_ip,
65 g_nsconfig[1].local_udp_port, 0, 1) };
66 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
67 rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
68}
69
70
Harald Weltef7b74072019-02-20 20:48:50 +010071/* PCU-originated SNS-SIZE: successful case */
72testcase TC_sns_po_size_success() runs on RAW_NS_CT {
73 f_init_ns_codec();
74 f_init_pcuif();
75 f_incoming_sns_size();
76 f_sleep(1.0);
77 setverdict(pass);
78}
79
80/* PCU-originated SNS-SIZE: NACK from our side */
81testcase TC_sns_po_size_nack() runs on RAW_NS_CT {
82 f_init_ns_codec();
83 f_init_pcuif();
84 f_incoming_sns_size(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
85 /* FIXME: ensure we don't get a SNS-CONFIG */
86 /* FIXME: ensure we get re-transmitted SNS-SIZE attempts */
87 f_sleep(10.0);
88 setverdict(pass);
89}
90
91/* PCU-originated SNS-CONFIG: successful case */
92testcase TC_sns_po_config_success() runs on RAW_NS_CT {
93 f_init_ns_codec();
94 f_init_pcuif();
95 f_incoming_sns_size();
96 f_incoming_sns_config();
97 f_sleep(1.0);
98 setverdict(pass);
99}
100
101/* PCU-originated SNS-CONFIG: successful case */
102testcase TC_sns_po_config_nack() runs on RAW_NS_CT {
103 f_init_ns_codec();
104 f_init_pcuif();
105 f_incoming_sns_size();
106 f_incoming_sns_config(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
107 /* FIXME: ensure we get re-transmitted SNS-CONFIG attempts */
108 f_sleep(10.0);
109 setverdict(pass);
110}
111
112
113/* SGSN-originated SNS-SIZE: successful case */
114testcase TC_sns_so_config_success() runs on RAW_NS_CT {
115 f_init_ns_codec();
116 f_init_pcuif();
117 f_incoming_sns_size();
118 f_incoming_sns_config();
119 f_outgoing_sns_config();
120
121 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
122 as_rx_alive_tx_ack(oneshot := true);
123 activate(as_rx_alive_tx_ack());
124
125 f_outgoing_ns_alive();
126
127 /* Expect BVC-RESET for signaling (0) and ptp BVCI */
128 as_rx_bvc_reset_tx_ack(0, oneshot := true);
129 as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvci, oneshot := true);
130 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvci, oneshot := true);
131
132 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future */
133 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvci, oneshot := true);
134 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvci));
135 setverdict(pass);
136}
137
138control {
139 execute( TC_sns_po_size_success() );
140 execute( TC_sns_po_size_nack() );
141 execute( TC_sns_po_config_success() );
142 execute( TC_sns_po_config_nack() );
143 execute( TC_sns_so_config_success() );
144}
145
146}