Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 1 | module PCU_Tests_RAW_SNS { |
| 2 | |
| 3 | import from Osmocom_Types all; |
| 4 | import from PCU_Tests all; |
| 5 | import from PCU_Tests_RAW all; |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 6 | import from Osmocom_Gb_Types all; |
| 7 | import from NS_CodecPort all; |
| 8 | import from NS_Types all; |
Harald Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 9 | |
| 10 | /********************************************************************************** |
| 11 | * Modern Gb/IP bring-up test cases using IP Sub-Network Service (SNS) |
| 12 | **********************************************************************************/ |
| 13 | |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 14 | /* perform inbound SNS-SIZE procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 15 | function f_incoming_sns_size(template (omit) NsCause cause := omit, integer idx := 0) |
| 16 | runs on RAW_NS_CT { |
Harald Welte | b63c3a1 | 2019-02-22 23:27:12 +0100 | [diff] [blame^] | 17 | log("f_incoming_sns_size(idx=", idx, ")"); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 18 | var PDU_NS rx; |
| 19 | /* expect one single SNS-SIZE with RESET flag; one remote v4 EP; no v6 EP */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 20 | 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 Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | /* perform outbound SNS-SIZE procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 26 | function f_outgoing_sns_size(template (omit) NsCause cause := omit, integer idx:= 0) |
| 27 | runs on RAW_NS_CT { |
Harald Welte | b63c3a1 | 2019-02-22 23:27:12 +0100 | [diff] [blame^] | 28 | log("f_outgoing_sns_size(idx=", idx, ")"); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 29 | var PDU_NS rx; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 30 | 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 Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 31 | num_v4 := 1, num_v6 := omit) |
| 32 | )); |
| 33 | /* expect one single SNS-SIZE with RESET flag; one remote v4 EP; no v6 EP */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 34 | rx := f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig[idx].nsei, cause), idx); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | /* perform inbound SNS-CONFIG procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 38 | function f_incoming_sns_config(template (omit) NsCause cause := omit, integer idx := 0) |
| 39 | runs on RAW_NS_CT { |
Harald Welte | b63c3a1 | 2019-02-22 23:27:12 +0100 | [diff] [blame^] | 40 | log("f_incoming_sns_config(idx=", idx, ")"); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 41 | var PDU_NS rx; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 42 | 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 Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | /* perform outbound SNS-CONFIG procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 47 | function f_outgoing_sns_config(template (omit) NsCause cause := omit, integer idx := 0) |
| 48 | runs on RAW_NS_CT { |
Harald Welte | b63c3a1 | 2019-02-22 23:27:12 +0100 | [diff] [blame^] | 49 | log("f_outgoing_sns_config(idx=", idx, ")"); |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 50 | var PDU_NS rx; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 51 | 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 Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 55 | } |
| 56 | |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 57 | /* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */ |
| 58 | function f_outgoing_sns_config_1c1u(template (omit) NsCause cause := omit, integer idx := 0) |
| 59 | runs on RAW_NS_CT { |
Harald Welte | b63c3a1 | 2019-02-22 23:27:12 +0100 | [diff] [blame^] | 60 | log("f_outgoing_sns_config_1c1u(idx=", idx, ")"); |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame] | 61 | 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 Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 71 | /* PCU-originated SNS-SIZE: successful case */ |
| 72 | testcase 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 */ |
| 81 | testcase 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 */ |
| 92 | testcase 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 */ |
| 102 | testcase 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 */ |
| 114 | testcase 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 | |
| 138 | control { |
| 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 | } |