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
This commit is contained in:
Harald Welte 2021-02-10 19:37:45 +01:00 committed by laforge
parent e92cc66c62
commit 24f921baea
3 changed files with 185 additions and 2 deletions

4
deps/Makefile vendored
View File

@ -44,7 +44,6 @@ ECLIPSEGITHUB_REPOS= titan.Libraries.TCCUsefulFunctions \
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 @@ ECLIPSEGIT2_REPOS= titan.ProtocolEmulations.M3UA \
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 @@ ALL_REPOS=$(ECLIPSEGITHUB_REPOS) $(ECLIPSEGIT2_REPOS) $(OSMOGITHUB_REPOS) $(OSMO
# 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

View File

@ -215,5 +215,90 @@ template PDU_SCCP tr_SCCP_RLC(template (present) OCT3 source_lref := ?,
}
}
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
}
}

View File

@ -310,11 +310,109 @@ testcase TC_it_avoids_tiar() runs on SCCP_Test_RAW_CT {
}
}
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() );
}