Change in osmo-ttcn3-hacks[master]: sccp: Add Tests for SCMG SST procedure

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Feb 10 18:52:44 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22831 )


Change subject: sccp: Add Tests for SCMG SST procedure
......................................................................

sccp: Add Tests for SCMG SST procedure

The SST procedure can be used by any SCCP node to test the availability
of a remote SSN.  If the specified remote SSN is available at the
specified PC, a SCMG SSA is returned.  If not, there's a timeout.

Test for SSN=1 (SCMG), another non-SCMG SSN that exists, and for one
SSN that doesn't exist.

Change-Id: If3f5f3144c0ed83d0bda5953522a9d73287c8ba2
---
M deps/Makefile
M library/SCCP_Templates.ttcn
M sccp/SCCP_Tests_RAW.ttcn
3 files changed, 185 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/31/22831/1

diff --git a/deps/Makefile b/deps/Makefile
index c5fd338..c9cc53d 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -44,7 +44,6 @@
 			titan.TestPorts.UNIX_DOMAIN_SOCKETasp
 
 ECLIPSEGIT2_REPOS=	titan.ProtocolEmulations.M3UA \
-			titan.ProtocolEmulations.SCCP \
 			titan.ProtocolModules.GRE \
 			titan.ProtocolModules.M2PA \
 			titan.ProtocolModules.ROSE \
@@ -65,6 +64,7 @@
 OSMOGITHUB_REPOS=	titan.TestPorts.SCTPasp \
 			titan.TestPorts.MTP3asp \
 			titan.TestPorts.UDPasp \
+			titan.ProtocolEmulations.SCCP \
 			titan.ProtocolModules.BSSGP_v13.0.0
 
 OSMOGIT_REPOS=		titan.ProtocolModules.MAP \
@@ -80,7 +80,7 @@
 # name of a local branch here (e.g. 'master').
 titan.Libraries.TCCUsefulFunctions_commit=	R.35.B-6-gb3687da
 titan.ProtocolEmulations.M3UA_commit=		f086e78d74defa044d864f17adaad9433fedc961
-titan.ProtocolEmulations.SCCP_commit=	 	R.7.A-10-g2ca1566
+titan.ProtocolEmulations.SCCP_commit=	 	R.7.A-11-gd4b7a6d
 titan.ProtocolModules.BSSAPP_v7.3.0_commit=	R.2.A-4-g20cfaf8
 titan.ProtocolModules.BSSGP_v13.0.0_commit=	e97d92a8b66bec399babea52f593771b76cb175a
 titan.ProtocolModules.BSSMAP_commit=		master
diff --git a/library/SCCP_Templates.ttcn b/library/SCCP_Templates.ttcn
index ff4d745..9936dd0 100644
--- a/library/SCCP_Templates.ttcn
+++ b/library/SCCP_Templates.ttcn
@@ -215,5 +215,90 @@
 	}
 }
 
+private function f_pc_int2bit(template (present) integer pc)
+return template SCMG_param_AffectedPointCode {
+	if (istemplatekind(pc, "?")) {
+		return ?;
+	} else {
+		return int2bit(valueof(pc), 16);
+	}
+}
+
+template (value) PDU_SCMG_message ts_SCMG_SSA(template (value) integer ssn,
+					      integer pc,
+					      template (value) BIT2 smi := '00'B) := {
+	messageType := sSAallowed,
+	affectedSSN := ssn,
+	affectedPC := int2bit(valueof(pc), 16),
+	smi := {
+		smi := smi,
+		reserved := '000000'B
+	},
+	congLevel := omit
+}
+template (present) PDU_SCMG_message tr_SCMG_SSA(template (present) integer ssn := ?,
+						template (present) integer pc := ?,
+						template (present) BIT2 smi := ?) := {
+	messageType := sSAallowed,
+	affectedSSN := ssn,
+	affectedPC := f_pc_int2bit(pc),
+	smi := {
+		smi := smi,
+		reserved := '000000'B
+	},
+	congLevel := omit
+}
+
+template (value) PDU_SCMG_message ts_SCMG_SSP(template (value) integer ssn,
+					      integer pc,
+					      template (value) BIT2 smi := '00'B) := {
+	messageType := sSPprohib,
+	affectedSSN := ssn,
+	affectedPC := int2bit(valueof(pc), 16),
+	smi := {
+		smi := smi,
+		reserved := '000000'B
+	},
+	congLevel := omit
+}
+template (present) PDU_SCMG_message tr_SCMG_SSP(template (present) integer ssn := ?,
+						template (present) integer pc := ?,
+						template (present) BIT2 smi := ?) := {
+	messageType := sSPprohib,
+	affectedSSN := ssn,
+	affectedPC := f_pc_int2bit(pc),
+	smi := {
+		smi := smi,
+		reserved := '000000'B
+	},
+	congLevel := omit
+}
+
+template (value) PDU_SCMG_message ts_SCMG_SST(template (value) integer ssn,
+					      integer pc,
+					      template (value) BIT2 smi := '00'B) := {
+	messageType := sSTstaTest,
+	affectedSSN := ssn,
+	affectedPC := int2bit(valueof(pc), 16),
+	smi := {
+		smi := smi,
+		reserved := '000000'B
+	},
+	congLevel := omit
+}
+template (present) PDU_SCMG_message tr_SCMG_SST(template (present) integer ssn := ?,
+						template (present) integer pc := ?,
+						template (present) BIT2 smi := ?) := {
+	messageType := sSTstaTest,
+	affectedSSN := ssn,
+	affectedPC := f_pc_int2bit(pc),
+	smi := {
+		smi := smi,
+		reserved := '000000'B
+	},
+	congLevel := omit
+}
+
+
 
 }
diff --git a/sccp/SCCP_Tests_RAW.ttcn b/sccp/SCCP_Tests_RAW.ttcn
index 7d44eb4..356fbb2 100644
--- a/sccp/SCCP_Tests_RAW.ttcn
+++ b/sccp/SCCP_Tests_RAW.ttcn
@@ -310,11 +310,109 @@
 	}
 }
 
+function f_scmg_xceive(SCCP_PAR_Address calling, SCCP_PAR_Address called,
+		       template (value) PDU_SCMG_message tx,
+		       template (omit) PDU_SCMG_message rx_exp) runs on SCCP_Test_RAW_CT
+{
+	var boolean exp_something := true;
+	timer T := 5.0;
+
+	if (istemplatekind(rx_exp, "omit")) {
+		exp_something := false;
+	}
+
+	MTP3.clear;
+	f_send_sccp(ts_SCCP_UDT(calling, called, enc_PDU_SCMG_message(valueof(tx))));
+	T.start;
+	alt {
+	[exp_something] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_UDT(called, calling, decmatch rx_exp))) {
+		setverdict(pass);
+		}
+	[] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_UDT(called, calling, ?))) {
+		setverdict(fail, "Received unexpected SCCP waiting for ", rx_exp);
+		}
+	[] MTP3.receive {
+		setverdict(fail, "Received unexpected waiting for ", rx_exp);
+		}
+	[exp_something] T.timeout {
+		setverdict(fail, "Timeout waiting for ", rx_exp);
+		}
+	[not exp_something] T.timeout {
+		setverdict(pass);
+		}
+	}
+
+}
+
+/* Test is SST(SSN=1) returns SSA */
+testcase TC_scmg_sst_ssn1() runs on SCCP_Test_RAW_CT {
+	var SCCP_PAR_Address calling, called;
+	var template (value) PDU_SCMG_message tx;
+	var template (present) PDU_SCMG_message rx_exp;
+
+	f_init_raw(mp_sccp_cfg[0]);
+	f_sleep(1.0);
+
+	called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, 1,
+					     mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
+	calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, 1,
+					     mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
+
+	tx := ts_SCMG_SST(1, mp_sccp_cfg[0].peer_pc);
+	rx_exp := ts_SCMG_SSA(1, mp_sccp_cfg[0].peer_pc);
+	f_scmg_xceive(calling, called, tx, rx_exp);
+}
+
+/* Test is SST(SSN=valid) returns SSA */
+testcase TC_scmg_sst_ssn_valid() runs on SCCP_Test_RAW_CT {
+	var SCCP_PAR_Address calling, called;
+	var template (value) PDU_SCMG_message tx;
+	var template (present) PDU_SCMG_message rx_exp;
+
+	f_init_raw(mp_sccp_cfg[0]);
+	f_sleep(1.0);
+
+	called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, 1,
+					     mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
+	calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, 1,
+					     mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
+
+	tx := ts_SCMG_SST(mp_sccp_cfg[0].peer_ssn, mp_sccp_cfg[0].peer_pc);
+	rx_exp := ts_SCMG_SSA(mp_sccp_cfg[0].peer_ssn, mp_sccp_cfg[0].peer_pc);
+	f_scmg_xceive(calling, called, tx, rx_exp);
+}
+
+
+/* Test is SST(SSN=invalid) returns nothing */
+testcase TC_scmg_sst_ssn_invalid() runs on SCCP_Test_RAW_CT {
+	var SCCP_PAR_Address calling, called;
+	var template (value) PDU_SCMG_message tx;
+	var template (omit) PDU_SCMG_message rx_exp;
+
+	f_init_raw(mp_sccp_cfg[0]);
+	f_sleep(1.0);
+
+	called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, 1,
+					     mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
+	calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, 1,
+					     mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
+
+	tx := ts_SCMG_SST(123, mp_sccp_cfg[0].peer_pc);
+	rx_exp := omit;
+	f_scmg_xceive(calling, called, tx, rx_exp);
+}
+
+
+
 control {
 	execute( TC_cr_cc() );
 	execute( TC_udt_without_cr_cc() );
 	execute( TC_tiar_timeout() );
 	execute( TC_it_avoids_tiar() );
+
+	execute( TC_scmg_sst_ssn1() );
+	execute( TC_scmg_sst_ssn_valid() );
+	execute( TC_scmg_sst_ssn_invalid() );
 }
 
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22831
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If3f5f3144c0ed83d0bda5953522a9d73287c8ba2
Gerrit-Change-Number: 22831
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210210/cec6eccc/attachment.htm>


More information about the gerrit-log mailing list