Harald Welte | b8a4ac8 | 2019-06-23 11:04:12 +0200 | [diff] [blame] | 1 | module MME_Tests_SGsAP { |
| 2 | |
| 3 | /* Osmocom MME test suite in in TTCN-3 |
| 4 | * (C) 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 | |
| 13 | import from SGsAP_Types all; |
| 14 | import from SGsAP_Templates all; |
| 15 | import from SGsAP_Emulation all; |
| 16 | |
| 17 | import from General_Types all; |
| 18 | import from Osmocom_Types all; |
| 19 | import from L3_Templates all; |
| 20 | import from DNS_Helpers all; |
| 21 | import from MME_Tests all; |
| 22 | |
| 23 | /* performa SGs reset procedure */ |
| 24 | function f_sgsap_vlr_reset() runs on ConnHdlr { |
| 25 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 26 | var octetstring mme_name := f_enc_dns_hostname(mp_mme_name); |
| 27 | |
| 28 | SGsAP.send(ts_SGsAP_RESET_IND_VLR(vlr_name)); |
| 29 | alt { |
| 30 | [] SGsAP.receive(tr_SGsAP_RESET_ACK(mme_name, vlr_name)) { |
| 31 | setverdict(pass); |
| 32 | } |
| 33 | [] SGsAP.receive(tr_SGsAP_RESET_ACK(?, ?)) { |
| 34 | setverdict(fail, "Received unexpected VLR/MME name in SGsAP RESET ACK"); |
| 35 | } |
| 36 | [] SGsAP.receive { |
| 37 | setverdict(fail, "Received unexpected response to SGsAP RESET"); |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | /* perform a SGs paging procedure */ |
| 43 | function f_sgsap_page(Service_Indicator serv_ind, template (omit) OCT4 tmsi, |
| 44 | template (omit) SGs_Cause exp_cause) runs on ConnHdlr { |
| 45 | var octetstring vlr_name := f_enc_dns_hostname(mp_vlr_name); |
| 46 | var boolean exp_success := true; |
| 47 | var PDU_SGsAP rx; |
| 48 | if (not istemplatekind(exp_cause, "omit")) { |
| 49 | exp_success := false; |
| 50 | } |
| 51 | SGsAP.send(ts_SGsAP_PAGING_REQ(g_pars.imsi, vlr_name, serv_ind, tmsi)); |
| 52 | alt { |
| 53 | /* we expect success */ |
| 54 | [exp_success] SGsAP.receive(tr_SGsAP_SERVICE_REQ(g_pars.imsi, serv_ind, ?)) { |
| 55 | setverdict(pass); |
| 56 | } |
| 57 | [exp_success] SGsAP.receive(tr_SGsAP_PAGING_REJ(g_pars.imsi, ?)) { |
| 58 | setverdict(fail, "Received unexpected PAGING REJECT"); |
| 59 | } |
| 60 | /* we expect failure */ |
| 61 | [not exp_success] SGsAP.receive(tr_SGsAP_SERVICE_REQ(g_pars.imsi, serv_ind, ?)) { |
| 62 | setverdict(fail, "Received SERVICE REQ waiting for PAGING REJECT"); |
| 63 | } |
| 64 | [not exp_success] SGsAP.receive(tr_SGsAP_PAGING_REJ(g_pars.imsi, exp_cause)) { |
| 65 | setverdict(pass); |
| 66 | } |
| 67 | [not exp_success] SGsAP.receive(tr_SGsAP_PAGING_REJ(g_pars.imsi, ?)) { |
| 68 | setverdict(fail, "Received unexpected PAGING REJECT cause"); |
| 69 | } |
| 70 | [] SGsAP.receive { |
| 71 | setverdict(fail, "Received unexpected SgSAP"); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /* perform a SGs alert procedure */ |
| 77 | function f_sgsap_alert(template (omit) SGs_Cause exp_cause) runs on ConnHdlr{ |
| 78 | var boolean exp_success := true; |
| 79 | var PDU_SGsAP rx; |
| 80 | if (not istemplatekind(exp_cause, "omit")) { |
| 81 | exp_success := false; |
| 82 | } |
| 83 | SGsAP.send(ts_SGsAP_ALERT_REQ(g_pars.imsi)); |
| 84 | alt { |
| 85 | [exp_success] SGsAP.receive(tr_SGsAP_ALERT_ACK(g_pars.imsi)) { |
| 86 | setverdict(pass); |
| 87 | } |
| 88 | [exp_success] SGsAP.receive(tr_SGsAP_ALERT_REJECT(g_pars.imsi, ?)) -> value rx { |
| 89 | setverdict(fail, "Received unexpected ALERT REJECT ", rx); |
| 90 | } |
| 91 | [not exp_success] SGsAP.receive(tr_SGsAP_ALERT_ACK(g_pars.imsi)) { |
| 92 | setverdict(fail, "Received unexpected ALERT ACK"); |
| 93 | } |
| 94 | [not exp_success] SGsAP.receive(tr_SGsAP_ALERT_REJECT(g_pars.imsi, exp_cause)) { |
| 95 | setverdict(pass) |
| 96 | } |
| 97 | [not exp_success] SGsAP.receive(tr_SGsAP_ALERT_REJECT(g_pars.imsi, ?)) -> value rx { |
| 98 | setverdict(fail, "Received ALERT REJECT with unexpected cause ", rx); |
| 99 | } |
| 100 | [] SGsAP.receive { |
| 101 | setverdict(fail, "Received unexpected SGsAP"); |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | /* Test if MME responds to VLR-originated RESET procedure as expected */ |
| 107 | private function f_TC_sgsap_vlr_reset(ConnHdlrPars pars) runs on ConnHdlr { |
| 108 | f_init_handler(pars); |
| 109 | f_sgsap_vlr_reset(); |
| 110 | } |
| 111 | testcase TC_sgsap_vlr_reset() runs on MTC_CT { |
| 112 | var ConnHdlrPars pars; |
| 113 | var ConnHdlr vc_conn; |
| 114 | f_init_sgsap(testcasename()); |
| 115 | pars := f_init_pars(1); |
| 116 | vc_conn := f_start_handler_with_pars(refers(f_TC_sgsap_vlr_reset), pars); |
| 117 | vc_conn.done; |
| 118 | } |
| 119 | |
| 120 | /* Page known subscriber for SMS */ |
| 121 | private function f_TC_sgsap_paging_sms(ConnHdlrPars pars) runs on ConnHdlr { |
| 122 | f_init_handler(pars); |
| 123 | /* TODO: register subscriber on S1 */ |
| 124 | f_sgsap_page(SMS_indicator, omit, omit); |
| 125 | } |
| 126 | testcase TC_sgsap_paging_sms() runs on MTC_CT { |
| 127 | var ConnHdlrPars pars; |
| 128 | var ConnHdlr vc_conn; |
| 129 | f_init_sgsap(testcasename()); |
| 130 | pars := f_init_pars(2); |
| 131 | vc_conn := f_start_handler_with_pars(refers(f_TC_sgsap_paging_sms), pars); |
| 132 | vc_conn.done; |
| 133 | } |
| 134 | |
| 135 | /* Page known subscriber for CS call */ |
| 136 | private function f_TC_sgsap_paging_cs(ConnHdlrPars pars) runs on ConnHdlr { |
| 137 | f_init_handler(pars); |
| 138 | /* TODO: register subscriber on S1 */ |
| 139 | f_sgsap_page(CS_call_indicator, omit, omit); |
| 140 | } |
| 141 | testcase TC_sgsap_paging_cs() runs on MTC_CT { |
| 142 | var ConnHdlrPars pars; |
| 143 | var ConnHdlr vc_conn; |
| 144 | f_init_sgsap(testcasename()); |
| 145 | pars := f_init_pars(3); |
| 146 | vc_conn := f_start_handler_with_pars(refers(f_TC_sgsap_paging_cs), pars); |
| 147 | vc_conn.done; |
| 148 | } |
| 149 | |
| 150 | |
| 151 | /* Page unknown subscriber; expect PAGING REJECT from MME */ |
| 152 | private function f_TC_sgsap_paging_reject(ConnHdlrPars pars) runs on ConnHdlr { |
| 153 | f_init_handler(pars); |
| 154 | f_sgsap_page(SMS_indicator, omit, IMSI_unknown); |
| 155 | } |
| 156 | testcase TC_sgsap_paging_reject() runs on MTC_CT { |
| 157 | var ConnHdlrPars pars; |
| 158 | var ConnHdlr vc_conn; |
| 159 | f_init_sgsap(testcasename()); |
| 160 | pars := f_init_pars(4); |
| 161 | vc_conn := f_start_handler_with_pars(refers(f_TC_sgsap_paging_reject), pars); |
| 162 | vc_conn.done; |
| 163 | } |
| 164 | |
| 165 | /* Send ALERT-REQ to MME; perform S1AP activity; expect ALERT-ACK on SGs */ |
| 166 | private function f_TC_sgsap_alert(ConnHdlrPars pars) runs on ConnHdlr { |
| 167 | f_init_handler(pars); |
| 168 | /* TODO: register subscriber on S1 */ |
| 169 | f_sgsap_alert(omit); |
| 170 | /* TOOD: do something on S1 triggering UE ACT IND */ |
| 171 | SGsAP.receive(tr_SGsAP_UE_ACT_IND(g_pars.imsi)); |
| 172 | } |
| 173 | testcase TC_sgsap_alert() runs on MTC_CT { |
| 174 | var ConnHdlrPars pars; |
| 175 | var ConnHdlr vc_conn; |
| 176 | f_init_sgsap(testcasename()); |
| 177 | pars := f_init_pars(5); |
| 178 | vc_conn := f_start_handler_with_pars(refers(f_TC_sgsap_alert), pars); |
| 179 | vc_conn.done; |
| 180 | } |
| 181 | |
| 182 | /* Send ALERT-REQ to MME for unidentified IMSI; expect ALERT-REJ on SGs */ |
| 183 | private function f_TC_sgsap_alert_rej(ConnHdlrPars pars) runs on ConnHdlr { |
| 184 | f_init_handler(pars); |
| 185 | /* IMSI doesn't register and is hence unknown */ |
| 186 | f_sgsap_alert(IMSI_unknown); |
| 187 | } |
| 188 | testcase TC_sgsap_alert_rej() runs on MTC_CT { |
| 189 | var ConnHdlrPars pars; |
| 190 | var ConnHdlr vc_conn; |
| 191 | f_init_sgsap(testcasename()); |
| 192 | pars := f_init_pars(6); |
| 193 | vc_conn := f_start_handler_with_pars(refers(f_TC_sgsap_alert_rej), pars); |
| 194 | vc_conn.done; |
| 195 | } |
| 196 | |
| 197 | |
| 198 | /* Test SGsAP-DOWNLINK-UNITDATA (SGs -> S1) */ |
| 199 | /* Test SGsAP-UPLINK-UNITDATA (S1 -> SGs)*/ |
| 200 | /* Test SGSAP-DETACH-IND; detach on S1; expect DETACH-IND on SGs; send DETACH-ACK */ |
| 201 | /* Test SGsAP-LU-REQ; perform combined attach on S1; expect LU-REQ; acknowlege it */ |
| 202 | /* Test SGsAP-LU-REQ; perform combined attach on S1; expect LU-REQ; reject it */ |
| 203 | /* Test SGsAP-MMINFO-REQ; establish SGs association; send it on SGs; expect on S1 */ |
| 204 | |
| 205 | /* Test MT SERVICE ABORT; send PAGING; expect SERVICE REQ; send SERVICE ABORT */ |
| 206 | |
| 207 | /* Test EPS DETACH */ |
| 208 | /* Test IMSI DETACH */ |
| 209 | |
| 210 | } |