pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/34923?usp=email )
Change subject: sccp: Introduce test TC_cr_timeout_cc_too_late ......................................................................
sccp: Introduce test TC_cr_timeout_cc_too_late
Related: SYS#6602 Change-Id: If4b53565f1fa19894ca24fa71e02ae7b1941411e --- M library/SCCP_Templates.ttcn M sccp/SCCP_Tests_RAW.ttcn 2 files changed, 89 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/23/34923/1
diff --git a/library/SCCP_Templates.ttcn b/library/SCCP_Templates.ttcn index a87ef5c..8c89bda 100644 --- a/library/SCCP_Templates.ttcn +++ b/library/SCCP_Templates.ttcn @@ -113,6 +113,43 @@ return ret; }
+template (present) PDU_SCCP tr_SCCP_CR(template (present) OCT3 source_lref := ?, + template (present) SCCP_PAR_Address called := ?, + template (present) SCCP_PAR_Address calling := ?) := { + connrequest := { + messageType := cr, + sourceLocRef := source_lref, + protClass := c_class2, + pointer1 := ?, + pointer2 := ?, + calledPAddress := tr_Addr(called), + optionalPart := { + credit := omit, + callingPAddress := ?, //FIXME: tr_Addr(calling), + data := omit, + hopCounter := *, + importance := * + }, + eop := * + } +} + +function ts_SCCP_CC(OCT3 source_lref, OCT3 dest_lref) +return template (value) PDU_SCCP { + var template (value) PDU_SCCP ret := { + connconfirm := { + messageType := cc, + destLocRef := dest_lref, + sourceLocRef := source_lref, + protClass := c_class2, + pointer1 := 0, /* overwritten */ + optionalPart := omit, + eop := { paramName:= con_SCCP_eop } + } + } + return ret; +} + template (present) PDU_SCCP tr_SCCP_CC(template (present) OCT3 source_lref, template (present) OCT3 dest_lref) := { connconfirm := { diff --git a/sccp/SCCP_Tests_RAW.ttcn b/sccp/SCCP_Tests_RAW.ttcn index 1c81d98..935df13 100644 --- a/sccp/SCCP_Tests_RAW.ttcn +++ b/sccp/SCCP_Tests_RAW.ttcn @@ -69,6 +69,18 @@ "sccp-timer iar " & int2str(g_demo_sccp_timer_iar)}); }
+function f_vty_cmd_connect_req(integer conn_id) runs on SCCP_Test_RAW_CT { + f_vty_transceive(SCCP_DEMO_USER_VTY, "sccp-user"); + f_vty_transceive(SCCP_DEMO_USER_VTY, "connect-req " & int2str(conn_id)); + f_vty_transceive(SCCP_DEMO_USER_VTY, "end"); +} + +function f_vty_cmd_disconnect_req(integer conn_id) runs on SCCP_Test_RAW_CT { + f_vty_transceive(SCCP_DEMO_USER_VTY, "sccp-user"); + f_vty_transceive(SCCP_DEMO_USER_VTY, "disconnect-req " & int2str(conn_id)); + f_vty_transceive(SCCP_DEMO_USER_VTY, "end"); +} + private function f_init_raw(SCCP_Configuration cfg) runs on SCCP_Test_RAW_CT { g_param := { sio := { @@ -483,6 +495,35 @@ }
+/* Test user initiating a conn (eg RUA), which triggers SCCP CR. While waiting + * for CC, user decides it timed out (eg. RUA side timeout) which makes it move to + * WAIT_CONN_CONF state. In that state, wait for CC and then submit an RLSD and + * wait for ack. */ +testcase TC_cr_timeout_cc_too_late() runs on SCCP_Test_RAW_CT { + var SCCP_MTP3_TRANSFERind mtp3_rx; + var integer conn_id := 1234; + var OCT3 remote_lref; + + f_init_raw(mp_sccp_cfg[0]); + f_sleep(1.0); + + f_vty_cmd_connect_req(conn_id); + mtp3_rx := f_exp_sccp(tr_SCCP_CR(?, ?, ?)); + + /* Emulate disconnection from the user: */ + f_vty_cmd_disconnect_req(conn_id); + remote_lref := mtp3_rx.data.connrequest.sourceLocRef; + + /* Now send CC, user should send RSLD to us: */ + f_send_sccp(ts_SCCP_CC(g_own_lref, remote_lref)); + log("Waiting for RLSD"); + f_exp_sccp(tr_SCCP_RLSD(remote_lref, g_own_lref, hex2int('2A'H))); /* Cause: Unknown */ + f_send_sccp(ts_SCCP_RLC(g_own_lref, remote_lref)); + + setverdict(pass); +} + + control { execute( TC_cr_cc() ); execute( TC_udt_without_cr_cc() ); @@ -496,6 +537,7 @@ execute( TC_scmg_sst_ssn_invalid() );
execute( TC_callingparty_ssn_only() ); + execute( TC_cr_timeout_cc_too_late() ); }