fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42493?usp=email )
Change subject: s1gw: f_ConnHdlr_pfcp_assoc_handler(): handle already-connected case
......................................................................
s1gw: f_ConnHdlr_pfcp_assoc_handler(): handle already-connected case
Previously, f_pfcp_assoc() would skip spawning a connection handler
entirely if the IUT was already PFCP-associated. This was fine for
tests that only need an association to be present, but upcoming PFCP
Heartbeat test cases need the emulation's Recovery Timestamp to be
synced with what the IUT has stored, even when re-using an existing
association.
Move the state check into f_ConnHdlr_pfcp_assoc_handler(): if the
IUT is already connected, sync PFCPEM's Recovery Timestamp to the
value the IUT remembers (rrts); otherwise perform the full Association
Setup as before. Remove the now-redundant g_pfcp_assoc component
variable from test_CT - it's not accessible by ConnHdlr(s) anyway.
Change-Id: Id9d2ebb1ddb3d3896dd24e2a37e9d21335441d52
---
M s1gw/S1GW_ConnHdlr.ttcn
M s1gw/S1GW_Tests.ttcn
2 files changed, 19 insertions(+), 12 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/93/42493/1
diff --git a/s1gw/S1GW_ConnHdlr.ttcn b/s1gw/S1GW_ConnHdlr.ttcn
index fd171d3..297eccd 100644
--- a/s1gw/S1GW_ConnHdlr.ttcn
+++ b/s1gw/S1GW_ConnHdlr.ttcn
@@ -39,6 +39,9 @@
import from HTTP_Adapter all;
import from HTTPmsg_Types all;
+import from S1GW_REST_Types all;
+import from S1GW_REST_Functions all;
+
import from StatsD_Types all;
import from StatsD_Checker all;
@@ -434,7 +437,17 @@
function f_ConnHdlr_pfcp_assoc_handler(charstring id)
runs on ConnHdlr {
- f_ConnHdlr_pfcp_assoc_setup();
+ var PfcpAssocInfo assoc_info := f_REST_PfcpAssocState();
+
+ if (assoc_info.state == connected) {
+ /* IUT already connected: sync PFCPEM's RTS to match what IUT remembers */
+ f_PFCPEM_set_recovery_timestamp(assoc_info.rrts);
+ } else {
+ /* IUT is not connected: perform the Association Setup procedure */
+ log("Waiting for IUT to associate over PFCP");
+ f_ConnHdlr_pfcp_assoc_setup();
+ }
+
setverdict(pass);
}
diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn
index f86546c..121d717 100644
--- a/s1gw/S1GW_Tests.ttcn
+++ b/s1gw/S1GW_Tests.ttcn
@@ -76,7 +76,6 @@
var S1AP_ServerList vc_S1APSRVs := {};
var PFCP_Emulation_CT vc_PFCP;
var StatsD_Checker_CT vc_STATSD;
- var PfcpAssocInfo g_pfcp_assoc;
};
private altstep as_Tguard() runs on test_CT {
@@ -141,16 +140,11 @@
var verdicttype verdict;
var ConnHdlr vc_conn;
- g_pfcp_assoc := f_REST_PfcpAssocState();
- if (g_pfcp_assoc.state != connected) {
- log("Waiting for IUT to associate over PFCP");
- vc_conn := f_ConnHdlr_spawn(refers(f_ConnHdlr_pfcp_assoc_handler),
- pars := valueof(t_ConnHdlrPars));
- vc_conn.done -> value verdict;
- if (verdict != pass) {
- Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
- }
- g_pfcp_assoc := f_REST_PfcpAssocState();
+ vc_conn := f_ConnHdlr_spawn(refers(f_ConnHdlr_pfcp_assoc_handler),
+ pars := valueof(t_ConnHdlrPars));
+ vc_conn.done -> value verdict;
+ if (verdict != pass) {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
}
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42493?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: Id9d2ebb1ddb3d3896dd24e2a37e9d21335441d52
Gerrit-Change-Number: 42493
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42494?usp=email )
Change subject: s1gw: TC_pfcp_heartbeat: validate RTS in Heartbeat Response
......................................................................
s1gw: TC_pfcp_heartbeat: validate RTS in Heartbeat Response
The test case had a TODO noting that the Recovery Timestamp in the
Heartbeat Response was not yet validated. Let's get this resolved:
query the IUT's PFCP association state via REST to obtain its local
Recovery Timestamp (lrts), and verify that the IUT echoes back that
same value in the Heartbeat Response.
Change-Id: I000cc82e7582baded96a33cb0da2103906972ff9
---
M s1gw/S1GW_Tests.ttcn
1 file changed, 22 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/94/42494/1
diff --git a/s1gw/S1GW_Tests.ttcn b/s1gw/S1GW_Tests.ttcn
index 121d717..38a5e7d 100644
--- a/s1gw/S1GW_Tests.ttcn
+++ b/s1gw/S1GW_Tests.ttcn
@@ -1030,16 +1030,33 @@
function f_TC_pfcp_heartbeat(charstring id) runs on ConnHdlr {
var integer rts := f_PFCPEM_get_recovery_timestamp();
+ var PfcpAssocInfo assoc_info;
var PDU_PFCP pfcp_pdu;
+ timer T;
+
+ /* Query IUT's PFCP assoc state via REST to get its RTS:
+ * assoc_info.lrts - IUT's RTS,
+ * assoc_info.rrts - PFCPEM's RTS */
+ assoc_info := f_REST_PfcpAssocState();
/* Tx Heartbeat Request */
PFCP.send(ts_PFCP_Heartbeat_Req(rts));
- /* Expect Heartbeat Response
- * TODO: validate the indicated Recovery Time Stamp against
- * the one that we received in the PFCP Association Setup. */
- pfcp_pdu := f_ConnHdlr_pfcp_expect(tr_PFCP_Heartbeat_Resp);
- setverdict(pass);
+ /* Expect Heartbeat Resp with RTS that we learned from the Association Setup Req */
+ T.start(2.0);
+ alt {
+ [] PFCP.receive(tr_PFCP_Heartbeat_Resp(assoc_info.lrts)) {
+ setverdict(pass);
+ }
+ [] PFCP.receive(tr_PFCP_Heartbeat_Resp) -> value pfcp_pdu {
+ setverdict(fail, "Rx Heartbeat Response with unexpected RTS: ", pfcp_pdu);
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
+ [] T.timeout {
+ setverdict(fail, "Timeout waiting for Heartbeat Response");
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__);
+ }
+ }
}
testcase TC_pfcp_heartbeat() runs on test_CT {
f_TC_exec(refers(f_TC_pfcp_heartbeat));
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42494?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: I000cc82e7582baded96a33cb0da2103906972ff9
Gerrit-Change-Number: 42494
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>