Change in osmo-ttcn3-hacks[master]: WIP: second SGSN

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sat Dec 12 18:20:51 UTC 2020


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


Change subject: WIP: second SGSN
......................................................................

WIP: second SGSN

Change-Id: Ib70f7c1a29f089957f882df0e9b05ee526224611
---
M gbproxy/GBProxy_Tests.ttcn
M gbproxy/osmo-gbproxy.fr.cfg
2 files changed, 71 insertions(+), 21 deletions(-)



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

diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn
index 59154e8..7e20077 100644
--- a/gbproxy/GBProxy_Tests.ttcn
+++ b/gbproxy/GBProxy_Tests.ttcn
@@ -66,6 +66,24 @@
 					nsvci := 101
 				}
 			}
+		}, {
+			nsei := 102,
+			role_sgsn := true,
+			handle_sns := false,
+			nsvc := {
+				{
+					provider := {
+						ip := {
+							address_family := AF_INET,
+							local_udp_port := 8888,
+							local_ip := "127.0.0.1",
+							remote_udp_port := 23000,
+							remote_ip := "127.0.0.1"
+						}
+					},
+					nsvci := 102
+				}
+			}
 		}
 	};
 	/* BSS NSEI start at 2000 + x
@@ -263,7 +281,7 @@
 type record of NSConfiguration NSConfigurations;
 type record of BssgpCellId BssgpCellIds;
 
-const integer NUM_SGSN := 1;
+const integer NUM_SGSN := 2;
 
 type component test_CT {
 	var GbInstances g_pcu;
@@ -425,8 +443,25 @@
 	return false;
 }
 
+private type record of ro_integer roro_integer;
+
+/* count the number of unblocked BVCI for each SGSN NSE */
+private altstep as_count_unblocked4nse(integer sgsn_idx, inout roro_integer bvci_unblocked)
+runs on test_CT {
+	var BssgpStatusIndication bsi;
+	[] SGSN_MGMT.receive(BssgpStatusIndication:{g_sgsn[sgsn_idx].cfg.nsei, ?, BVC_S_UNBLOCKED}) -> value bsi {
+		bvci_unblocked[sgsn_idx] := bvci_unblocked[sgsn_idx] & { bsi.bvci };
+		/* 'repeat' until sufficient number of BVC-rest has been received on all SGSNs */
+		for (var integer i := 0; i < lengthof(bvci_unblocked); i := i+1) {
+			if (lengthof(bvci_unblocked[i]) < lengthof(g_sgsn[i].cfg.bvc)) {
+				repeat;
+			}
+		}
+	}
+}
+
 function f_init(float t_guard := 30.0) runs on test_CT {
-	var ro_integer bvci_unblocked := {};
+	var roro_integer bvci_unblocked;
 	var BssgpStatusIndication bsi;
 	var integer i;
 
@@ -438,17 +473,21 @@
 	g_Tguard.start(t_guard);
 	activate(as_gTguard(g_Tguard));
 
-	g_sgsn[0].cfg := {
-		nsei := mp_nsconfig_sgsn[0].nsei,
-		sgsn_role := true,
-		bvc := { }
-	}
+	var BssgpBvcConfigs bvcs := { };
 	for (i := 0; i < lengthof(mp_gbconfigs); i := i+1) {
 		g_pcu[i].cfg := mp_gbconfigs[i];
 		/* make sure all have a proper crate_cb, which cannot be specified in config file */
 		f_fix_create_cb(g_pcu[i].cfg);
 		/* concatenate all the PCU-side BVCs for the SGSN side */
-		g_sgsn[0].cfg.bvc := g_sgsn[0].cfg.bvc & g_pcu[i].cfg.bvc;
+		bvcs := bvcs & g_pcu[i].cfg.bvc;
+	}
+
+	for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) {
+		g_sgsn[i].cfg := {
+			nsei := mp_nsconfig_sgsn[i].nsei,
+			sgsn_role := true,
+			bvc := bvcs
+		}
 	}
 
 	f_init_vty();
@@ -468,16 +507,18 @@
 		f_init_gb_pcu(g_pcu[i], "GbProxy_Test", i);
 	}
 
+	for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) {
+		bvci_unblocked[i] := {};
+	}
+
 	/* wait until all BVC are unblocked on both sides */
 	timer T := 15.0;
 	T.start;
 	alt {
-	[] SGSN_MGMT.receive(BssgpStatusIndication:{*, ?, BVC_S_UNBLOCKED}) -> value bsi {
-		bvci_unblocked := bvci_unblocked & { bsi.bvci };
-		if (lengthof(bvci_unblocked) != lengthof(g_sgsn[0].cfg.bvc)) {
-			repeat;
-			}
-		}
+	/* TODO: We need to add more lines if NUM_SGSN increases.  Activating default altsteps
+	 * unfortunately doesn't work as we want to access the lcoal variable bvci_unblocked.  */
+	[] as_count_unblocked4nse(0, bvci_unblocked);
+	[lengthof(g_sgsn) > 1] as_count_unblocked4nse(1, bvci_unblocked);
 	[] SGSN_MGMT.receive(BssgpStatusIndication:{*, ?, ?}) {
 		repeat;
 		}
@@ -505,17 +546,19 @@
 
 	[] T.timeout {
 		setverdict(fail, "Timeout waiting for unblock of all BVCs on SGSN side; ",
-			   "unblocked so far: ", bvci_unblocked, "expected: ", g_sgsn[0].cfg.bvc);
+			   "unblocked so far: ", bvci_unblocked);
 		/* don't stop here but print below analysis */
 		}
 	}
 
-	/* iterate over list and check all BVCI */
-	for (i := 0; i < lengthof(g_sgsn[0].cfg.bvc); i := i+1) {
-		var BssgpBvci bvci := g_sgsn[0].cfg.bvc[i].bvci;
-		if (not ro_integer_contains(bvci_unblocked, bvci)) {
-			setverdict(fail, "BVCI=", bvci, " was not unblocked during start-up");
-			mtc.stop;
+	for (i := 0; i < lengthof(mp_nsconfig_sgsn); i := i+1) {
+		/* 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;
+			if (not ro_integer_contains(bvci_unblocked[i], bvci)) {
+				setverdict(fail, "SGSN ", i, " BVCI=", bvci, " was not unblocked during start-up");
+				mtc.stop;
+			}
 		}
 	}
 
diff --git a/gbproxy/osmo-gbproxy.fr.cfg b/gbproxy/osmo-gbproxy.fr.cfg
index 32f0e91..ebf04d5 100644
--- a/gbproxy/osmo-gbproxy.fr.cfg
+++ b/gbproxy/osmo-gbproxy.fr.cfg
@@ -22,6 +22,12 @@
  nse 101 nsvci 101 remote-ip 127.0.0.1
  nse 101 nsvci 101 remote-port 7777
 
+ nse 102 nsvci 102
+ nse 102 nsvci 102 remote-role sgsn
+ nse 102 nsvci 102 encapsulation udp
+ nse 102 nsvci 102 remote-ip 127.0.0.1
+ nse 102 nsvci 102 remote-port 8888
+
  timer tns-block 3
  timer tns-block-retries 3
  timer tns-reset 3
@@ -44,3 +50,4 @@
 
 gbproxy
  sgsn nsei 101
+ sgsn nsei 102

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21698
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: Ib70f7c1a29f089957f882df0e9b05ee526224611
Gerrit-Change-Number: 21698
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/20201212/7b2d1acc/attachment.htm>


More information about the gerrit-log mailing list