2019-04-14 20:23:14 +00:00
|
|
|
module RAN_Adapter {
|
2017-11-25 14:00:50 +00:00
|
|
|
|
2019-04-14 20:23:14 +00:00
|
|
|
/* This module implements a 'dumb' RAN adapter. It creates the M3UA and SCCP components and stacks a
|
|
|
|
* BSSAP/RANAP codec port on top. As a result, it provides the ability to transceive SCCP-User-SAP primitives
|
|
|
|
* with deoded BSSAP/RANAP payload. Use this if you want to have full control about what you transmit or
|
|
|
|
* receive, without any automatisms in place. Allows you to refuse connections or other abnormal behavior. */
|
2017-11-25 14:00:50 +00:00
|
|
|
|
2017-12-09 00:03:01 +00:00
|
|
|
import from General_Types all;
|
|
|
|
import from Osmocom_Types all;
|
|
|
|
|
|
|
|
import from M3UA_Emulation all;
|
|
|
|
import from MTP3asp_Types all;
|
|
|
|
import from MTP3asp_PortType all;
|
2017-11-25 14:00:50 +00:00
|
|
|
|
2018-04-16 17:16:01 +00:00
|
|
|
import from IPA_Emulation all;
|
|
|
|
|
2017-11-25 14:00:50 +00:00
|
|
|
import from SCCP_Types all;
|
|
|
|
import from SCCPasp_Types all;
|
|
|
|
import from SCCP_Emulation all;
|
2018-06-14 13:15:46 +00:00
|
|
|
import from SCCP_Templates all;
|
2017-11-25 14:00:50 +00:00
|
|
|
|
2017-12-09 00:03:01 +00:00
|
|
|
import from SCTPasp_Types all;
|
|
|
|
import from SCTPasp_PortType all;
|
2017-11-25 14:00:50 +00:00
|
|
|
|
2019-04-23 15:41:46 +00:00
|
|
|
#ifdef RAN_EMULATION_BSSAP
|
2017-11-25 14:00:50 +00:00
|
|
|
import from BSSMAP_Templates all;
|
2019-04-23 15:41:46 +00:00
|
|
|
#endif
|
2019-04-14 20:23:14 +00:00
|
|
|
import from RAN_Emulation all;
|
2017-12-16 18:26:04 +00:00
|
|
|
|
2019-04-14 20:23:14 +00:00
|
|
|
type record RAN_Adapter {
|
2017-11-25 14:00:50 +00:00
|
|
|
/* component references */
|
2018-05-24 18:00:00 +00:00
|
|
|
M3UA_CT vc_M3UA, /* only in 3GPP AoIP */
|
|
|
|
IPA_Emulation_CT vc_IPA, /* only in SCCPlite */
|
|
|
|
IPA_EventWaiter_CT vc_WAIT, /* only in SCCPlite */
|
2018-02-08 23:17:14 +00:00
|
|
|
SCCP_CT vc_SCCP,
|
2017-12-09 00:03:01 +00:00
|
|
|
|
2018-02-08 23:17:14 +00:00
|
|
|
MSC_SCCP_MTP3_parameters sccp_pars,
|
|
|
|
SCCP_PAR_Address sccp_addr_own,
|
|
|
|
SCCP_PAR_Address sccp_addr_peer,
|
2017-12-16 18:26:04 +00:00
|
|
|
|
|
|
|
/* handler mode */
|
2019-04-14 20:23:14 +00:00
|
|
|
RAN_Emulation_CT vc_RAN
|
2017-11-25 14:00:50 +00:00
|
|
|
}
|
|
|
|
|
2019-04-14 20:23:14 +00:00
|
|
|
type enumerated RAN_Transport {
|
2018-04-16 17:16:01 +00:00
|
|
|
BSSAP_TRANSPORT_AoIP, /* 3GPP AoIP: SCCP over M3UA over SCTP */
|
|
|
|
BSSAP_TRANSPORT_SCCPlite_SERVER, /* SCCPlite: SCCP over IPA over TCP */
|
2019-04-14 21:40:17 +00:00
|
|
|
BSSAP_TRANSPORT_SCCPlite_CLIENT, /* SCCPlite: SCCP over IPA over TCP */
|
|
|
|
RANAP_TRANSPORT_IuCS /* 3GPP IuCS: SCCP over M3UA over SCTP */
|
2018-04-16 17:16:01 +00:00
|
|
|
};
|
|
|
|
|
2019-04-14 20:23:14 +00:00
|
|
|
type record RAN_Configuration {
|
|
|
|
RAN_Transport transport,
|
2018-02-08 23:17:14 +00:00
|
|
|
charstring sccp_service_type,
|
|
|
|
SCTP_Association_Address sctp_addr,
|
|
|
|
integer own_pc,
|
|
|
|
integer own_ssn,
|
|
|
|
integer peer_pc,
|
|
|
|
integer peer_ssn,
|
2018-03-27 12:52:35 +00:00
|
|
|
octetstring sio,
|
|
|
|
integer rctx
|
2018-02-08 23:17:14 +00:00
|
|
|
};
|
2017-12-09 00:03:01 +00:00
|
|
|
|
2019-04-14 20:23:14 +00:00
|
|
|
private function init_pars(inout RAN_Adapter ba, in RAN_Configuration cfg) {
|
2018-02-08 23:17:14 +00:00
|
|
|
ba.sccp_pars := {
|
2017-12-09 00:03:01 +00:00
|
|
|
sio := {
|
2018-02-08 23:17:14 +00:00
|
|
|
ni := substr(oct2bit(cfg.sio),0,2),
|
|
|
|
prio := substr(oct2bit(cfg.sio),2,2),
|
|
|
|
si := substr(oct2bit(cfg.sio),4,4)
|
2017-12-09 00:03:01 +00:00
|
|
|
},
|
2018-02-08 23:17:14 +00:00
|
|
|
opc := cfg.own_pc,
|
|
|
|
dpc := cfg.peer_pc,
|
2017-12-09 00:03:01 +00:00
|
|
|
sls := 0,
|
2018-02-08 23:17:14 +00:00
|
|
|
sccp_serviceType := cfg.sccp_service_type,
|
|
|
|
ssn := cfg.own_ssn
|
2017-12-09 00:03:01 +00:00
|
|
|
};
|
2018-02-08 23:17:14 +00:00
|
|
|
ba.sccp_addr_own := valueof(ts_SccpAddr_PC_SSN(cfg.own_pc, cfg.own_ssn, cfg.sio, cfg.sccp_service_type));
|
|
|
|
ba.sccp_addr_peer := valueof(ts_SccpAddr_PC_SSN(cfg.peer_pc, cfg.peer_ssn, cfg.sio, cfg.sccp_service_type));
|
2017-11-25 14:00:50 +00:00
|
|
|
}
|
|
|
|
|
2017-12-09 00:03:01 +00:00
|
|
|
|
2019-04-23 15:18:48 +00:00
|
|
|
function f_ran_adapter_init(inout RAN_Adapter ba, in RAN_Configuration cfg, charstring id,
|
2019-04-14 20:23:14 +00:00
|
|
|
template RanOps ops) {
|
2018-02-08 23:17:14 +00:00
|
|
|
init_pars(ba, cfg);
|
|
|
|
ops.sccp_addr_local := ba.sccp_addr_own;
|
|
|
|
ops.sccp_addr_peer := ba.sccp_addr_peer;
|
2017-12-09 00:03:01 +00:00
|
|
|
|
2017-11-25 14:00:50 +00:00
|
|
|
/* create components */
|
2018-02-08 23:17:14 +00:00
|
|
|
ba.vc_SCCP := SCCP_CT.create(id & "-SCCP");
|
2018-01-17 21:19:03 +00:00
|
|
|
if (isvalue(ops)) {
|
2019-04-14 20:23:14 +00:00
|
|
|
ba.vc_RAN := RAN_Emulation_CT.create(id & "-RAN");
|
2017-12-16 18:26:04 +00:00
|
|
|
}
|
2018-04-16 17:16:01 +00:00
|
|
|
select (cfg.transport) {
|
2019-04-14 21:40:17 +00:00
|
|
|
case (BSSAP_TRANSPORT_AoIP, RANAP_TRANSPORT_IuCS) {
|
2018-04-16 17:16:01 +00:00
|
|
|
ba.vc_M3UA := M3UA_CT.create(id & "-M3UA");
|
|
|
|
map(ba.vc_M3UA:SCTP_PORT, system:sctp);
|
|
|
|
/* connect MTP3 service provider (M3UA) to lower side of SCCP */
|
|
|
|
connect(ba.vc_M3UA:MTP3_SP_PORT, ba.vc_SCCP:MTP3_SCCP_PORT);
|
|
|
|
ba.vc_M3UA.start(f_M3UA_Emulation(cfg.sctp_addr, cfg.rctx));
|
|
|
|
}
|
2019-04-23 15:41:46 +00:00
|
|
|
#ifdef IPA_EMULATION_SCCP
|
2018-04-16 17:16:01 +00:00
|
|
|
case (BSSAP_TRANSPORT_SCCPlite_SERVER) {
|
|
|
|
ba.vc_IPA := IPA_Emulation_CT.create(id & "-IPA");
|
|
|
|
map(ba.vc_IPA:IPA_PORT, system:IPA_CODEC_PT);
|
|
|
|
/* connect MTP3 service provider (IPA) to lower side of SCCP */
|
|
|
|
connect(ba.vc_IPA:MTP3_SP_PORT, ba.vc_SCCP:MTP3_SCCP_PORT);
|
2018-05-24 18:00:00 +00:00
|
|
|
/* connect waiter to general IPA port (for ASP_IPA_Event) */
|
|
|
|
ba.vc_WAIT := IPA_EventWaiter_CT.create(id & "-IPA-WAIT");
|
|
|
|
connect(ba.vc_IPA:IPA_SP_PORT, ba.vc_WAIT:IPA_SP_PORT);
|
|
|
|
ba.vc_WAIT.start(IPA_Emulation.waiter_main());
|
2018-04-16 17:16:01 +00:00
|
|
|
ba.vc_IPA.start(IPA_Emulation.main_server(cfg.sctp_addr.local_ip_addr,
|
fix SCCPlite BSC tests: send IPA ID ACK, not GET
From libosmo-sccp.git Icffda98579e676ab6ca63c9c22cf5d151c4fe95f on, we expect
an IPA ID ACK upon first connecting, not an IPA ID GET. This might be specific
to the one MSC tested so far, but it's the status quo.
Make the IPA server in IPA_Emulation configurable, to conform and send the IPA
ID ACK upon connecting. This fixes the ttcn3-bsc-tests,SCCPlite suite, broken
by above libosmo-sccp commit.
For other IPA clients, it is so far required to send the IPA ID GET, so only
configure the SCCPlite server in BSSAP_Adapter.ttcn to send IPA ID ACK, and
leave the others unchanged.
Related: OS#3500 OS#3498
Related: Icffda98579e676ab6ca63c9c22cf5d151c4fe95f (libosmo-sccp)
Change-Id: I34b6296a1a408729802a9659c6524c0f67a2f4fe
2018-08-24 12:44:32 +00:00
|
|
|
cfg.sctp_addr.local_sctp_port,
|
|
|
|
true, IPA_INIT_SEND_IPA_ID_ACK));
|
2018-05-24 18:00:00 +00:00
|
|
|
/* wait until we received an IPA CCM ID_ACK */
|
|
|
|
ba.vc_WAIT.done;
|
|
|
|
disconnect(ba.vc_IPA:IPA_SP_PORT, ba.vc_WAIT:IPA_SP_PORT);
|
2018-04-16 17:16:01 +00:00
|
|
|
}
|
|
|
|
case (BSSAP_TRANSPORT_SCCPlite_CLIENT) {
|
|
|
|
ba.vc_IPA := IPA_Emulation_CT.create(id & "-IPA");
|
|
|
|
map(ba.vc_IPA:IPA_PORT, system:IPA_CODEC_PT);
|
|
|
|
/* connect MTP3 service provider (IPA) to lower side of SCCP */
|
|
|
|
connect(ba.vc_IPA:MTP3_SP_PORT, ba.vc_SCCP:MTP3_SCCP_PORT);
|
2018-05-24 18:00:00 +00:00
|
|
|
/* connect waiter to general IPA port (for ASP_IPA_Event) */
|
|
|
|
ba.vc_WAIT := IPA_EventWaiter_CT.create(id & "-IPA-WAIT");
|
|
|
|
connect(ba.vc_IPA:IPA_SP_PORT, ba.vc_WAIT:IPA_SP_PORT);
|
|
|
|
ba.vc_WAIT.start(IPA_Emulation.waiter_main());
|
2018-04-16 17:16:01 +00:00
|
|
|
ba.vc_IPA.start(IPA_Emulation.main_client(cfg.sctp_addr.remote_ip_addr,
|
|
|
|
cfg.sctp_addr.remote_sctp_port,
|
|
|
|
cfg.sctp_addr.local_ip_addr,
|
|
|
|
cfg.sctp_addr.local_sctp_port));
|
2018-05-24 18:00:00 +00:00
|
|
|
/* wait until we received an IPA CCM ID_ACK */
|
|
|
|
ba.vc_WAIT.done;
|
|
|
|
disconnect(ba.vc_IPA:IPA_SP_PORT, ba.vc_WAIT:IPA_SP_PORT);
|
2018-04-16 17:16:01 +00:00
|
|
|
}
|
2019-04-23 15:41:46 +00:00
|
|
|
#endif /* SCCP */
|
2018-04-16 17:16:01 +00:00
|
|
|
case else {
|
2019-04-14 20:23:14 +00:00
|
|
|
setverdict(fail, "Unsuppored RAN_Transport");
|
2018-07-05 15:35:03 +00:00
|
|
|
mtc.stop;
|
2018-04-16 17:16:01 +00:00
|
|
|
}
|
|
|
|
}
|
2017-11-25 14:00:50 +00:00
|
|
|
|
2018-01-17 21:19:03 +00:00
|
|
|
if (isvalue(ops)) {
|
2018-01-21 12:53:17 +00:00
|
|
|
timer T := 5.0;
|
|
|
|
T.start;
|
2018-02-08 23:17:14 +00:00
|
|
|
//T.timeout;
|
|
|
|
log("Connecting BSSMAP Emulation to SCCP_SP_PORT and starting emulation");
|
2018-05-27 13:07:32 +00:00
|
|
|
/* connect BSSNAP component to upper side of SCCP */
|
2019-04-14 21:40:17 +00:00
|
|
|
if (cfg.transport == RANAP_TRANSPORT_IuCS) {
|
|
|
|
#ifdef RAN_EMULATION_RANAP
|
|
|
|
ops.protocol := RAN_PROTOCOL_RANAP
|
|
|
|
connect(ba.vc_RAN:RANAP, ba.vc_SCCP:SCCP_SP_PORT);
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
#ifdef RAN_EMULATION_BSSAP
|
|
|
|
connect(ba.vc_RAN:BSSAP, ba.vc_SCCP:SCCP_SP_PORT);
|
2019-04-15 09:48:05 +00:00
|
|
|
#endif
|
2019-04-14 21:40:17 +00:00
|
|
|
}
|
2018-05-27 13:07:14 +00:00
|
|
|
if (cfg.transport == BSSAP_TRANSPORT_SCCPlite_SERVER or
|
|
|
|
cfg.transport == BSSAP_TRANSPORT_SCCPlite_CLIENT) {
|
2019-04-23 15:41:46 +00:00
|
|
|
#ifdef IPA_EMULATION_MGCP
|
2018-05-27 13:07:14 +00:00
|
|
|
/* connect IPA MGCP port with BSSMAP MGCP port */
|
2019-04-14 20:23:14 +00:00
|
|
|
connect(ba.vc_IPA:IPA_MGCP_PORT, ba.vc_RAN:MGCP);
|
2019-04-23 15:41:46 +00:00
|
|
|
#endif
|
2018-05-27 13:07:14 +00:00
|
|
|
}
|
2019-04-14 20:23:14 +00:00
|
|
|
ba.vc_RAN.start(RAN_Emulation.main(valueof(ops), ""));
|
2017-12-09 00:03:01 +00:00
|
|
|
}
|
2018-05-24 18:00:00 +00:00
|
|
|
|
|
|
|
|
2017-12-09 00:03:01 +00:00
|
|
|
}
|
|
|
|
|
2019-04-23 15:18:48 +00:00
|
|
|
function f_ran_adapter_start(inout RAN_Adapter ba) {
|
2018-05-27 14:52:56 +00:00
|
|
|
ba.vc_SCCP.start(SCCPStart(ba.sccp_pars));
|
|
|
|
}
|
|
|
|
|
2017-12-09 00:03:01 +00:00
|
|
|
|
2017-11-25 14:00:50 +00:00
|
|
|
}
|