aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--library/SCCP_Templates.ttcn131
-rw-r--r--sccp/SCCP_Tests_RAW.ttcn124
2 files changed, 205 insertions, 50 deletions
diff --git a/library/SCCP_Templates.ttcn b/library/SCCP_Templates.ttcn
index 7c2ffa6d..b3e3392f 100644
--- a/library/SCCP_Templates.ttcn
+++ b/library/SCCP_Templates.ttcn
@@ -9,6 +9,8 @@
module SCCP_Templates {
+import from General_Types all;
+
import from SCCP_Types all;
import from SCCPasp_Types all;
import from SCCP_Emulation all;
@@ -66,5 +68,134 @@ template (value) SCCP_PAR_Address ts_SccpAddr_PC_GT(integer pc, octetstring sio,
}
}
+/* 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 source_lref,
+ template (present) OCT3 dest_lref) := {
+ connconfirm := {
+ messageType := cc,
+ destLocRef := dest_lref,
+ sourceLocRef := source_lref,
+ protClass := c_class2,
+ pointer1 := ?,
+ optionalPart := *,
+ eop := *
+ }
+}
+
+template (value) PDU_SCCP ts_SCCP_UDT(SCCP_PAR_Address calling, SCCP_PAR_Address called,
+ template (value) octetstring data,
+ template (value) BIT4 msg_hdl := '0000'B) := {
+ unitdata := {
+ messageType := udt,
+ protClass := {'0000'B, msg_hdl},
+ pointer1 := 0, /* overwritten */
+ pointer2 := 0, /* overwritten */
+ pointer3 := 0, /* overwritten */
+ calledPAddress := ConvertASPAddressToEncodedAddress_itu(called),
+ callingPAddress := ConvertASPAddressToEncodedAddress_itu(calling),
+ data := {
+ paramLength := 0,
+ data := data
+ }
+ }
+}
+
+template PDU_SCCP tr_SCCP_UDT(SCCP_PAR_Address calling, SCCP_PAR_Address called,
+ template octetstring data := ?,
+ template BIT4 msg_hdl := '0000'B) := {
+ unitdata := {
+ messageType := udt,
+ protClass := {'0000'B, msg_hdl},
+ pointer1 := ?,
+ pointer2 := ?,
+ pointer3 := ?,
+ calledPAddress := ConvertASPAddressToEncodedAddress_itu(called),
+ callingPAddress := ConvertASPAddressToEncodedAddress_itu(calling),
+ data := {
+ paramLength := lengthof(data),
+ data := data
+ }
+ }
+}
+
+template PDU_SCCP tr_SCCP_IT(template (present) OCT3 source_lref := ?,
+ template (present) OCT3 dest_lref := ?) := {
+ inacttest := {
+ messageType := it,
+ destLocRef := dest_lref,
+ sourceLocRef := source_lref,
+ protClass := c_class2,
+ sequencingSegmenting := {
+ reserved := ?,
+ p_s := ?,
+ more := ?,
+ pr := ?
+ },
+ credit := ?
+ }
+}
+
+template PDU_SCCP tr_SCCP_RLSD(template (present) OCT3 source_lref := ?,
+ template (present) OCT3 dest_lref := ?,
+ template (present) SCCP_param_ReleaseCause relcause := ?) := {
+ released := {
+ messageType := rlsd,
+ destLocRef := dest_lref,
+ sourceLocRef := source_lref,
+ releaseCause := relcause,
+ pointer1 := ?,
+ optionalPart := *,
+ eop := *
+ }
+}
+
+template PDU_SCCP ts_SCCP_RLC(OCT3 source_lref, OCT3 dest_lref) := {
+ relcomp := {
+ messageType := rlc,
+ destLocRef := dest_lref,
+ sourceLocRef := source_lref
+ }
+}
+
+template PDU_SCCP tr_SCCP_RLC(template (present) OCT3 source_lref := ?,
+ template (present) OCT3 dest_lref := ?) := {
+ relcomp := {
+ messageType := rlc,
+ destLocRef := dest_lref,
+ sourceLocRef := source_lref
+ }
+}
+
}
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() );
}