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

Change subject: PCU_Tests_SNS: improve SGSN originated BVC-RESETs
......................................................................

PCU_Tests_SNS: improve SGSN originated BVC-RESETs

The BVC-RESETs are a little bit more complicated. The PCU will send
a BVC-RESET after the NSE become available.
Ensure the RESET is received and ignored so there is no race condition
if both sides send a BVC-RESET at the same time.

The test case TC_sns_1c1u_so_bvc_reset is still failing because the PCU can't
handle BVC-RESETs properly (both PTP and signalling).

Change-Id: Id681749d75073c1d50a4b0a2e86f0a2dd0955b45
---
M library/RAW_NS.ttcn
M pcu/PCU_Tests_SNS.ttcn
2 files changed, 32 insertions(+), 6 deletions(-)

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



diff --git a/library/RAW_NS.ttcn b/library/RAW_NS.ttcn
index 8540f38..7f7b6c4 100644
--- a/library/RAW_NS.ttcn
+++ b/library/RAW_NS.ttcn
@@ -68,16 +68,23 @@

 }

-function f_ns_exp(template PDU_NS exp_rx, integer idx := 0) runs on RAW_NS_CT 
return PDU_NS {
+public altstep ax_rx_fail_on_any_ns(integer idx := 0) runs on RAW_NS_CT {
        var NS_RecvFrom nrf;
-       log("f_ns_exp() expecting ", exp_rx);
-       alt {
-       [] NSCP[idx].receive(t_NS_RecvFrom(exp_rx)) -> value nrf { }
        [] NSCP[idx].receive(t_NS_RecvFrom(?)) -> value nrf {
                setverdict(fail, "Received unexpected NS: ", nrf);
                mtc.stop;
                }
+}
+
+function f_ns_exp(template PDU_NS exp_rx, integer idx := 0) runs on RAW_NS_CT 
return PDU_NS {
+       var NS_RecvFrom nrf;
+       log("f_ns_exp() expecting ", exp_rx);
+       /* last activated altstep has the lowest priority */
+       var default d := activate(ax_rx_fail_on_any_ns());
+       alt {
+       [] NSCP[idx].receive(t_NS_RecvFrom(exp_rx)) -> value nrf { }
        }
+       deactivate(d);
        return nrf.msg;
 }

diff --git a/pcu/PCU_Tests_SNS.ttcn b/pcu/PCU_Tests_SNS.ttcn
index aed363b..ea78761 100644
--- a/pcu/PCU_Tests_SNS.ttcn
+++ b/pcu/PCU_Tests_SNS.ttcn
@@ -297,11 +297,21 @@
        f_outgoing_ns_alive(1);

        if (sgsn_originated_reset) {
+               /* Expect BVC-RESET, but ignore it to prevent a race condition 
of BVC RESETs */
+               var template PDU_NS pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, 
decmatch tr_BVC_RESET(?, 0, omit));
+               f_ns_exp(pdu);
+               /* SGSN originated BVC-RESET on an uninitialized signalling BVC 
*/
                f_tx_bvc_reset_rx_ack(0, omit, omit);
+
+               /* Expect BVC-RESET PTP BVC, but ignore it to prevent a race 
condition of BVC RESETs */
+               pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, 
mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id));
+               f_ns_exp(pdu);
+               /* SGSN originated BVC-RESET on an uninitialized PTP BVC */
                f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, omit, 
mp_gb_cfg.bvc[0].cell_id);
        } else {
-               /* Expect BVC-RESET for signaling (0) and ptp BVCI */
+               /* Expect BVC-RESET for signaling BVCI=0 */
                as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true);
+               /* Expect BVC-RESET from the PCU on PTP BVC */
                as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, 
mp_gb_cfg.bvc[0].cell_id, omit, oneshot := true);
        }
        /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==0) */
@@ -347,11 +357,20 @@
        f_outgoing_ns_alive_no_ack(idx := 0);

        if (sgsn_originated_reset) {
+               /* Expect BVC-RESET, but ignore it to prevent a race condition 
of BVC RESETs */
+               var template PDU_NS pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, 
decmatch tr_BVC_RESET(?, 0, omit));
+               f_ns_exp(pdu, idx := 1);
+               /* SGSN originated BVC-RESET on an uninitialized sign BVC */
                f_tx_bvc_reset_rx_ack(0, omit, omit, idx := 1);
+
+               /* Expect BVC-RESET PTP BVC, but ignore it to prevent a race 
condition of BVC RESETs */
+               pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, 
mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id));
+               f_ns_exp(pdu, idx := 1);
                f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, omit, 
mp_gb_cfg.bvc[0].cell_id, idx := 1);
        } else {
-               /* Expect BVC-RESET for signaling BVCI=0 and ptp BVCI */
+               /* Expect BVC-RESET for signaling BVCI=0 */
                as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true, idx := 
1);
+               /* Expect BVC-RESET from the PCU on PTP BVC */
                as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, 
mp_gb_cfg.bvc[0].cell_id, omit, oneshot := true, idx := 1);
        }
        /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==1) */

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20923
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: Id681749d75073c1d50a4b0a2e86f0a2dd0955b45
Gerrit-Change-Number: 20923
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to