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

Change subject: gbproxy: Test case for BVC flow control procedure
......................................................................

gbproxy: Test case for BVC flow control procedure

Related: OS#4891
Change-Id: I6daa5848bd59b42f152de783bfdc602d1f2da861
---
M gbproxy/GBProxy_Tests.ttcn
1 file changed, 71 insertions(+), 0 deletions(-)

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



diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn
index 9bd0550..5e81c13 100644
--- a/gbproxy/GBProxy_Tests.ttcn
+++ b/gbproxy/GBProxy_Tests.ttcn
@@ -726,6 +726,7 @@
        port BSSGP_PT G_SGSN[NUM_SGSN];
 };

+/* connect the signaling BVC of each NSE to the G_PCU / G_SGSN ports */
 private function f_global_init() runs on GlobalTest_CT {
        var integer i;
        for (i := 0; i < lengthof(g_sgsn); i := i+1) {
@@ -736,6 +737,17 @@
        }
 }

+/* connect the first PTP BVC of each NSE to the G_PCU / G_SGSN ports */
+private function f_global_init_ptp() runs on GlobalTest_CT {
+       var integer i;
+       for (i := 0; i < lengthof(g_sgsn); i := i+1) {
+               connect(self:G_SGSN[i], g_sgsn[i].vc_BSSGP_BVC[0]:GLOBAL);
+       }
+       for (i := 0; i < lengthof(g_pcu); i := i+1) {
+               connect(self:G_PCU[i], g_pcu[i].vc_BSSGP_BVC[0]:GLOBAL);
+       }
+}
+
 /* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on SGSN */
 friend function f_global_pcu2sgsn(template (value) PDU_BSSGP tx, template 
(present) PDU_BSSGP exp_rx,
                                  integer pcu_idx := 0, integer sgsn_idx := 0) 
runs on GlobalTest_CT {
@@ -2324,6 +2336,64 @@
        f_cleanup();
 }

+/***********************************************************************
+ * FLOW-CONTROL-BVC procedure
+ ***********************************************************************/
+
+private altstep as_g_count_sgsn(integer sgsn_idx, inout ro_integer roi,
+                                template PDU_BSSGP exp_rx, template (omit) 
PDU_BSSGP tx_reply)
+runs on GlobalTest_CT {
+       [] G_SGSN[sgsn_idx].receive(exp_rx) {
+               roi := roi & { sgsn_idx };
+               if (ispresent(tx_reply)) {
+                       G_SGSN[sgsn_idx].send(tx_reply);
+               }
+       }
+}
+/* Send FC-BVC from simulated PCU; expect each SGSN to receive it; expect PCU 
to receive ACK */
+testcase TC_fc_bvc() runs on GlobalTest_CT
+{
+       f_init();
+       f_global_init_ptp();
+
+       var template (value) PDU_BSSGP pdu_tx := t_BVC_FC_BVC(10240, 2000, 
1024, 1000, '01'O);
+       /* we cannot use pdu_tx as there are some subtle differences in the 
length field :/ */
+       var template (present) PDU_BSSGP pdu_rx := tr_BVC_FC_BVC(10240, 2000, 
1024, 1000, '01'O);
+       var template (omit) PDU_BSSGP ack_tx :=
+               
t_BVC_FC_BVC_ACK(pdu_tx.pDU_BSSGP_FLOW_CONTROL_BVC.tag.unstructured_Value);
+
+       /* Send a FC-BVC from BSS to gbproxy, expect an ACK in response */
+       G_PCU[0].send(pdu_tx);
+
+       /* Activate altsteps: One for each SGSN-side PTP BVC port */
+       var ro_default defaults := {};
+       for (var integer i := 0; i < lengthof(g_sgsn); i := i+1) {
+               var default d := activate(as_g_count_sgsn(i, g_roi, pdu_rx, 
ack_tx));
+               defaults := defaults & { d };
+       }
+
+       f_sleep(3.0);
+
+       for (var integer i := 0; i < lengthof(defaults); i := i+1) {
+               deactivate(defaults[i]);
+       }
+
+       /* check if BVC-block was received on all expected BVC */
+       for (var integer i := 0; i < lengthof(g_sgsn); i := i+1) {
+               if (not ro_integer_contains(g_roi, i)) {
+                       setverdict(fail, "Missing BVC-FLOW-CONTROL on SGSN 
index ", i);
+               }
+       }
+
+       /* Expect ACK on PCU side */
+       G_PCU[0].receive(ack_tx);
+
+       setverdict(pass);
+
+       f_cleanup();
+}
+
+
 control {
        execute( TC_BVC_bringup() );
        execute( TC_ul_unitdata() );
@@ -2385,6 +2455,7 @@


        execute( TC_flush_ll() );
+       execute( TC_fc_bvc() );
 }



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21634
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: I6daa5848bd59b42f152de783bfdc602d1f2da861
Gerrit-Change-Number: 21634
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to