SGSN: Some initial SNS tests for IP-SNS in OsmoSGSN

Change-Id: I821d998704756fa30278f41d0371051db9d3fc58
This commit is contained in:
Harald Welte 2021-03-23 18:20:12 +01:00
parent 7ef6d10145
commit 424ec5211c
5 changed files with 261 additions and 8 deletions

View File

@ -34,6 +34,7 @@ public type component RAW_NS_CT {
#endif #endif
var NSConfiguration g_nsconfig; var NSConfiguration g_nsconfig;
timer g_T_guard; timer g_T_guard;
var boolean g_handle_rx_alive := false;
} }
public altstep as_Tguard() runs on RAW_NS_CT { public altstep as_Tguard() runs on RAW_NS_CT {
@ -99,6 +100,7 @@ function f_ns_exp(template PDU_NS exp_rx, integer idx := 0) runs on RAW_NS_CT re
var default d := activate(ax_rx_fail_on_any_ns()); var default d := activate(ax_rx_fail_on_any_ns());
alt { alt {
[] NSCP[idx].receive(PDU_NS: exp_rx) -> value nrf { } [] NSCP[idx].receive(PDU_NS: exp_rx) -> value nrf { }
[g_handle_rx_alive] as_rx_alive_tx_ack();
} }
deactivate(d); deactivate(d);
return nrf; return nrf;
@ -109,6 +111,7 @@ function f_outgoing_ns_alive(integer idx := 0) runs on RAW_NS_CT {
NSCP[idx].send(t_NS_ALIVE); NSCP[idx].send(t_NS_ALIVE);
alt { alt {
[] NSCP[idx].receive(t_NS_ALIVE_ACK); [] NSCP[idx].receive(t_NS_ALIVE_ACK);
[g_handle_rx_alive] as_rx_alive_tx_ack();
[] NSCP[idx].receive { repeat; } [] NSCP[idx].receive { repeat; }
} }
} }
@ -122,6 +125,7 @@ function f_outgoing_ns_alive_no_ack(integer idx := 0, float tout := 10.0) runs o
[] NSCP[idx].receive(t_NS_ALIVE_ACK) { [] NSCP[idx].receive(t_NS_ALIVE_ACK) {
setverdict(fail, "Received unexpected NS-ALIVE ACK"); setverdict(fail, "Received unexpected NS-ALIVE ACK");
} }
[g_handle_rx_alive] as_rx_alive_tx_ack();
[] NSCP[idx].receive { repeat; } [] NSCP[idx].receive { repeat; }
[] T.timeout { [] T.timeout {
setverdict(pass); setverdict(pass);
@ -138,6 +142,7 @@ function f_outgoing_ns_reset(integer idx := 0, float tout := 10.0) runs on RAW_N
[] NSCP[idx].receive(ts_NS_RESET_ACK(g_nsconfig.nsvc[idx].nsvci, g_nsconfig.nsei)) { [] NSCP[idx].receive(ts_NS_RESET_ACK(g_nsconfig.nsvc[idx].nsvci, g_nsconfig.nsei)) {
setverdict(pass); setverdict(pass);
} }
[g_handle_rx_alive] as_rx_alive_tx_ack();
[] NSCP[idx].receive { repeat; } [] NSCP[idx].receive { repeat; }
[] T.timeout { [] T.timeout {
setverdict(fail, "Failed to receive a RESET ACK"); setverdict(fail, "Failed to receive a RESET ACK");
@ -150,6 +155,7 @@ function f_outgoing_ns_block(NsCause cause, integer idx := 0) runs on RAW_NS_CT
NSCP[idx].send(ts_NS_BLOCK(cause, g_nsconfig.nsvc[idx].nsvci)); NSCP[idx].send(ts_NS_BLOCK(cause, g_nsconfig.nsvc[idx].nsvci));
alt { alt {
[] NSCP[idx].receive(tr_NS_BLOCK_ACK(g_nsconfig.nsvc[idx].nsvci)); [] NSCP[idx].receive(tr_NS_BLOCK_ACK(g_nsconfig.nsvc[idx].nsvci));
[g_handle_rx_alive] as_rx_alive_tx_ack();
[] NSCP[idx].receive { repeat; } [] NSCP[idx].receive { repeat; }
} }
} }
@ -159,6 +165,7 @@ function f_outgoing_ns_unblock(integer idx := 0) runs on RAW_NS_CT {
NSCP[idx].send(t_NS_UNBLOCK); NSCP[idx].send(t_NS_UNBLOCK);
alt { alt {
[] NSCP[idx].receive(t_NS_UNBLOCK_ACK); [] NSCP[idx].receive(t_NS_UNBLOCK_ACK);
[g_handle_rx_alive] as_rx_alive_tx_ack();
[] NSCP[idx].receive { repeat; } [] NSCP[idx].receive { repeat; }
} }
} }
@ -198,6 +205,7 @@ runs on RAW_NS_CT {
[not exp_ack] T.timeout { [not exp_ack] T.timeout {
setverdict(pass); setverdict(pass);
} }
[g_handle_rx_alive] as_rx_alive_tx_ack();
[] NSCP[idx].receive { repeat; } [] NSCP[idx].receive { repeat; }
} }
} }
@ -298,22 +306,23 @@ runs on RAW_NS_CT {
} }
/* perform outbound SNS-SIZE procedure */ /* perform outbound SNS-SIZE procedure */
function f_outgoing_sns_size(template (omit) NsCause cause := omit, integer idx:= 0) function f_outgoing_sns_size(template (omit) NsCause cause := omit, integer max_nsvcs := 1,
integer num_ip := 1, integer idx:= 0)
runs on RAW_NS_CT { runs on RAW_NS_CT {
log("f_outgoing_sns_size(idx=", idx, ")"); log("f_outgoing_sns_size(idx=", idx, ")");
var PDU_NS rx; var PDU_NS rx;
var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx]; var NSVCConfiguration nsvc_cfg := g_nsconfig.nsvc[idx];
if (nsvc_cfg.provider.ip.address_family == AF_INET) { if (nsvc_cfg.provider.ip.address_family == AF_INET) {
NSCP[idx].send(ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 1, NSCP[idx].send(ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := max_nsvcs,
num_v4 := 1, num_v6 := omit) num_v4 := num_ip, num_v6 := omit)
); );
} else { } else {
NSCP[idx].send(ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := 1, NSCP[idx].send(ts_SNS_SIZE(g_nsconfig.nsei, rst_flag := true, max_nsvcs := max_nsvcs,
num_v4 := omit, num_v6 := 1) num_v4 := omit, num_v6 := num_ip)
); );
} }
/* expect one single SNS-SIZE with RESET flag; 4x v4 EP; no v6 EP */ /* expect one single SNS-SIZE */
rx := f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig.nsei, cause), idx); rx := f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig.nsei, cause), idx);
} }

View File

@ -23,3 +23,5 @@ pcu
gamma 0 gamma 0
pcu-socket /tmp/pcu_bts pcu-socket /tmp/pcu_bts
gb-dialect ip-sns gb-dialect ip-sns
ns
timer tns-test 10

View File

@ -47,9 +47,74 @@ testcase TC_NS_connect_alive() runs on RAW_Test_CT {
f_clean_ns_codec(); f_clean_ns_codec();
} }
/* perform outgoing SNS-SIZE procedure */
testcase TC_SNS_size() runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
g_handle_rx_alive := true;
f_outgoing_sns_size();
setverdict(pass);
}
/* outgoing SNS-SIZE procedure with more BSS side IPs than SGSN can handle */
testcase TC_SNS_size_too_big() runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
g_handle_rx_alive := true;
f_outgoing_sns_size(cause := NS_CAUSE_INVALID_NR_OF_NSVCS, num_ip := 100);
setverdict(pass);
}
/* perform outgoing SNS-CONFIG procedure (for BSS) */
testcase TC_SNS_config_bss() runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
g_handle_rx_alive := true;
f_outgoing_sns_size();
f_outgoing_sns_config();
setverdict(pass);
}
/* perform incoming SNS-CONFIG procedure (for SGSN) */
testcase TC_SNS_config_sgsn() runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
g_handle_rx_alive := true;
f_outgoing_sns_size();
f_outgoing_sns_config();
f_incoming_sns_config();
setverdict(pass);
}
/* perform full SNS handshake and then outbound NS-ALIVE */
testcase TC_SNS_and_alive() runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig[0], guard_secs := 120.0);
g_handle_rx_alive := true;
f_outgoing_sns_size();
f_outgoing_sns_config();
f_incoming_sns_config();
f_outgoing_ns_alive();
setverdict(pass);
}
control { control {
execute( TC_NS_connect_alive() );
execute( TC_NS_connect_reset() ); if (mp_nsconfig[0].handle_sns) {
execute( TC_SNS_size() );
execute( TC_SNS_size_too_big() );
execute( TC_SNS_config_bss() );
execute( TC_SNS_config_sgsn() );
execute( TC_SNS_and_alive() );
} else {
execute( TC_NS_connect_alive() );
execute( TC_NS_connect_reset() );
}
} }
} }

72
sgsn/SGSN_Tests_SNS.cfg Normal file
View File

@ -0,0 +1,72 @@
[ORDERED_INCLUDE]
# Common configuration, shared between test suites
"../Common.cfg"
# testsuite specific configuration, not expected to change
"./SGSN_Tests.default"
# Local configuration below
[LOGGING]
[TESTPORT_PARAMETERS]
*.SGSNVTY.CTRL_HOSTNAME := "127.0.0.10"
[MODULE_PARAMETERS]
SGSN_Tests.mp_nsconfig := {
{
handle_sns := true,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.103",
remote_ip := "127.0.0.10"
}
}
}
}
},
{
handle_sns := true,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.103",
remote_ip := "127.0.0.10"
}
}
}
}
},
{
handle_sns := true,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.103",
remote_ip := "127.0.0.10"
}
}
}
}
}
}
SGSN_Tests.mp_ranap_cfg := {
{
sctp_addr := { 23908, "127.0.0.103", 2905, "127.0.0.200" }
}
}
SGSN_Tests.mp_hlr_ip := "127.0.0.103"
SGSN_Tests.mp_ggsn_ip := "127.0.0.103"
[MAIN_CONTROLLER]
[EXECUTE]
SGSN_Tests.control
SGSN_Tests_Iu.control
SGSN_Tests_NS.control

105
sgsn/osmo-sgsn.sns.cfg Normal file
View File

@ -0,0 +1,105 @@
!
! OsmoSGSN (1.2.0.46-e77e-dirty) configuration saved from vty
!!
!
log gsmtap 127.0.0.1
logging level set-all debug
logging filter all 1
!
log stderr
logging filter all 1
logging color 1
logging print category 1
logging print category-hex 0
logging timestamp 1
logging print extended-timestamp 1
logging print file 1
logging level all everything
logging level mm debug
logging level pag notice
logging level meas notice
logging level ref notice
logging level gprs debug
logging level lns debug
logging level lbssgp info
logging level llc debug
logging level sndcp debug
logging level slhc notice
logging level ranap info
logging level sua info
logging level v42bis info
logging level lglobal info
logging level llapd notice
logging level linp notice
logging level lmux notice
logging level lmi notice
logging level lmib notice
logging level lsms notice
logging level lctrl notice
logging level lgtp debug
logging level lstats notice
logging level lgsup debug
logging level loap notice
logging level lss7 notice
logging level lsccp info
logging level lsua notice
logging level lm3ua notice
logging level lmgcp notice
!
stats interval 5
!
line vty
no login
bind 127.0.0.10
ctrl
bind 127.0.0.10
!
cs7 instance 0
point-code 0.23.4
asp asp-clnt-OsmoSGSN-A 2905 0 m3ua
remote-ip 127.0.0.200
as as-clnt-OsmoSGSN-A m3ua
asp asp-clnt-OsmoSGSN-A
routing-key 3 0.23.4
ns
timer tns-block 3
timer tns-block-retries 3
timer tns-reset 3
timer tns-reset-retries 3
timer tns-test 30
timer tns-alive 3
timer tns-alive-retries 10
bind udp local10
listen 127.0.0.10 23000
accept-dynamic-ip-sns
bind udp local10_1
listen 127.0.0.10 23001
ip-sns-default bind local10
!ip-sns-default bind local10_1
bssgp
sgsn
gtp local-ip 127.0.0.10
ggsn 0 remote-ip 127.0.0.103
ggsn 0 gtp-version 1
gsup remote-ip 127.0.0.103
gsup remote-port 4222
auth-policy remote
gsup oap-id 0
! apn * ggsn 0
no cdr filename
no cdr trap
cdr interval 600
timer t3312 600
timer t3322 6
timer t3350 6
timer t3360 6
timer t3370 6
timer t3313 30
timer t3314 44
timer t3316 44
timer t3385 8
timer t3386 8
timer t3395 8
timer t3397 8
no compression rfc1144
no compression v42bis