aboutsummaryrefslogtreecommitdiffstats
path: root/sccp/SCCP_Tests_RAW.ttcn
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-01-20 13:20:58 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-01-20 20:15:26 +0100
commita2473da68352be2209e8e764606737ac9576950f (patch)
treeff15ad77c954abf83b5b908f53132c49e4d94cb3 /sccp/SCCP_Tests_RAW.ttcn
parent94b7a68f76227c96a7ba94c11ae3c9559a9b65f6 (diff)
sccp: Introduce test TC_tiar_timeout
Existing templates are moved to SCPP_Templates.ttcn and new ones required for the test are added there. Related: OS#4343 Change-Id: I7b56fe77ac3b350d722c74b043e6ecabc48dcf31
Diffstat (limited to 'sccp/SCCP_Tests_RAW.ttcn')
-rw-r--r--sccp/SCCP_Tests_RAW.ttcn124
1 files changed, 74 insertions, 50 deletions
diff --git a/sccp/SCCP_Tests_RAW.ttcn b/sccp/SCCP_Tests_RAW.ttcn
index 3d167069..03ef4af4 100644
--- a/sccp/SCCP_Tests_RAW.ttcn
+++ b/sccp/SCCP_Tests_RAW.ttcn
@@ -38,6 +38,33 @@ type component SCCP_Test_RAW_CT {
port SCCP_CODEC_PT MTP3;
var MSC_SCCP_MTP3_parameters g_param;
+
+ /*Configure T(tias) over VTY, seconds */
+ var integer g_demo_sccp_timer_ias := 7 * 60;
+ /*Configure T(tiar) over VTY, seconds */
+ var integer g_demo_sccp_timer_iar := 15 * 60;
+}
+
+type record of charstring Commands;
+private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {})
+{
+ f_vty_enter_cfg_cs7_inst(pt, 0);
+ for (var integer i := 0; i < sizeof(cmds); i := i+1) {
+ f_vty_transceive(pt, cmds[i]);
+ }
+ f_vty_transceive(pt, "end");
+}
+
+function f_init_vty() runs on SCCP_Test_RAW_CT {
+ if (SCCP_DEMO_USER_VTY.checkstate("Mapped")) {
+ /* skip initialization if already executed once */
+ return;
+ }
+ map(self:SCCP_DEMO_USER_VTY, system:SCCP_DEMO_USER_VTY);
+ f_vty_set_prompts(SCCP_DEMO_USER_VTY);
+ f_vty_transceive(SCCP_DEMO_USER_VTY, "enable");
+ f_cs7_inst_0_cfg(SCCP_DEMO_USER_VTY, {"sccp-timer ias " & int2str(g_demo_sccp_timer_ias),
+ "sccp-timer iar " & int2str(g_demo_sccp_timer_iar)});
}
private function f_init_raw(SCCP_Configuration cfg) runs on SCCP_Test_RAW_CT {
@@ -54,9 +81,7 @@ private function f_init_raw(SCCP_Configuration cfg) runs on SCCP_Test_RAW_CT {
ssn := cfg.own_ssn
};
- map(self:SCCP_DEMO_USER_VTY, system:SCCP_DEMO_USER_VTY);
- f_vty_set_prompts(SCCP_DEMO_USER_VTY);
- f_vty_transceive(SCCP_DEMO_USER_VTY, "enable");
+ f_init_vty();
/* Create and connect test components */
vc_M3UA := M3UA_CT.create;
@@ -73,51 +98,6 @@ private function f_cleanup() runs on SCCP_Test_RAW_CT {
self.stop
}
-/* connection oriented SCCP */
-const SCCP_param_ProtocolClass c_class2 := { class:='0010'B, messageHandling:='0000'B };//class 2
-
-function ts_SCCP_CR(OCT3 source_lref, SCCP_PAR_Address calling, SCCP_PAR_Address called)
-return template (value) PDU_SCCP {
- var SCCP_param_CPartyAddressEnc calling_enc := ConvertASPAddressToEncodedAddress_itu(calling);
-
- var template (value) PDU_SCCP ret := {
- connrequest := {
- messageType := cr,
- sourceLocRef := source_lref,
- protClass := c_class2,
- pointer1 := 2,
- pointer2 := 0, /* overwritten */
- calledPAddress := ConvertASPAddressToEncodedAddress_itu(called),
- optionalPart := {
- credit := omit,
- callingPAddress := {
- paramName := con_SCCP_cgPA,
- paramLength := calling_enc.paramLength, /* overwritten */
- addr := calling_enc.addr
- },
- data := omit,
- hopCounter := omit,
- importance := omit
- },
- eop := { paramName:= con_SCCP_eop }
- }
- }
- return ret;
-}
-
-template (present) PDU_SCCP tr_SCCP_CC(template (present) OCT3 dest_lref,
- template (present) OCT3 source_lref) := {
- connconfirm := {
- messageType := cc,
- destLocRef := dest_lref,
- sourceLocRef := source_lref,
- protClass := c_class2,
- pointer1 := ?,
- optionalPart := *,
- eop := *
- }
-}
-
private function f_send_sccp(template PDU_SCCP sccp) runs on SCCP_Test_RAW_CT {
var SCCP_MTP3_TRANSFERreq tx := {
sio := g_param.sio,
@@ -155,21 +135,65 @@ private function f_exp_sccp(template PDU_SCCP sccp) runs on SCCP_Test_RAW_CT {
}
}
+private function f_establish_conn(SCCP_PAR_Address calling, SCCP_PAR_Address called) runs on SCCP_Test_RAW_CT {
+
+ f_send_sccp(ts_SCCP_CR('000001'O, calling, called));
+ f_exp_sccp(tr_SCCP_CC('000000'O, '000001'O));
+}
+
+private function f_tx_udt_exp(SCCP_PAR_Address calling, SCCP_PAR_Address called, octetstring data) runs on SCCP_Test_RAW_CT {
+
+ f_send_sccp(ts_SCCP_UDT(calling, called, data));
+ f_exp_sccp(tr_SCCP_UDT(called, calling, data));
+}
+
/* Verify sccp_demo_user answers a CR with a CC for PC and SSN set up to echo back */
testcase TC_cr_cc() runs on SCCP_Test_RAW_CT {
var SCCP_PAR_Address calling, called;
+
+ f_init_raw(mp_sccp_cfg[0]);
+ f_sleep(1.0);
+
called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, mp_sccp_cfg[0].peer_ssn,
mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, mp_sccp_cfg[0].own_ssn,
mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
+ f_establish_conn(calling, called);
+}
+
+/* Verify T(iar) triggers and releases the channel */
+testcase TC_tiar_timeout() runs on SCCP_Test_RAW_CT {
+ var SCCP_PAR_Address calling, called;
+ var octetstring data := f_rnd_octstring(f_rnd_int(100));
+
+ /* Set T(iar) in sccp_demo_user low enough that it will trigger before other side
+ has time to keep alive with a T(ias). Keep recommended ratio of
+ T(iar) >= T(ias)*2 */
+ g_demo_sccp_timer_ias := 2;
+ g_demo_sccp_timer_iar := 5;
f_init_raw(mp_sccp_cfg[0]);
f_sleep(1.0);
- f_send_sccp(ts_SCCP_CR('000001'O, calling, called));
- f_exp_sccp(tr_SCCP_CC('000001'O, ?));
+
+ called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, mp_sccp_cfg[0].peer_ssn,
+ mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
+ calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, mp_sccp_cfg[0].own_ssn,
+ mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
+ f_establish_conn(calling, called);
+ f_tx_udt_exp(calling, called, data);
+
+ log("Waiting for first IT");
+ f_exp_sccp(tr_SCCP_IT(?, ?));
+ log("Waiting for second IT");
+ f_exp_sccp(tr_SCCP_IT(?, ?));
+
+ log("Waiting for RLSD");
+ f_exp_sccp(tr_SCCP_RLSD(?, ?, hex2int('0D'H))); /* Cause: Expiration of Rx Inactivity Timer */
+ f_send_sccp(ts_SCCP_RLC('000001'O, '000000'O));
}
control {
execute( TC_cr_cc() );
+ execute( TC_tiar_timeout() );
}