From 64d0731c5b6cc8b5696957f5b01ea15f71c9aac2 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 20 Mar 2019 09:48:39 +0100 Subject: pcu: Add SNS tests for SGSN-originated BVC-RESET handling Change-Id: Ib6b80acf98711f4749da4faf549b02ff2b82425f --- pcu/PCU_Tests_RAW.ttcn | 23 +++++++++++++++++ pcu/PCU_Tests_RAW_SNS.ttcn | 61 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn index a30829e5..6022d365 100644 --- a/pcu/PCU_Tests_RAW.ttcn +++ b/pcu/PCU_Tests_RAW.ttcn @@ -172,6 +172,29 @@ altstep as_rx_alive_tx_ack(boolean oneshot := false, integer idx := 0) runs on R } } +/* Transmit BSSGP RESET for given BVCI and expect ACK */ +function f_tx_bvc_reset_rx_ack(BssgpBvci bvci, integer idx := 0, boolean exp_ack := true) +runs on RAW_NS_CT { + var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET(BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS, bvci, + mp_gb_cfg.cell_id)); + timer T := 5.0; + NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)))); + T.start; + alt { + [exp_ack] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_UNITDATA(t_SduCtrlB, 0, + decmatch tr_BVC_RESET_ACK(bvci, ?)))) { + setverdict(pass); + } + [exp_ack] T.timeout { + setverdict(fail, "No response to BVC-RESET"); + } + [not exp_ack] T.timeout { + setverdict(pass); + } + [] NSCP[idx].receive { repeat; } + } +} + /* Receive a BSSGP RESET for given BVCI and ACK it */ altstep as_rx_bvc_reset_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT { var NS_RecvFrom ns_rf; diff --git a/pcu/PCU_Tests_RAW_SNS.ttcn b/pcu/PCU_Tests_RAW_SNS.ttcn index 7f71744f..7513196c 100644 --- a/pcu/PCU_Tests_RAW_SNS.ttcn +++ b/pcu/PCU_Tests_RAW_SNS.ttcn @@ -186,7 +186,7 @@ testcase TC_sns_so_config_success() runs on RAW_Test_CT { setverdict(pass); } -private function f_sns_bringup_1c1u() runs on RAW_Test_CT { +private function f_sns_bringup_1c1u(boolean sgsn_originated_reset := false) runs on RAW_Test_CT { /* Activate two NS codec ports */ f_init_ns_codec(); f_init_ns_codec(1); @@ -208,9 +208,14 @@ private function f_sns_bringup_1c1u() runs on RAW_Test_CT { f_outgoing_ns_alive(0); f_outgoing_ns_alive(1); - /* Expect BVC-RESET for signaling (0) and ptp BVCI */ - as_rx_bvc_reset_tx_ack(0, oneshot := true); - as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvci, oneshot := true); + if (sgsn_originated_reset) { + f_tx_bvc_reset_rx_ack(0); + f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvci); + } else { + /* Expect BVC-RESET for signaling (0) and ptp BVCI */ + as_rx_bvc_reset_tx_ack(0, oneshot := true); + as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvci, oneshot := true); + } /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==0) */ as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvci, oneshot := true); @@ -226,7 +231,7 @@ testcase TC_sns_1c1u() runs on RAW_Test_CT { setverdict(pass); } -private function f_sns_bringup_1c1u_separate() runs on RAW_Test_CT { +private function f_sns_bringup_1c1u_separate(boolean sgsn_originated_reset := false) runs on RAW_Test_CT { /* Activate two NS codec ports */ f_init_ns_codec(); f_init_ns_codec(1); @@ -253,9 +258,14 @@ private function f_sns_bringup_1c1u_separate() runs on RAW_Test_CT { /* ensure there's no response to NS-ALIVE sent on idx==0 */ f_outgoing_ns_alive_no_ack(idx := 0); - /* Expect BVC-RESET for signaling BVCI=0 and ptp BVCI */ - as_rx_bvc_reset_tx_ack(0, oneshot := true, idx := 1); - as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvci, oneshot := true, idx := 1); + if (sgsn_originated_reset) { + f_tx_bvc_reset_rx_ack(0, idx := 1); + f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvci, idx := 1); + } else { + /* Expect BVC-RESET for signaling BVCI=0 and ptp BVCI */ + as_rx_bvc_reset_tx_ack(0, oneshot := true, idx := 1); + as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvci, oneshot := true, idx := 1); + } /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==1) */ as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvci, oneshot := true, idx := 1); @@ -272,6 +282,39 @@ testcase TC_sns_1c1u_separate() runs on RAW_Test_CT { setverdict(pass); } +/* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only and use + * SGSN-originated BVC-RESET rather than BSS-originated */ +testcase TC_sns_1c1u_so_bvc_reset() runs on RAW_Test_CT { + f_sns_bringup_1c1u_separate(sgsn_originated_reset := true); + setverdict(pass); +} + +/* Transmit BVC-RESET before NS-ALIVE of PCU was ACKed: expect no response */ +testcase TC_sns_1c1u_so_bvc_reset_too_early() runs on RAW_Test_CT { + /* Activate two NS codec ports */ + f_init_ns_codec(); + f_init_ns_codec(1); + f_init_ns_codec(2); + f_init_pcuif(); + /* Perform Size + BSS-originated config */ + f_incoming_sns_size(); + f_incoming_sns_config(); + /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */ + f_outgoing_sns_config_1c1u_separate(); + + /* DON'T ACK ANY INBOUND NS-ALIVE HERE! */ + + /* perform outgoing ALIVE procedure for both NS-VCs */ + f_outgoing_ns_alive(1); + f_outgoing_ns_alive(2); + /* ensure there's no response to NS-ALIVE sent on idx==0 */ + f_outgoing_ns_alive_no_ack(idx := 0); + + /* Transmit BVC-RESET and expect no ACK*/ + f_tx_bvc_reset_rx_ack(0, idx := 1, exp_ack := false); + f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvci, idx := 1, exp_ack := false); +} + /* Test adding new IP endpoints at runtime */ testcase TC_sns_add() runs on RAW_Test_CT { f_sns_bringup_1c1u(); @@ -343,6 +386,8 @@ control { execute( TC_sns_so_config_success() ); execute( TC_sns_1c1u() ); execute( TC_sns_1c1u_separate() ); + execute( TC_sns_1c1u_so_bvc_reset() ); + execute( TC_sns_1c1u_so_bvc_reset_too_early() ); execute( TC_sns_add() ); execute( TC_sns_del() ); execute( TC_sns_chg_weight() ); -- cgit v1.2.3