pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40592?usp=email )
Change subject: hnbgw: Introduce test
TC_{msc,sgsn}pool_sccp_n_pcstate_detaches_cnlink_sctp_down
......................................................................
hnbgw: Introduce test TC_{msc,sgsn}pool_sccp_n_pcstate_detaches_cnlink_sctp_down
Related: OS#5917
Depends: libosmo-sigtran.git Change-Id I7e4eedb65c4f2952f8b39ca4c539ca2f40e9946c
Change-Id: I079f2da09ff8d52e614ff6f5d267cd5429e4eb58
---
M hnbgw/HNBGW_Tests.default
M hnbgw/HNBGW_Tests.ttcn
M hnbgw/expected-results.xml
M hnbgw/osmo-hnbgw.cfg
M hnbgw/osmo-stp.cfg
5 files changed, 95 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/92/40592/1
diff --git a/hnbgw/HNBGW_Tests.default b/hnbgw/HNBGW_Tests.default
index b8a4863..174b012 100644
--- a/hnbgw/HNBGW_Tests.default
+++ b/hnbgw/HNBGW_Tests.default
@@ -20,6 +20,16 @@
*.STATSVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
*.STATSVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
*.STATSVTY.PROMPT1 := "OsmoHNBGW> "
+*.STPVTY.CTRL_MODE := "client"
+*.STPVTY.CTRL_HOSTNAME := "127.0.0.1"
+*.STPVTY.CTRL_PORTNUM := "4239"
+*.STPVTY.CTRL_LOGIN_SKIPPED := "yes"
+*.STPVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
+*.STPVTY.CTRL_READMODE := "buffered"
+*.STPVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.STPVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
+*.STPVTY.PROMPT1 := "OsmoSTP> "
+
[MODULE_PARAMETERS]
Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoHNBGW";
diff --git a/hnbgw/HNBGW_Tests.ttcn b/hnbgw/HNBGW_Tests.ttcn
index ef70948..b0bdca0 100644
--- a/hnbgw/HNBGW_Tests.ttcn
+++ b/hnbgw/HNBGW_Tests.ttcn
@@ -264,6 +264,7 @@
var MGCP_Emulation_CT vc_MGCP;
port TELNETasp_PT HNBGWVTY;
+ port TELNETasp_PT STPVTY;
var StatsD_Checker_CT vc_STATSD;
var PFCP_Emulation_CT vc_PFCP;
/* global test case guard timer (actual timeout value is set in f_init()) */
@@ -298,6 +299,16 @@
f_vty_transceive(HNBGWVTY, "enable");
}
+private function f_init_vty_stp() runs on test_CT {
+ if (STPVTY.checkstate("Mapped")) {
+ /* skip initialization if already executed once */
+ return;
+ }
+ map(self:STPVTY, system:STPVTY);
+ f_vty_set_prompts(STPVTY, prompt_prefix := "OsmoSTP");
+ f_vty_transceive(STPVTY, "enable");
+}
+
function f_init_mgcp(charstring id) runs on test_CT {
id := id & "-MGCP";
var MGCPOps ops := {
@@ -1797,7 +1808,7 @@
f_perform_compl_l3(g_pars.nas_pdu, expect_success := g_pars.expect_compl_l3_success);
}
-private function f_TC_cnpool_compl_l3(boolean ps_domain, octetstring nas_pdu, integer
cn_nr,
+private function f_TC_cnpool_compl_l3(boolean ps_domain, octetstring nas_pdu, integer
cn_nr := 0,
template (omit) charstring inc_countername := omit,
boolean expect_compl_l3_success := true) runs on test_CT {
var ConnHdlr vc_conn;
@@ -2490,7 +2501,63 @@
f_shutdown_helper();
}
-/* When a peer point-code gets an SCCP N-PCSTATE saying it is unreachable, immediately
mark the CN link as unusable. */
+private function f_vty_stp_hnbgw_asp_cmd(boolean ps_domain, charstring cmd) runs on
test_CT
+{
+ var charstring asp_node := "asp hnbgw0-0 2906 2905 m3ua";
+ f_vty_config2(STPVTY, {"cs7 instance 0", asp_node}, cmd);
+}
+
+/* When a peer point-code gets an SCCP N-PCSTATE saying it is unreachable,
+ * immediately mark the CN link as unusable.
+ * In this scenario, the SCCP N-PCSTATE is triggered by instructing the STP to
+ * shutdown the ASP serving the HNBGW, which will close the SCTP assoc between
+ * itself and IUT (HNBGW), which should then generate an N-PCSTATE.ind.
+ */
+testcase TC_mscpool_sccp_n_pcstate_detaches_cnlink_sctp_down() runs on test_CT {
+ f_TC_cnpool_sccp_n_pcstate_detaches_cnlink_sctp_down(ps_domain := false);
+}
+testcase TC_sgsnpool_sccp_n_pcstate_detaches_cnlink_sctp_down() runs on test_CT {
+ f_TC_cnpool_sccp_n_pcstate_detaches_cnlink_sctp_down(ps_domain := true);
+}
+function f_TC_cnpool_sccp_n_pcstate_detaches_cnlink_sctp_down(boolean ps_domain) runs on
test_CT
+{
+
+ f_init(nr_msc := 2, nr_sgsn := 2);
+ f_init_vty_stp();
+ f_sleep(1.0);
+
+ /* Control which MSC gets chosen next by the round-robin, otherwise
+ * would be randomly affected by which other tests ran before this. */
+ f_vty_set_roundrobin_next(HNBGWVTY, ps_domain, 0);
+
+ f_ctrs_cn_init(ps_domain := ps_domain);
+
+ var ro_octetstring compl3 := f_gen_compl3_by_domain(ps_domain, 3);
+
+ f_TC_cnpool_compl_l3(ps_domain, compl3[0], cn_nr := 0, inc_countername :=
"cnpool:subscr:new");
+ f_TC_cnpool_compl_l3(ps_domain, compl3[1], cn_nr := 1, inc_countername :=
"cnpool:subscr:new");
+
+ f_logp(HNBGWVTY, "Shutting down HNBGW ASP in STP");
+ f_vty_stp_hnbgw_asp_cmd(ps_domain, "shutdown");
+
+ f_TC_cnpool_compl_l3(ps_domain, compl3[2], expect_compl_l3_success := false);
+
+ f_logp(HNBGWVTY, "Restarting HNBGW ASP in STP");
+ f_vty_stp_hnbgw_asp_cmd(ps_domain, "no shutdown");
+
+ /* Now round-robin would wrap to the first MSC, but since the first MSC is disconnected,
it wraps around to the
+ * second. */
+ f_TC_cnpool_compl_l3(ps_domain, compl3[2], cn_nr := 1, inc_countername :=
"cnpool:subscr:new");
+ f_shutdown_helper();
+}
+
+/* When a peer point-code gets an SCCP N-PCSTATE saying it is unreachable,
+ * immediately mark the CN link as unusable.
+ * In this scenario, the SCCP N-PCSTATE is triggered by locally dropping the
+ * SCTP assoc at the virtual MSC (TTCN3). When STP osmo-hnbgw finds out about
+ * the SCTP conn STP<->MSC going down, it will send an M3UA DUNA to the IUT
+ * (HNBGW) which should then generate an N-PCSTATE.ind.
+ */
testcase TC_mscpool_sccp_n_pcstate_detaches_cnlink() runs on test_CT {
f_TC_cnpool_sccp_n_pcstate_detaches_cnlink(ps_domain := false);
}
diff --git a/hnbgw/expected-results.xml b/hnbgw/expected-results.xml
index c04876d..5563c57 100644
--- a/hnbgw/expected-results.xml
+++ b/hnbgw/expected-results.xml
@@ -51,6 +51,7 @@
<testcase classname='HNBGW_Tests'
name='TC_mscpool_paging_imsi_rai_registered' time='MASKED'/>
<testcase classname='HNBGW_Tests'
name='TC_mscpool_no_allow_attach_round_robin' time='MASKED'/>
<testcase classname='HNBGW_Tests'
name='TC_mscpool_no_allow_attach_valid_nri' time='MASKED'/>
+ <testcase classname='HNBGW_Tests'
name='TC_mscpool_sccp_n_pcstate_detaches_cnlink_sctp_down'
time='MASKED'/>
<testcase classname='HNBGW_Tests'
name='TC_mscpool_sccp_n_pcstate_detaches_cnlink' time='MASKED'/>
<testcase classname='HNBGW_Tests'
name='TC_mscpool_sccp_n_pcstate_attaches_cnlink' time='MASKED'/>
<testcase classname='HNBGW_Tests'
name='TC_sgsnpool_L3Compl_on_1_cnlink' time='MASKED'/>
@@ -59,6 +60,7 @@
<testcase classname='HNBGW_Tests'
name='TC_sgsnpool_L3Complete_valid_nri_2' time='MASKED'/>
<testcase classname='HNBGW_Tests' name='TC_sgsnpool_L3Compl_no_cn'
time='MASKED'/>
<testcase classname='HNBGW_Tests'
name='TC_sgsnpool_nri_from_other_PLMN' time='MASKED'/>
+ <testcase classname='HNBGW_Tests'
name='TC_sgsnpool_sccp_n_pcstate_detaches_cnlink_sctp_shutdown'
time='MASKED'/>
<testcase classname='HNBGW_Tests'
name='TC_sgsnpool_sccp_n_pcstate_detaches_cnlink' time='MASKED'/>
<testcase classname='HNBGW_Tests'
name='TC_sgsnpool_sccp_n_pcstate_attaches_cnlink' time='MASKED'/>
<testcase classname='HNBGW_Tests' name='TC_second_rab_assignment'
time='MASKED'/>
diff --git a/hnbgw/osmo-hnbgw.cfg b/hnbgw/osmo-hnbgw.cfg
index 423cec5..e074b15 100644
--- a/hnbgw/osmo-hnbgw.cfg
+++ b/hnbgw/osmo-hnbgw.cfg
@@ -37,13 +37,13 @@
cs7 instance 0
point-code 0.23.5
- asp asp-clnt-msc-0 2905 2906 m3ua
+ asp asp-clnt-CN-0 2905 2906 m3ua
local-ip 127.0.0.1
remote-ip 127.0.0.1
role asp
sctp-role client
- as as-clnt-msc-0 m3ua
- asp asp-clnt-msc-0
+ as as-clnt-CN m3ua
+ asp asp-clnt-CN-0
routing-key 0 0.23.5
sccp-address msc-naught
diff --git a/hnbgw/osmo-stp.cfg b/hnbgw/osmo-stp.cfg
index ba3e3d0..b70a584 100644
--- a/hnbgw/osmo-stp.cfg
+++ b/hnbgw/osmo-stp.cfg
@@ -34,6 +34,15 @@
!
cs7 instance 0
xua rkm routing-key-allocation dynamic-permitted
+ asp hnbgw0-0 2906 2905 m3ua
+ local-ip 127.0.0.1
+ remote-ip 127.0.0.1
+ role sg
+ sctp-role server
+ as hnbgw0 m3ua
+ routing-key 0 0.23.5
+ asp hnbgw0-0
+
asp virt-msc0-0 23905 2905 m3ua
local-ip 127.0.0.1
remote-ip 127.0.0.1
@@ -89,6 +98,7 @@
routing-key 6 0.1.3
route-table system
+ update route 0.23.5 7.255.7 linkset hnbgw0
update route 0.23.4 7.255.7 linkset virt-msc0
update route 0.0.2 7.255.7 linkset virt-msc1
update route 0.0.3 7.255.7 linkset virt-msc2
@@ -96,4 +106,4 @@
update route 0.1.2 7.255.7 linkset virt-sgsn1
update route 0.1.3 7.255.7 linkset virt-sgsn2
listen m3ua 2905
- accept-asp-connections dynamic-permitted
+ accept-asp-connections pre-configured
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40592?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I079f2da09ff8d52e614ff6f5d267cd5429e4eb58
Gerrit-Change-Number: 40592
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>