Change in osmo-ttcn3-hacks[master]: gbproxy: Generalize pcu2sgsn / sgsn2pcu transmission

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/.

daniel gerrit-no-reply at lists.osmocom.org
Mon Nov 16 19:35:52 UTC 2020


daniel has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21173 )

Change subject: gbproxy: Generalize pcu2sgsn / sgsn2pcu transmission
......................................................................

gbproxy: Generalize pcu2sgsn / sgsn2pcu transmission

This reduces code duplication between ConnHdlr test functions

Change-Id: Ic13fa745178ffddf8e35fc5203ad8d824e8f338c
---
M gbproxy/GBProxy_Tests.ttcn
1 file changed, 48 insertions(+), 28 deletions(-)

Approvals:
  Jenkins Builder: Verified
  daniel: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn
index 7d39e7c..746ee33 100644
--- a/gbproxy/GBProxy_Tests.ttcn
+++ b/gbproxy/GBProxy_Tests.ttcn
@@ -496,6 +496,51 @@
 	}
 }
 
+/* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on SGSN */
+friend function f_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx,
+			   integer pcu_idx := 0, integer sgsn_idx := 0) runs on BSSGP_ConnHdlr {
+	var PDU_BSSGP rx;
+	timer T := 1.0;
+
+	PCU[pcu_idx].send(tx);
+	T.start;
+	alt {
+	[] SGSN[sgsn_idx].receive(exp_rx) {
+		setverdict(pass);
+		}
+	[] SGSN[sgsn_idx].receive(PDU_BSSGP:?) -> value rx {
+		setverdict(fail, "Unexpected BSSGP on SGSN side: ", rx);
+		mtc.stop;
+		}
+	[] T.timeout {
+		setverdict(fail, "Timeout waiting for BSSGP on SGSN side: ", rx);
+		mtc.stop;
+		}
+	}
+}
+
+/* Send 'tx' on PTP-BVCI from SGSN; expect 'rx' on PCU */
+friend function f_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx,
+			   integer sgsn_idx:= 0, integer pcu_idx := 0) runs on BSSGP_ConnHdlr {
+	var PDU_BSSGP rx;
+	timer T := 1.0;
+
+	SGSN[sgsn_idx].send(tx);
+	T.start;
+	alt {
+	[] PCU[pcu_idx].receive(exp_rx) {
+		setverdict(pass);
+		}
+	[] PCU[pcu_idx].receive(PDU_BSSGP:?) -> value rx {
+		setverdict(fail, "Unexpected BSSGP on PCU side: ", rx);
+		mtc.stop;
+		}
+	[] T.timeout {
+		setverdict(fail, "Timeout waiting for BSSGP on PCU side: ", rx);
+		mtc.stop;
+		}
+	}
+}
 
 /* TODO:
    * Detach without Attach
@@ -576,16 +621,7 @@
 		/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
 		var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_UL_UD(g_pars.tlli, g_pars.bssgp_cell_id[0], payload);
 
-		PCU[0].send(pdu_tx);
-		alt {
-		[] SGSN[0].receive(pdu_rx);
-		/* FIXME: Those should be handled before the ConnHdlr is started */
-		[] SGSN[0].receive(BssgpStatusIndication:{*,?,BVC_S_UNBLOCKED}) { repeat; }
-		[] SGSN[0].receive {
-			setverdict(fail, "SGSN Received unexpected");
-			mtc.stop;
-			}
-		}
+		f_pcu2sgsn(pdu_tx, pdu_rx);
 	}
 	setverdict(pass);
 }
@@ -614,16 +650,7 @@
 		var template (present) PDU_BSSGP pdu_rx :=
 			tr_BSSGP_DL_UD(g_pars.tlli, payload, tr_BSSGP_IMSI(g_pars.imsi));
 
-		SGSN[0].send(pdu_tx);
-		alt {
-		[] PCU[0].receive(pdu_rx);
-		/* FIXME: Those should be handled before the ConnHdlr is started */
-		[] PCU[0].receive(BssgpStatusIndication:{*,?,BVC_S_UNBLOCKED}) { repeat; }
-		[] PCU[0].receive {
-			setverdict(fail, "PCU Received unexpected");
-			mtc.stop;
-			}
-		}
+		f_sgsn2pcu(pdu_tx, pdu_rx);
 	}
 	setverdict(pass);
 }
@@ -648,14 +675,7 @@
 		/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
 		var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RA_CAP(g_pars.tlli, { tr_RaCapRec_BSSGP })
 
-		SGSN[0].send(pdu_tx);
-		alt {
-		[] PCU[0].receive(pdu_rx);
-		[] PCU[0].receive {
-			setverdict(fail, "SGSN Received unexpected");
-			mtc.stop;
-			}
-		}
+		f_sgsn2pcu(pdu_tx, pdu_rx);
 	}
 	setverdict(pass);
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21173
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: Ic13fa745178ffddf8e35fc5203ad8d824e8f338c
Gerrit-Change-Number: 21173
Gerrit-PatchSet: 4
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201116/b9250283/attachment.htm>


More information about the gerrit-log mailing list