Change in osmo-ttcn3-hacks[master]: gbproxy: Verify BVC FSM state during bring-up

laforge gerrit-no-reply at lists.osmocom.org
Tue Mar 30 14:33:59 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23555 )


Change subject: gbproxy: Verify BVC FSM state during bring-up
......................................................................

gbproxy: Verify BVC FSM state during bring-up

This adds IUT fsm state instrospection via the CTRL interface.

docker-playground will need to set "mp_gbproxy_ip" in its configs.

Change-Id: I272e43b9be8ba53d8a815e8ab099c939f63413a7
---
M gbproxy/GBProxy_Tests.ttcn
M library/Osmocom_Types.ttcn
2 files changed, 40 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/55/23555/1

diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn
index 91ccbb0..d3c6df6 100644
--- a/gbproxy/GBProxy_Tests.ttcn
+++ b/gbproxy/GBProxy_Tests.ttcn
@@ -33,6 +33,7 @@
 
 import from TELNETasp_PortType all;
 import from Osmocom_VTY_Functions all;
+import from Osmocom_CTRL_Adapter all;
 
 import from LLC_Types all;
 import from LLC_Templates all;
@@ -46,6 +47,8 @@
 const integer max_fr_info_size := 1600;
 
 modulepar {
+	charstring mp_gbproxy_ip := "127.0.0.1";
+	integer mp_gbproxy_ctrl_port := 4263;
 	/* NRI bit-length. 0 for no pooling */
 	integer mp_nri_bitlength := 5;
 	roro_integer mp_sgsn_nri := {
@@ -330,7 +333,7 @@
  * tests that use interleave on SGSN_MGMT.receive() for each SGSN NSEI for example */
 const integer NUM_SGSN := 2;
 
-type component test_CT {
+type component test_CT extends CTRL_Adapter_CT {
 	var GbInstances g_pcu;
 	var GbInstances g_sgsn;
 
@@ -516,6 +519,14 @@
 	}
 }
 
+private template (value) charstring ts_pcu_bvc_fsm_id(uint16_t nsei, uint16_t bvci) :=
+	"NSE" & f_int2str(nsei, 5) & "-BVC" & f_int2str(bvci, 5);
+
+function f_bvc_fsm_ensure_state(uint16_t nsei, uint16_t bvci, template (present) charstring exp)
+runs on CTRL_Adapter_CT {
+	f_ctrl_get_exp_inst_state(IPA_CTRL, "BSSGP-BVC", ts_pcu_bvc_fsm_id(nsei, bvci), exp);
+}
+
 function f_init(float t_guard := 30.0) runs on test_CT {
 	var roro_integer bvci_unblocked;
 	var BssgpStatusIndication bsi;
@@ -529,6 +540,8 @@
 	g_Tguard.start(t_guard);
 	activate(as_gTguard(g_Tguard));
 
+	f_ipa_ctrl_start_client(mp_gbproxy_ip, mp_gbproxy_ctrl_port);
+
 	var BssgpBvcConfigs bvcs := { };
 	for (i := 0; i < lengthof(mp_gbconfigs); i := i+1) {
 		g_pcu[i].cfg := mp_gbconfigs[i];
@@ -616,6 +629,25 @@
 		}
 	}
 
+	/* verify all SGSN-side BVC FSM in IUT are UNBLOCKED */
+	for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) {
+		f_bvc_fsm_ensure_state(mp_nsconfig_sgsn[i].nsei, 0, "UNBLOCKED");
+		/* iterate over list and check all BVCI */
+		for (var integer j := 0; j < lengthof(g_sgsn[i].cfg.bvc); j := j+1) {
+			var BssgpBvci bvci := g_sgsn[i].cfg.bvc[j].bvci;
+			f_bvc_fsm_ensure_state(mp_nsconfig_sgsn[i].nsei, bvci, "UNBLOCKED");
+		}
+	}
+	/* verify all PCU-side BVC FSM in IUT are UNBLOCKED */
+	for (i := 0; i < lengthof(mp_nsconfig_pcu); i := i+1) {
+		f_bvc_fsm_ensure_state(mp_nsconfig_pcu[i].nsei, 0, "UNBLOCKED");
+		/* iterate over list and check all BVCI */
+		for (var integer j := 0; j < lengthof(g_pcu[i].cfg.bvc); j := j+1) {
+			var BssgpBvci bvci := g_pcu[i].cfg.bvc[j].bvci;
+			f_bvc_fsm_ensure_state(mp_nsconfig_pcu[i].nsei, bvci, "UNBLOCKED");
+		}
+	}
+
 	/* re-start guard timer after all BVCs are up, so it only counts the actual test case */
 	g_Tguard.start(t_guard);
 }
diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
index 23f8fd9..3c0137c 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -51,6 +51,13 @@
 	AF_INET6	('0a'O)
 }
 
+/* like TTCN-3 int2str() but with padding of leading zeroes */
+function f_int2str(integer i, integer total_digits) return charstring {
+	var charstring istr := int2str(i);
+	var charstring padstr := hex2str(int2hex(0, total_digits - lengthof(istr)));
+	return padstr & istr;
+}
+
 /* return random integer 0 <= ret < max. According to ETSI ES 201 873 C.6.1, rnd() returns *less* than 1, so
 	* the returned int will always be ret < max, or ret <= (max-1). */
 function f_rnd_int(integer max) return integer {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23555
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I272e43b9be8ba53d8a815e8ab099c939f63413a7
Gerrit-Change-Number: 23555
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210330/ca04c456/attachment.htm>


More information about the gerrit-log mailing list