bsc: add TC_L3Compl_answer_from_other_m3ua_addr

Related: SYS#6044
Change-Id: I4466e7066115da98d9f45a876d1d468dc0cca25a
This commit is contained in:
Oliver Smith 2022-08-23 15:20:23 +02:00 committed by Neels Hofmeyr
parent 28209ecdac
commit 5ce13de83c
6 changed files with 140 additions and 9 deletions

View File

@ -80,7 +80,7 @@ const integer NUM_TRX := 4;
const integer NUM_BTS := 3;
const integer NUM_BTS_CFG := 4; /* we have 4 BTS in the osmo-bsc.cfg (for inter-BSC HO tests) but use only 3 */
const integer NUM_TRX_CFG := 1; /* we support up to 4 TRX per BTS, but have only 1 TRX per BTS in osmo-bsc.cfg */
const integer NUM_MSC := 3;
const integer NUM_MSC := 4;
const float T3101_MAX := 12.0;
/* make sure to sync this with the osmo-bts.cfg you're using */
@ -698,6 +698,18 @@ modulepar {
peer_ssn := 254,
sio := '83'O,
rctx := 3
},
{
transport := BSSAP_TRANSPORT_AoIP,
sccp_service_type := "mtp3_itu",
sctp_addr := { 23909, "127.0.0.1", 2905, "127.0.0.1" },
own_pc := 4, /* 0.0.4 fourth MSC emulation */
own_ssn := 254,
peer_pc := 187, /* 0.23.3 osmo-bsc */
peer_ssn := 254,
sio := '83'O,
rctx := 4,
own_alt_pc := 5 /* 0.0.5 alternative PC also routed to 0.0.4 */
}
};
@ -1201,7 +1213,7 @@ function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false,
f_init_vty("VirtMSC");
f_vty_allow_osmux_cn(g_osmux_enabled_cn);
var my_BooleanList allow_attach := { false, false, false };
var my_BooleanList allow_attach := { false, false, false, false };
f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port);
/* Make sure each MSC's internal state is "DISCONNECTED" at first */
@ -11715,6 +11727,79 @@ testcase TC_chan_alloc_algo_ass_dynamic() runs on test_CT {
f_shutdown_helper();
}
/* The BSC asks for Compl L3 to 0.0.5, but osmo-stp redirects this SCCP CR to 0.0.4.
* The SCCP CC with the Compl L3 response comes back from 0.0.4.
* The BSC should continue to use that point-code 0.0.4 for this BSSAP connection.
* Related: SYS#6044 */
private function f_tc_L3Compl_answer_from_other_m3ua_addr(charstring id) runs on MSC_ConnHdlr {
f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR);
var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info);
f_create_bssmap_exp(l3_enc);
timer T := 10.0;
f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info");
f_create_bssmap_exp(l3_enc);
RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn);
f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC GW1");
var template PDU_BSSAP exp_l3_compl;
exp_l3_compl := tr_BSSMAP_ComplL3()
if (g_pars.aoip == false) {
exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit;
} else {
exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?;
}
var PDU_BSSAP bssap;
T.start;
alt {
[] BSSAP.receive(exp_l3_compl) -> value bssap {
f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC GW1");
log("rx exp_l3_compl = ", bssap);
}
[] BSSAP.receive(tr_BSSMAP_ComplL3) {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION");
}
[] T.timeout {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION");
}
}
f_logp(BSCVTY, "send Compl L3 response");
/* Send a response, this will trigger the SCCP CC; then, this goes on to receive more messages from the BSC,
* confirming a working BSSAP link. */
f_cipher_mode(g_pars.encr);
f_sleep(1.0);
f_perform_clear();
}
testcase TC_L3Compl_answer_from_other_m3ua_addr() runs on test_CT {
f_init(nr_bts := 1, handler_mode := true, nr_msc := 4);
f_sleep(1.0);
/* Make sure 'msc 3' gets chosen */
f_vty_msc_allow_attach(BSCVTY, {false, false, false, true});
var MSC_ConnHdlr vc_conn;
var TestHdlrParams pars := f_gen_test_hdlr_pars(bssap_idx := 3);
pars.mscpool.rsl_idx := 0;
pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8)));
vc_conn := f_start_handler_create(pars);
f_start_handler_run(vc_conn, refers(f_tc_L3Compl_answer_from_other_m3ua_addr), pars);
vc_conn.done;
f_shutdown_helper();
}
control {
/* CTRL interface testing */
execute( TC_ctrl_msc_connection_status() );
@ -12046,6 +12131,10 @@ control {
execute( TC_chan_alloc_algo_descending() );
execute( TC_chan_alloc_algo_ass_dynamic() );
if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) {
execute( TC_L3Compl_answer_from_other_m3ua_addr() );
}
/* Run TC_ho_out_of_this_bsc last, because it may trigger a segfault before osmo-bsc's patch
* with change-id I5a3345ab0005a73597f5c27207480912a2f5aae6 */
execute( TC_ho_out_of_this_bsc() );

View File

@ -445,6 +445,7 @@ altstep as_Media(boolean fail_on_dlcx := true) runs on MSC_ConnHdlr {
type port Coord_PT message
{
inout charstring;
inout PDU_BSSAP;
} with { extension "internal" };
/* this component represents a single subscriber connection at the MSC.
@ -537,7 +538,8 @@ const RanOps MSC_RanOps := {
use_osmux := false,
bssap_reset_retries := 1,
sccp_addr_local := omit,
sccp_addr_peer := omit
sccp_addr_peer := omit,
sccp_addr_local_alt := omit
}
const BssapLeOps SMLC_BssapLeOps := {

View File

@ -53,6 +53,12 @@ cs7 instance 0
point-code 0.0.2
sccp-address msc3
point-code 0.0.3
sccp-address msc4unused
point-code 0.0.4
sccp-address msc4
# osmo-stp.cfg configured to route 0.0.5 to virt-msc3=0.0.4
point-code 0.0.5
network
network country code 1
mobile network code 1
@ -488,6 +494,9 @@ msc 1
msc 2
msc-addr msc3
mgw remote-ip 127.0.0.1
msc 3
msc-addr msc4
mgw remote-ip 127.0.0.1
network
nri bitlen 10
@ -501,7 +510,9 @@ msc 1
nri add 256 511
msc 2
nri add 512 767
# range 768-1024 is not assigned to any MSC on purpose
# range 768-1000 is not assigned to any MSC on purpose
msc 3
nri add 1001 1023
bsc
mid-call-timeout 0

View File

@ -47,6 +47,13 @@ cs7 instance 0
asp virt-msc2-0
routing-key 3 0.0.3
asp virt-msc3-0 23909 2905 m3ua
local-ip 127.0.0.1
remote-ip 127.0.0.1
as virt-msc3 m3ua
asp virt-msc3-0
routing-key 4 0.0.4
asp virt-smlc-0 23908 2905 m3ua
local-ip 127.0.0.1
remote-ip 127.0.0.1
@ -58,6 +65,11 @@ cs7 instance 0
update route 0.23.1 7.255.7 linkset virt-msc0
update route 0.0.2 7.255.7 linkset virt-msc1
update route 0.0.3 7.255.7 linkset virt-msc2
# routing TWO addresses to virt-msc3
update route 0.0.4 7.255.7 linkset virt-msc3
update route 0.0.5 7.255.7 linkset virt-msc3
update route 0.23.6 7.255.7 linkset virt-smlc
listen m3ua 2905
accept-asp-connections dynamic-permitted

View File

@ -62,7 +62,8 @@ type record RAN_Configuration {
integer peer_pc,
integer peer_ssn,
octetstring sio,
integer rctx
integer rctx,
integer own_alt_pc
};
type record of RAN_Configuration RAN_Configurations;
@ -90,6 +91,11 @@ function f_ran_adapter_init(inout RAN_Adapter ba, in RAN_Configuration cfg, char
init_pars(ba, cfg);
ops.sccp_addr_local := ba.sccp_addr_own;
ops.sccp_addr_peer := ba.sccp_addr_peer;
if (ispresent(cfg.own_alt_pc)) {
ops.sccp_addr_local_alt := valueof(ts_SccpAddr_PC_SSN(cfg.own_alt_pc, cfg.own_ssn, cfg.sio, cfg.sccp_service_type));
} else {
ops.sccp_addr_local_alt := omit;
}
/* create components */
ba.vc_SCCP := SCCP_CT.create(id & "-SCCP");

View File

@ -518,7 +518,8 @@ runs on RAN_Emulation_CT return template PDU_BSSAP {
return g_ran_ops.unitdata_cb.apply(bssap);
}
function f_bssap_reset(SCCP_PAR_Address peer, SCCP_PAR_Address own) runs on RAN_Emulation_CT {
function f_bssap_reset(SCCP_PAR_Address peer, SCCP_PAR_Address own,
template (omit) SCCP_PAR_Address own_alt) runs on RAN_Emulation_CT {
timer T := 5.0;
var boolean append_osmux_support := append_osmux_ie();
var integer attempts := g_ran_ops.bssap_reset_retries;
@ -527,12 +528,21 @@ function f_bssap_reset(SCCP_PAR_Address peer, SCCP_PAR_Address own) runs on RAN_
attempts := attempts - 1;
BSSAP.send(ts_BSSAP_UNITDATA_req(peer, own, ts_BSSMAP_Reset(0, append_osmux_support)));
/* For in case the BSC expects a RESET from the MSC's alternate point code, also send a RESET from our
* alternate address. The alternate address is useful for testing SCCP redirection scenarios. */
if (ispresent(own_alt)) {
BSSAP.send(ts_BSSAP_UNITDATA_req(peer, valueof(own_alt), ts_BSSMAP_Reset(0, append_osmux_support)));
}
T.start;
alt {
[] BSSAP.receive(tr_BSSAP_UNITDATA_ind(own, peer, tr_BSSMAP_ResetAck(append_osmux_support))) {
[] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, peer, tr_BSSMAP_ResetAck(append_osmux_support))) {
log("BSSMAP: Received RESET-ACK in response to RESET, we're ready to go!");
return;
}
[ispresent(own_alt)] BSSAP.receive(tr_BSSAP_UNITDATA_ind(own_alt, peer, tr_BSSMAP_ResetAck(append_osmux_support))) {
log("BSSMAP: Received RESET-ACK from own_alt in response to RESET, we're ready to go!");
return;
}
[] as_reset_ack(append_osmux_support);
[] BSSAP.receive { repeat };
[] T.timeout {
@ -733,7 +743,8 @@ type record RanOps {
integer bssap_reset_retries,
/* needed for performing BSSMAP RESET */
SCCP_PAR_Address sccp_addr_local optional,
SCCP_PAR_Address sccp_addr_peer optional
SCCP_PAR_Address sccp_addr_peer optional,
SCCP_PAR_Address sccp_addr_local_alt optional
}
template BIT4 t_ML3_DISC_CC_MM_SS := ('0011'B, '0101'B, '1011'B);
@ -1208,7 +1219,7 @@ function main(RanOps ops, charstring id) runs on RAN_Emulation_CT {
select (g_ran_ops.protocol) {
#ifdef RAN_EMULATION_BSSAP
case (RAN_PROTOCOL_BSSAP) {
f_bssap_reset(ops.sccp_addr_peer, ops.sccp_addr_local);
f_bssap_reset(ops.sccp_addr_peer, ops.sccp_addr_local, ops.sccp_addr_local_alt);
}
#endif
#ifdef RAN_EMULATION_RANAP