diff options
author | Harald Welte <laforge@gnumonks.org> | 2018-07-05 00:01:45 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-03-27 11:17:49 +0000 |
commit | 5e514fa3dbf2d9c1d06e55f79acf6a821e5daa0b (patch) | |
tree | b7efa5c538825ea29f96d9c7afa22a25502d7830 | |
parent | 8a581d24099ae9618524b9a3521b5d97218605e1 (diff) |
NS_Emulation: Add minimal support for SGSN-side SNS handling
Change-Id: I1edf739d6fd39478f662a28a7d9334ca51c270a3
-rw-r--r-- | library/NS_Emulation.ttcn | 46 | ||||
-rw-r--r-- | pcu/PCU_Tests.ttcn | 4 | ||||
-rw-r--r-- | sgsn/SGSN_Tests.ttcn | 12 |
3 files changed, 57 insertions, 5 deletions
diff --git a/library/NS_Emulation.ttcn b/library/NS_Emulation.ttcn index 69159930..9ad89cb4 100644 --- a/library/NS_Emulation.ttcn +++ b/library/NS_Emulation.ttcn @@ -116,7 +116,9 @@ module NS_Emulation { PortNumber remote_udp_port, charstring remote_ip, Nsvci nsvci, - Nsvci nsei + Nsvci nsei, + boolean role_sgsn, + boolean handle_sns } private function f_change_state(NseState new_state) runs on NS_CT { @@ -192,6 +194,8 @@ module NS_Emulation { /* FIXME */ } + [config.role_sgsn and config.handle_sns] as_sns_sgsn(); + /* default case of handling unknown PDUs */ [] NSCP.receive(t_NS_RecvFrom(?)) -> value rf { log("Rx Unexpected NS PDU ", rf.msg," in state ", g_state); @@ -201,6 +205,46 @@ module NS_Emulation { [] NSCP.receive(ASP_Event:?) -> value evt { NS_SP.send(evt); } } + /* simple IP Sub-Network Service responder for the SGSN side. This is not a full implementation + * of the protocol, merely sufficient to make the PCU/BSS side happy to proceed */ + altstep as_sns_sgsn() runs on NS_CT { + var NS_RecvFrom rf; + [] NSCP.receive(t_NS_RecvFrom(tr_SNS_SIZE(config.nsei))) -> value rf { + /* blindly acknowledge whatever the PCU sends */ + NSCP.send(t_NS_Send(g_conn_id, ts_SNS_SIZE_ACK(config.nsei, omit))); + } + [] NSCP.receive(t_NS_RecvFrom(tr_SNS_SIZE(?))) { + setverdict(fail, "SNS-SIZE from unexpected NSEI"); + self.stop; + } + [] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG(config.nsei, true, + {tr_SNS_IPv4(config.remote_ip, config.remote_udp_port)}))) -> value rf { + /* blindly acknowledge whatever the PCU sends */ + NSCP.send(t_NS_Send(g_conn_id, ts_SNS_CONFIG_ACK(config.nsei, omit))); + /* send a SNS-CONFIG in response and expect a SNS-CONFIG-ACK */ + var IP4_Elements v4 := { valueof(ts_SNS_IPv4(config.local_ip, config.local_udp_port)) }; + NSCP.send(t_NS_Send(g_conn_id, ts_SNS_CONFIG(config.nsei, true, v4))); + alt { + [] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG_ACK(config.nsei, omit))) { + /* success */ + } + [] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG_ACK(config.nsei, ?))) { + setverdict(fail, "Unexpected SNS-CONFIG-NACK"); + self.stop; + } + } + } + [] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG(config.nsei, false, ?))) { /* ignore */} + [] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG(config.nsei, true, ?))) { + setverdict(fail, "Unexpected SNS-CONFIG content"); + self.stop; + } + [] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG(?, ?, ?))) { + setverdict(fail, "SNS-CONFIG from unexpected NSEI"); + self.stop; + } + } + private function f_ScanEvents() runs on NS_CT { var NsUnitdataRequest ud_req; var NS_RecvFrom rf; diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn index 6e8185df..f63c4ad1 100644 --- a/pcu/PCU_Tests.ttcn +++ b/pcu/PCU_Tests.ttcn @@ -43,7 +43,9 @@ module PCU_Tests { remote_udp_port := 21000, remote_ip := "127.0.0.1", nsvci := 0, - nsei := 2342 + nsei := 2342, + role_sgsn := true, + handle_sns := true }; } diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn index a2e93c07..8b639e65 100644 --- a/sgsn/SGSN_Tests.ttcn +++ b/sgsn/SGSN_Tests.ttcn @@ -51,7 +51,9 @@ modulepar { remote_udp_port := 23000, remote_ip := "127.0.0.1", nsvci := 97, - nsei := 96 + nsei := 96, + role_sgsn := false, + handle_sns := false }, { local_udp_port := 21011, @@ -59,7 +61,9 @@ modulepar { remote_udp_port := 23000, remote_ip := "127.0.0.1", nsvci := 98, - nsei := 97 + nsei := 97, + role_sgsn := false, + handle_sns := false }, { local_udp_port := 21012, @@ -67,7 +71,9 @@ modulepar { remote_udp_port := 23000, remote_ip := "127.0.0.1", nsvci := 99, - nsei := 98 + nsei := 98, + role_sgsn := false, + handle_sns := false } }; }; |