From 195c9e70c2f15f40e9cfe53ed05108179b68338d Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Mon, 26 Oct 2020 23:09:16 +0100 Subject: [PATCH] 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 --- library/RAW_NS.ttcn | 15 +++++++++++---- pcu/PCU_Tests_SNS.ttcn | 23 +++++++++++++++++++++-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/library/RAW_NS.ttcn b/library/RAW_NS.ttcn index 8540f38d7..7f7b6c4e9 100644 --- a/library/RAW_NS.ttcn +++ b/library/RAW_NS.ttcn @@ -68,16 +68,23 @@ function f_init_ns_codec(NSConfiguration ns_config, integer idx := 0, float guar } -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 aed363bd4..ea787611b 100644 --- a/pcu/PCU_Tests_SNS.ttcn +++ b/pcu/PCU_Tests_SNS.ttcn @@ -297,11 +297,21 @@ private function f_sns_bringup_1c1u(boolean sgsn_originated_reset := false) runs 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 @@ private function f_sns_bringup_1c1u_separate(boolean sgsn_originated_reset := fa 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) */