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 | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 17 | var PDU_NS rx; |
| 18 | /* 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^] | 19 | 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 Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | /* perform outbound SNS-SIZE procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame^] | 25 | function f_outgoing_sns_size(template (omit) NsCause cause := omit, integer idx:= 0) |
| 26 | runs on RAW_NS_CT { |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 27 | var PDU_NS rx; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame^] | 28 | 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] | 29 | num_v4 := 1, num_v6 := omit) |
| 30 | )); |
| 31 | /* 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^] | 32 | 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] | 33 | } |
| 34 | |
| 35 | /* perform inbound SNS-CONFIG procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame^] | 36 | function f_incoming_sns_config(template (omit) NsCause cause := omit, integer idx := 0) |
| 37 | runs on RAW_NS_CT { |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 38 | var PDU_NS rx; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame^] | 39 | 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 Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | /* perform outbound SNS-CONFIG procedure */ |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame^] | 44 | function f_outgoing_sns_config(template (omit) NsCause cause := omit, integer idx := 0) |
| 45 | runs on RAW_NS_CT { |
Harald Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 46 | var PDU_NS rx; |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame^] | 47 | 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 Welte | c4d7beb | 2019-02-21 18:21:01 +0100 | [diff] [blame] | 51 | } |
| 52 | |
Harald Welte | bf76824 | 2019-02-21 22:19:21 +0100 | [diff] [blame^] | 53 | /* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */ |
| 54 | function f_outgoing_sns_config_1c1u(template (omit) NsCause cause := omit, integer idx := 0) |
| 55 | runs 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 Welte | f7b7407 | 2019-02-20 20:48:50 +0100 | [diff] [blame] | 66 | /* PCU-originated SNS-SIZE: successful case */ |
| 67 | testcase 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 */ |
| 76 | testcase 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 */ |
| 87 | testcase 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 */ |
| 97 | testcase 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 */ |
| 109 | testcase 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 | |
| 133 | control { |
| 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 | } |