2017-11-21 23:45:07 +00:00
|
|
|
module IPA_Emulation {
|
|
|
|
|
2017-12-09 00:15:44 +00:00
|
|
|
/* This module implements the IPA multiplex protocol on top of TCP, using the IPL4asp
|
|
|
|
* test-port as provider. It implements both client and server roles, as well was the CCM
|
2019-06-10 09:00:33 +00:00
|
|
|
* handshake for establishing the identity of the client to the server.
|
2018-01-03 20:07:52 +00:00
|
|
|
*
|
|
|
|
* It already knows certain well-known sub-protocols such as A-bis RSL, MGCP and SCCP and
|
|
|
|
* GSUP. IT hence transcodes messages so the user can work with abstract data types rather
|
|
|
|
* than binary messages. It handles multiple packets inside one TCP segment.
|
|
|
|
*
|
2019-05-27 09:54:11 +00:00
|
|
|
* (C) 2017-2019 by Harald Welte <laforge@gnumonks.org>
|
|
|
|
* contributions by sysmocom - s.f.m.c. GmbH
|
2018-01-03 20:07:52 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Released under the terms of GNU General Public License, Version 2 or
|
|
|
|
* (at your option) any later version.
|
2019-05-27 09:54:11 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2018-01-03 20:07:52 +00:00
|
|
|
*/
|
2017-12-09 00:15:44 +00:00
|
|
|
|
2017-11-21 23:45:07 +00:00
|
|
|
import from IPA_Types all;
|
|
|
|
import from IPA_CodecPort all;
|
|
|
|
import from IPA_CodecPort_CtrlFunct all;
|
|
|
|
import from IPL4asp_Types all;
|
2017-11-29 10:47:13 +00:00
|
|
|
import from IPL4asp_PortType all;
|
2018-02-20 14:49:30 +00:00
|
|
|
import from Socket_API_Definitions all;
|
|
|
|
|
|
|
|
#ifdef IPA_EMULATION_SCCP
|
2017-11-21 23:45:07 +00:00
|
|
|
import from MTP3asp_Types all;
|
|
|
|
import from MTP3asp_PortType all;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef IPA_EMULATION_RSL
|
2017-12-07 16:58:28 +00:00
|
|
|
import from RSL_Types all;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-11-21 23:45:07 +00:00
|
|
|
|
2019-02-06 21:26:46 +00:00
|
|
|
#ifdef IPA_EMULATION_OML
|
|
|
|
import from AbisOML_Types all;
|
|
|
|
#endif
|
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_MGCP
|
2017-11-24 19:40:12 +00:00
|
|
|
import from MGCP_Types all;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef IPA_EMULATION_GSUP
|
2017-12-28 21:51:51 +00:00
|
|
|
import from GSUP_Types all;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-11-24 19:40:12 +00:00
|
|
|
|
2018-10-10 10:28:27 +00:00
|
|
|
#ifdef IPA_EMULATION_RSPRO
|
|
|
|
import from RSPRO all;
|
|
|
|
import from RSPRO_Types all;
|
|
|
|
#endif
|
|
|
|
|
2019-08-18 17:36:10 +00:00
|
|
|
#ifdef IPA_EMULATION_CTRL
|
2017-12-09 01:06:07 +00:00
|
|
|
import from Osmocom_CTRL_Types all;
|
2019-08-18 17:36:10 +00:00
|
|
|
#endif
|
2017-12-09 01:06:07 +00:00
|
|
|
|
2021-06-09 14:19:26 +00:00
|
|
|
#ifdef IPA_EMULATION_OSMO_PCU
|
|
|
|
import from PCUIF_Types all;
|
|
|
|
#endif
|
|
|
|
|
2017-11-21 23:45:07 +00:00
|
|
|
modulepar {
|
2017-11-25 01:31:20 +00:00
|
|
|
/* Use Osmocom extended IPA mux header */
|
|
|
|
boolean mp_ipa_mgcp_uses_osmo_ext := true;
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
|
2017-11-23 17:22:10 +00:00
|
|
|
type enumerated IpaMode {
|
|
|
|
IPA_MODE_CLIENT,
|
|
|
|
IPA_MODE_SERVER
|
|
|
|
}
|
|
|
|
|
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
|
|
|
type enumerated IpaInitBehavior {
|
|
|
|
IPA_INIT_SEND_IPA_ID_GET,
|
|
|
|
IPA_INIT_SEND_IPA_ID_ACK
|
|
|
|
}
|
|
|
|
|
2017-11-22 11:46:46 +00:00
|
|
|
type record ASP_IPA_Unitdata {
|
|
|
|
IpaStreamId streamId,
|
2017-11-24 19:40:12 +00:00
|
|
|
IpaExtStreamId streamIdExt optional,
|
2017-11-22 11:46:46 +00:00
|
|
|
octetstring payload
|
|
|
|
}
|
|
|
|
|
2020-05-18 13:17:25 +00:00
|
|
|
type enumerated ASP_IPA_EventType {
|
2017-12-07 16:58:28 +00:00
|
|
|
ASP_IPA_EVENT_DOWN,
|
|
|
|
ASP_IPA_EVENT_UP,
|
2020-05-24 15:26:54 +00:00
|
|
|
ASP_IPA_EVENT_ID_RESP,
|
2017-12-07 16:58:28 +00:00
|
|
|
ASP_IPA_EVENT_ID_ACK
|
|
|
|
}
|
|
|
|
|
2017-12-09 00:15:44 +00:00
|
|
|
/* an event indicating us whether or not a connection is physically up or down,
|
2020-05-24 15:26:54 +00:00
|
|
|
* and whether we have received an ID_RESP or ID_ACK */
|
2020-05-18 14:50:12 +00:00
|
|
|
type record ASP_IPA_Event {
|
|
|
|
ASP_IPA_EventType ev_type,
|
2020-05-24 15:26:54 +00:00
|
|
|
integer conn_id,
|
|
|
|
|
|
|
|
/* Presence of these fields depends on event type */
|
|
|
|
IpaCcmIdResp id_resp optional // ASP_IPA_EVENT_ID_RESP
|
2017-12-07 16:58:28 +00:00
|
|
|
}
|
|
|
|
|
2020-05-24 15:26:54 +00:00
|
|
|
template (value) ASP_IPA_Event ts_ASP_IPA_EV(ASP_IPA_EventType ev_type, integer conn_id,
|
|
|
|
template (omit) IpaCcmIdResp id_resp := omit) := {
|
2020-05-18 14:50:12 +00:00
|
|
|
ev_type := ev_type,
|
2020-05-24 15:26:54 +00:00
|
|
|
conn_id := conn_id,
|
|
|
|
id_resp := id_resp
|
2020-05-18 13:44:14 +00:00
|
|
|
}
|
|
|
|
|
2020-05-18 14:50:12 +00:00
|
|
|
template ASP_IPA_Event tr_ASP_IPA_EV(template ASP_IPA_EventType ev_type,
|
2020-05-24 15:26:54 +00:00
|
|
|
template integer conn_id := ?,
|
|
|
|
template IpaCcmIdResp id_resp := *) := {
|
2020-05-18 14:50:12 +00:00
|
|
|
ev_type := ev_type,
|
2020-05-24 15:26:54 +00:00
|
|
|
conn_id := conn_id,
|
|
|
|
id_resp := id_resp
|
2017-12-07 16:58:28 +00:00
|
|
|
}
|
|
|
|
|
2017-11-25 01:25:27 +00:00
|
|
|
template ASP_IPA_Unitdata t_ASP_IPA_UD(IpaStreamId sid, octetstring pl,
|
|
|
|
template IpaExtStreamId esid := omit) := {
|
|
|
|
streamId := sid,
|
|
|
|
streamIdExt := esid,
|
|
|
|
payload := pl
|
|
|
|
}
|
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_RSL
|
2017-12-09 00:15:44 +00:00
|
|
|
/* like ASP_IPA_Unitdata, but with RSL_Message abstract type instead of octetstring */
|
2017-12-07 16:58:28 +00:00
|
|
|
type record ASP_RSL_Unitdata {
|
2020-05-25 12:01:04 +00:00
|
|
|
integer conn_id optional,
|
2017-12-07 16:58:28 +00:00
|
|
|
IpaStreamId streamId,
|
|
|
|
RSL_Message rsl
|
|
|
|
};
|
|
|
|
|
2020-05-25 14:40:52 +00:00
|
|
|
template (value) ASP_RSL_Unitdata ts_ASP_RSL_UD(template (value) RSL_Message rsl,
|
2020-05-25 12:01:04 +00:00
|
|
|
IpaStreamId sid := IPAC_PROTO_RSL_TRX0,
|
|
|
|
template (omit) integer conn_id := omit) := {
|
|
|
|
conn_id := conn_id,
|
2017-12-07 16:58:28 +00:00
|
|
|
streamId := sid,
|
2020-05-25 14:23:46 +00:00
|
|
|
rsl := rsl
|
2017-12-07 16:58:28 +00:00
|
|
|
}
|
|
|
|
|
2020-05-25 14:40:52 +00:00
|
|
|
template ASP_RSL_Unitdata tr_ASP_RSL_UD(template (present) RSL_Message rsl,
|
2020-05-25 12:01:04 +00:00
|
|
|
template IpaStreamId sid := IPAC_PROTO_RSL_TRX0,
|
|
|
|
template integer conn_id := *) := {
|
|
|
|
conn_id := conn_id,
|
2017-12-08 23:54:15 +00:00
|
|
|
streamId := sid,
|
|
|
|
rsl := rsl
|
|
|
|
}
|
|
|
|
|
2017-12-07 16:58:28 +00:00
|
|
|
template IpaStreamId t_IpaSidRSL := ( IPAC_PROTO_RSL_TRX0, IPAC_PROTO_RSL_TRX1,
|
|
|
|
IPAC_PROTO_RSL_TRX2, IPAC_PROTO_RSL_TRX3 );
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-12-07 16:58:28 +00:00
|
|
|
|
2019-02-06 21:26:46 +00:00
|
|
|
|
2017-12-09 00:15:44 +00:00
|
|
|
/* Client port for general IPA messages, not further decoded */
|
2017-11-22 11:46:46 +00:00
|
|
|
type port IPA_SP_PT message {
|
2017-12-07 16:58:28 +00:00
|
|
|
inout ASP_IPA_Unitdata, ASP_IPA_Event;
|
2017-11-22 11:46:46 +00:00
|
|
|
} with { extension "internal" }
|
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_MGCP
|
2017-12-09 00:15:44 +00:00
|
|
|
/* Client port for MGCP inside IPA */
|
2017-11-24 19:40:12 +00:00
|
|
|
type port IPA_MGCP_PT message {
|
|
|
|
inout MgcpCommand, MgcpResponse;
|
|
|
|
} with { extension "internal" }
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-11-24 19:40:12 +00:00
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_RSL
|
2017-12-09 00:15:44 +00:00
|
|
|
/* Client port for A-bis RSL inside IPA */
|
2017-12-07 16:58:28 +00:00
|
|
|
type port IPA_RSL_PT message {
|
|
|
|
inout ASP_RSL_Unitdata, ASP_IPA_Event;
|
|
|
|
} with { extension "internal" }
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-12-07 16:58:28 +00:00
|
|
|
|
2019-02-06 21:26:46 +00:00
|
|
|
#ifdef IPA_EMULATION_OML
|
|
|
|
/* Client port for A-bis OML inside IPA */
|
|
|
|
type port IPA_OML_PT message {
|
|
|
|
inout OML_PDU, octetstring, ASP_IPA_Event;
|
|
|
|
} with { extension "internal" }
|
|
|
|
#endif
|
|
|
|
|
2019-08-18 17:36:10 +00:00
|
|
|
#ifdef IPA_EMULATION_CTRL
|
2017-12-09 01:06:07 +00:00
|
|
|
/* Client port for CTRL inside IPA */
|
|
|
|
type port IPA_CTRL_PT message {
|
|
|
|
inout CtrlMessage, ASP_IPA_Event;
|
|
|
|
} with { extension "internal" }
|
2019-08-18 17:36:10 +00:00
|
|
|
#endif
|
2017-12-09 01:06:07 +00:00
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_GSUP
|
2017-12-28 21:51:51 +00:00
|
|
|
/* Client port for CTRL inside IPA */
|
|
|
|
type port IPA_GSUP_PT message {
|
|
|
|
inout GSUP_PDU, ASP_IPA_Event;
|
|
|
|
} with { extension "internal" }
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-12-28 21:51:51 +00:00
|
|
|
|
2018-10-10 10:28:27 +00:00
|
|
|
#ifdef IPA_EMULATION_RSPRO
|
|
|
|
type port IPA_RSPRO_PT message {
|
|
|
|
inout RsproPDU, ASP_IPA_Event;
|
|
|
|
} with { extension "internal" }
|
|
|
|
#endif
|
|
|
|
|
2021-06-09 14:19:26 +00:00
|
|
|
#ifdef IPA_EMULATION_OSMO_PCU
|
|
|
|
/* Client port for Osmocom PCU extension inside IPA */
|
|
|
|
type port IPA_OSMO_PCU_PT message {
|
|
|
|
inout PCUIF_Message, ASP_IPA_Event;
|
|
|
|
} with { extension "internal" }
|
|
|
|
#endif
|
2018-10-10 10:28:27 +00:00
|
|
|
|
|
|
|
|
2017-12-28 21:51:51 +00:00
|
|
|
|
2017-11-21 23:45:07 +00:00
|
|
|
type component IPA_Emulation_CT {
|
|
|
|
/* down-facing port to IPA codec port */
|
|
|
|
port IPA_CODEC_PT IPA_PORT;
|
2022-01-11 11:48:34 +00:00
|
|
|
/* Down facing port to configure the component */
|
|
|
|
port IPA_CFG_PT CFG_PORT;
|
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_SCCP
|
2017-11-21 23:45:07 +00:00
|
|
|
/* up-facing port to SCCP */
|
|
|
|
port MTP3asp_SP_PT MTP3_SP_PORT;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_MGCP
|
2017-11-24 19:40:12 +00:00
|
|
|
/* up-facing port for MGCP */
|
|
|
|
port IPA_MGCP_PT IPA_MGCP_PORT;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_RSL
|
2017-12-07 16:58:28 +00:00
|
|
|
/* up-facing port for RSL */
|
|
|
|
port IPA_RSL_PT IPA_RSL_PORT;
|
2019-02-06 21:26:46 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_OML
|
|
|
|
/* up-facing port for OML */
|
|
|
|
port IPA_OML_PT IPA_OML_PORT;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2019-06-11 13:35:19 +00:00
|
|
|
#ifdef IPA_EMULATION_CTRL
|
2017-12-09 01:06:07 +00:00
|
|
|
/* up-facing port for CTRL */
|
|
|
|
port IPA_CTRL_PT IPA_CTRL_PORT;
|
2019-06-11 13:35:19 +00:00
|
|
|
#endif
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_GSUP
|
2017-12-28 21:51:51 +00:00
|
|
|
/* up-facing port for GSUP */
|
|
|
|
port IPA_GSUP_PT IPA_GSUP_PORT;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2018-10-10 10:28:27 +00:00
|
|
|
#ifdef IPA_EMULATION_RSPRO
|
|
|
|
/* up-facing port for RSPRO */
|
|
|
|
port IPA_RSPRO_PT IPA_RSPRO_PORT;
|
|
|
|
#endif
|
2021-06-09 14:19:26 +00:00
|
|
|
#ifdef IPA_EMULATION_OSMO_PCU
|
|
|
|
/* up-facing port for RSPRO */
|
|
|
|
port IPA_OSMO_PCU_PT IPA_OSMO_PCU_PORT;
|
|
|
|
#endif
|
2017-12-28 21:51:51 +00:00
|
|
|
|
2017-11-22 11:46:46 +00:00
|
|
|
/* up-facing port for other streams */
|
|
|
|
port IPA_SP_PT IPA_SP_PORT;
|
2017-11-21 23:45:07 +00:00
|
|
|
|
|
|
|
var boolean g_initialized := false;
|
2017-11-24 19:40:12 +00:00
|
|
|
/* Are we a BSC/MGW (truel) or MSC (false) */
|
|
|
|
var boolean g_is_bsc_mgw;
|
2017-11-23 17:22:10 +00:00
|
|
|
|
2020-05-18 14:50:12 +00:00
|
|
|
/* Connection identifier of the client / server itself */
|
|
|
|
var IPL4asp_Types.ConnectionId g_self_conn_id := -1;
|
|
|
|
/* Connection identifier of the last connected client (server only) */
|
|
|
|
var IPL4asp_Types.ConnectionId g_last_conn_id := -1;
|
|
|
|
|
2017-11-23 17:22:10 +00:00
|
|
|
var IpaMode g_mode;
|
2018-04-17 09:23:04 +00:00
|
|
|
var boolean g_ccm_enabled;
|
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
|
|
|
var IpaInitBehavior g_init_behavior;
|
2021-01-28 18:53:21 +00:00
|
|
|
/* Shall we stop the component once the client disconnects, or keep
|
|
|
|
* running to let next user in ? */
|
|
|
|
var boolean g_server_stop_on_ipa_ev_down := true;
|
2017-12-07 16:49:00 +00:00
|
|
|
var IPA_CCM_Parameters g_ccm_pars := c_IPA_default_ccm_pars;
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
|
2017-12-04 19:45:12 +00:00
|
|
|
type record IPA_CCM_Parameters {
|
|
|
|
charstring ser_nr optional,
|
|
|
|
charstring name optional,
|
|
|
|
charstring location1 optional,
|
|
|
|
charstring location2 optional,
|
|
|
|
charstring equip_version optional,
|
|
|
|
charstring sw_version optional,
|
|
|
|
charstring ip_addr optional,
|
|
|
|
charstring mac_addr optional,
|
|
|
|
charstring unit_id optional,
|
|
|
|
charstring osmo_rand optional
|
|
|
|
}
|
|
|
|
|
2017-12-07 16:49:00 +00:00
|
|
|
const IPA_CCM_Parameters c_IPA_default_ccm_pars := {
|
|
|
|
ser_nr := "",
|
2017-12-04 19:45:12 +00:00
|
|
|
name := "mahlzeit",
|
2017-12-07 16:49:00 +00:00
|
|
|
location1 := "",
|
|
|
|
location2 := "",
|
|
|
|
equip_version := "",
|
|
|
|
sw_version := "",
|
|
|
|
ip_addr := "",
|
|
|
|
mac_addr := "",
|
2017-12-04 19:45:12 +00:00
|
|
|
unit_id := "0/1/2",
|
2017-12-07 16:49:00 +00:00
|
|
|
osmo_rand := ""
|
2017-12-04 19:45:12 +00:00
|
|
|
};
|
|
|
|
|
2022-01-11 11:48:34 +00:00
|
|
|
signature IPA_CFG_disconnect(inout IPL4asp_Types.Result res);
|
|
|
|
type port IPA_CFG_PT procedure {
|
|
|
|
inout IPA_CFG_disconnect;
|
|
|
|
} with { extension "internal" };
|
|
|
|
|
|
|
|
function f_ipa_cfg_disconnect(IPA_CFG_PT pt, inout IPL4asp_Types.Result res) {
|
|
|
|
pt.call(IPA_CFG_disconnect:{res}) {
|
|
|
|
[] pt.getreply(IPA_CFG_disconnect:{?}) -> param (res) {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-09 00:15:44 +00:00
|
|
|
/* Function to use to connect as client to a remote IPA Server */
|
2018-02-12 20:08:28 +00:00
|
|
|
function f_connect(charstring remote_host, IPL4asp_Types.PortNumber remote_port,
|
|
|
|
charstring local_host, IPL4asp_Types.PortNumber local_port,
|
2017-12-07 16:49:00 +00:00
|
|
|
IPA_CCM_Parameters ccm_pars := c_IPA_default_ccm_pars) runs on IPA_Emulation_CT {
|
2018-02-12 20:08:28 +00:00
|
|
|
var IPL4asp_Types.Result res;
|
2017-11-21 23:45:07 +00:00
|
|
|
res := IPA_CodecPort_CtrlFunct.f_IPL4_connect(IPA_PORT, remote_host, remote_port,
|
|
|
|
local_host, local_port, 0, { tcp:={} });
|
2018-05-23 18:27:02 +00:00
|
|
|
if (not ispresent(res.connId)) {
|
2018-08-31 13:05:39 +00:00
|
|
|
setverdict(fail, "Could not connect IPA socket from ", local_host, " port ", local_port,
|
|
|
|
" to ", remote_host, " port ", remote_port, "; check your configuration");
|
2018-07-05 15:35:03 +00:00
|
|
|
mtc.stop;
|
2018-05-23 18:27:02 +00:00
|
|
|
}
|
2020-05-18 14:50:12 +00:00
|
|
|
g_self_conn_id := res.connId;
|
2017-12-04 19:45:12 +00:00
|
|
|
g_ccm_pars := ccm_pars;
|
2017-11-24 19:40:12 +00:00
|
|
|
g_is_bsc_mgw := true;
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
|
2017-12-09 00:15:44 +00:00
|
|
|
/* Function to use to bind to a local port as IPA server, accepting remote clients */
|
2018-02-12 20:08:28 +00:00
|
|
|
function f_bind(charstring local_host, IPL4asp_Types.PortNumber local_port,
|
2017-12-07 16:49:00 +00:00
|
|
|
IPA_CCM_Parameters ccm_pars := c_IPA_default_ccm_pars) runs on IPA_Emulation_CT {
|
2018-02-12 20:08:28 +00:00
|
|
|
var IPL4asp_Types.Result res;
|
2019-06-10 09:00:33 +00:00
|
|
|
res := IPA_CodecPort_CtrlFunct.f_IPL4_listen(IPA_PORT,
|
2017-11-23 17:22:10 +00:00
|
|
|
local_host, local_port, { tcp:={} });
|
2018-05-23 18:27:02 +00:00
|
|
|
if (not ispresent(res.connId)) {
|
2019-03-11 14:22:02 +00:00
|
|
|
setverdict(fail, "Could not listen IPA socket ", local_host, ":", local_port, ", check your configuration");
|
2018-07-05 15:35:03 +00:00
|
|
|
mtc.stop;
|
2018-05-23 18:27:02 +00:00
|
|
|
}
|
2020-05-18 14:50:12 +00:00
|
|
|
g_self_conn_id := res.connId;
|
2017-12-04 19:45:12 +00:00
|
|
|
g_ccm_pars := ccm_pars;
|
2017-11-24 19:40:12 +00:00
|
|
|
g_is_bsc_mgw := false;
|
2017-11-23 17:22:10 +00:00
|
|
|
}
|
|
|
|
|
2022-01-11 11:48:34 +00:00
|
|
|
private function f_close() runs on IPA_Emulation_CT return IPL4asp_Types.Result {
|
|
|
|
var IPL4asp_Types.Result res;
|
|
|
|
select (g_mode) {
|
|
|
|
case (IPA_MODE_CLIENT) {
|
|
|
|
res := IPA_CodecPort_CtrlFunct.f_IPL4_close(IPA_PORT, g_self_conn_id, {tcp := {}});
|
|
|
|
g_self_conn_id := -1;
|
|
|
|
}
|
|
|
|
case (IPA_MODE_SERVER) {
|
|
|
|
res := IPA_CodecPort_CtrlFunct.f_IPL4_close(IPA_PORT, g_last_conn_id, {tcp := {}});
|
|
|
|
g_last_conn_id := -1;
|
|
|
|
}
|
|
|
|
case else {
|
|
|
|
setverdict(fail, "Unknown mode");
|
|
|
|
mtc.stop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_SCCP
|
2017-11-21 23:45:07 +00:00
|
|
|
template ASP_MTP3_TRANSFERind ts_MTP3_XFER_ind(integer opc, octetstring data) := {
|
|
|
|
sio := { '10'B, '00'B, '0011'B },
|
|
|
|
opc := opc,
|
|
|
|
dpc := 0,
|
|
|
|
sls := 0,
|
|
|
|
data := data
|
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-11-21 23:45:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
private template IpaCcmRespPart t_IdRespPart(IpaCcmIdTag tag, charstring payload) := {
|
|
|
|
len := 0, /* overwritten by codec */
|
|
|
|
tag := tag,
|
2018-08-02 13:05:43 +00:00
|
|
|
data := char2oct(payload) & '00'O
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
|
2020-05-18 13:44:14 +00:00
|
|
|
private function f_send_IPA_EVT(template (value) ASP_IPA_Event evt) runs on IPA_Emulation_CT {
|
2018-05-24 18:00:00 +00:00
|
|
|
if (IPA_SP_PORT.checkstate("Connected")) {
|
|
|
|
IPA_SP_PORT.send(evt);
|
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_RSL
|
2017-12-09 01:55:46 +00:00
|
|
|
if (IPA_RSL_PORT.checkstate("Connected")) {
|
|
|
|
IPA_RSL_PORT.send(evt);
|
|
|
|
}
|
2019-02-06 21:26:46 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_OML
|
|
|
|
if (IPA_OML_PORT.checkstate("Connected")) {
|
|
|
|
IPA_OML_PORT.send(evt);
|
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2019-06-11 13:35:19 +00:00
|
|
|
#ifdef IPA_EMULATION_CTRL
|
2017-12-09 01:55:46 +00:00
|
|
|
if (IPA_CTRL_PORT.checkstate("Connected")) {
|
|
|
|
IPA_CTRL_PORT.send(evt);
|
|
|
|
}
|
2019-06-11 13:35:19 +00:00
|
|
|
#endif
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_GSUP
|
2017-12-28 21:51:51 +00:00
|
|
|
if (IPA_GSUP_PORT.checkstate("Connected")) {
|
|
|
|
IPA_GSUP_PORT.send(evt);
|
|
|
|
}
|
2018-10-10 10:28:27 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_RSPRO
|
|
|
|
if (IPA_RSPRO_PORT.checkstate("Connected")) {
|
|
|
|
IPA_RSPRO_PORT.send(evt);
|
|
|
|
}
|
2021-06-09 14:19:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_OSMO_PCU
|
|
|
|
if (IPA_OSMO_PCU_PORT.checkstate("Connected")) {
|
|
|
|
IPA_OSMO_PCU_PORT.send(evt);
|
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-12-07 16:58:28 +00:00
|
|
|
/* FIXME: to other ports */
|
|
|
|
}
|
|
|
|
|
2017-11-21 23:45:07 +00:00
|
|
|
/* build IPA CCM ID RESP response from IPA CCM GET */
|
2017-12-04 19:45:12 +00:00
|
|
|
private function f_ccm_make_id_resp(PDU_IPA_CCM get) runs on IPA_Emulation_CT return PDU_IPA_CCM {
|
2017-11-21 23:45:07 +00:00
|
|
|
var integer i;
|
|
|
|
var PDU_IPA_CCM resp := {
|
|
|
|
msg_type := IPAC_MSGT_ID_RESP,
|
|
|
|
u := {
|
|
|
|
resp := {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i := 0; i < sizeof(get.u.get); i := i + 1) {
|
|
|
|
var IpaCcmIdTag tag := get.u.get[i].tag;
|
|
|
|
var charstring foo;
|
|
|
|
select (tag) {
|
2017-12-04 19:45:12 +00:00
|
|
|
case (IPAC_IDTAG_SERNR) {
|
|
|
|
foo := g_ccm_pars.ser_nr;
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
case (IPAC_IDTAG_UNITNAME) {
|
2017-12-04 19:45:12 +00:00
|
|
|
foo := g_ccm_pars.name;
|
|
|
|
}
|
|
|
|
case (IPAC_IDTAG_LOCATION1) {
|
|
|
|
foo := g_ccm_pars.location1;
|
|
|
|
}
|
|
|
|
case (IPAC_IDTAG_LOCATION2) {
|
|
|
|
foo := g_ccm_pars.location2;
|
|
|
|
}
|
|
|
|
case (IPAC_IDTAG_EQUIPVERS) {
|
|
|
|
foo := g_ccm_pars.equip_version;
|
|
|
|
}
|
|
|
|
case (IPAC_IDTAG_SWVERSION) {
|
|
|
|
foo := g_ccm_pars.sw_version;
|
|
|
|
}
|
|
|
|
case (IPAC_IDTAG_IPADDR) {
|
|
|
|
foo := g_ccm_pars.ip_addr;
|
|
|
|
}
|
|
|
|
case (IPAC_IDTAG_MACADDR) {
|
|
|
|
foo := g_ccm_pars.mac_addr;
|
|
|
|
}
|
2020-05-24 13:49:29 +00:00
|
|
|
case (IPAC_IDTAG_UNITID) {
|
2017-12-04 19:45:12 +00:00
|
|
|
foo := g_ccm_pars.unit_id;
|
|
|
|
}
|
|
|
|
case (IPAC_IDTAG_OSMO_RAND) {
|
|
|
|
foo := g_ccm_pars.osmo_rand;
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
case else {
|
2017-12-04 19:45:12 +00:00
|
|
|
foo := "unknown";
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
resp.u.resp[sizeof(resp.u.resp)] := valueof(t_IdRespPart(tag, foo));
|
|
|
|
}
|
|
|
|
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* transmit IPA CCM message */
|
2020-05-18 14:50:12 +00:00
|
|
|
private function f_ccm_tx(PDU_IPA_CCM ccm, IPL4asp_Types.ConnectionId conn_id)
|
|
|
|
runs on IPA_Emulation_CT {
|
|
|
|
var IPA_Send ipa_tx := valueof(t_IPA_Send(conn_id, IPAC_PROTO_CCM, enc_PDU_IPA_CCM(ccm)));
|
2017-11-21 23:45:07 +00:00
|
|
|
log("CCM Tx:", ccm);
|
|
|
|
IPA_PORT.send(ipa_tx);
|
|
|
|
}
|
|
|
|
|
|
|
|
template PDU_IPA_CCM ts_IPA_PONG := {
|
|
|
|
msg_type := IPAC_MSGT_PONG,
|
|
|
|
u := omit
|
|
|
|
}
|
|
|
|
|
|
|
|
template PDU_IPA_CCM ts_IPA_ACK := {
|
|
|
|
msg_type := IPAC_MSGT_ID_ACK,
|
|
|
|
u := omit
|
|
|
|
}
|
|
|
|
|
2017-11-23 17:22:10 +00:00
|
|
|
template PDU_IPA_CCM ts_IPA_ID_GET := {
|
|
|
|
msg_type := IPAC_MSGT_ID_GET,
|
|
|
|
u := {
|
|
|
|
get := {
|
2020-05-24 13:51:24 +00:00
|
|
|
{ 1, IPAC_IDTAG_UNITNAME },
|
|
|
|
{ 1, IPAC_IDTAG_UNITID }
|
2017-11-23 17:22:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-24 15:26:54 +00:00
|
|
|
template PDU_IPA_CCM tr_IPA_ID_RESP := {
|
|
|
|
msg_type := IPAC_MSGT_ID_RESP,
|
|
|
|
u := {
|
|
|
|
resp := {
|
|
|
|
{ ?, IPAC_IDTAG_UNITNAME, ? },
|
|
|
|
{ ?, IPAC_IDTAG_UNITID, ? }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-21 23:45:07 +00:00
|
|
|
/* receive IPA CCM message */
|
2018-04-17 09:23:04 +00:00
|
|
|
private function f_ccm_rx_client(PDU_IPA_CCM ccm) runs on IPA_Emulation_CT {
|
2017-11-21 23:45:07 +00:00
|
|
|
select (ccm.msg_type) {
|
|
|
|
case (IPAC_MSGT_PING) {
|
2020-05-18 14:50:12 +00:00
|
|
|
f_ccm_tx(valueof(ts_IPA_PONG), g_self_conn_id);
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
case (IPAC_MSGT_ID_ACK) {
|
2020-05-18 14:50:12 +00:00
|
|
|
f_send_IPA_EVT(ts_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK, g_self_conn_id));
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
case (IPAC_MSGT_ID_GET) {
|
2020-05-18 14:50:12 +00:00
|
|
|
f_ccm_tx(f_ccm_make_id_resp(ccm), g_self_conn_id);
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
2018-04-17 09:23:04 +00:00
|
|
|
case else {
|
|
|
|
log("Unknown/unsupported IPA CCM message type", ccm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-18 14:50:12 +00:00
|
|
|
private function f_ccm_rx_server(PDU_IPA_CCM ccm, IPL4asp_Types.ConnectionId conn_id)
|
|
|
|
runs on IPA_Emulation_CT {
|
2018-04-17 09:23:04 +00:00
|
|
|
select (ccm.msg_type) {
|
|
|
|
case (IPAC_MSGT_PING) {
|
2020-05-18 14:50:12 +00:00
|
|
|
f_ccm_tx(valueof(ts_IPA_PONG), conn_id);
|
2018-04-17 09:23:04 +00:00
|
|
|
}
|
|
|
|
case (IPAC_MSGT_ID_ACK) {
|
|
|
|
/* the IPA server should at some point receive an ID_ACK from the client,
|
|
|
|
* in case of RSL/OML from nanoBTS, this is actually the first message after
|
|
|
|
* the TCP connection is established. Other implementations may differ.
|
|
|
|
* We currently ignore it completely - but actually we should make sure that
|
|
|
|
* one ID_ACK is received by the server at some point */
|
2020-05-18 14:50:12 +00:00
|
|
|
f_send_IPA_EVT(ts_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK, conn_id));
|
2018-04-17 09:23:04 +00:00
|
|
|
}
|
2018-02-21 11:18:46 +00:00
|
|
|
case (IPAC_MSGT_ID_RESP) {
|
|
|
|
log("IPA ID RESP: ", ccm.u.resp);
|
2020-05-24 15:26:54 +00:00
|
|
|
|
|
|
|
/* make sure that the response contains all fields we requested */
|
|
|
|
if (not match(ccm, tr_IPA_ID_RESP)) {
|
|
|
|
log("IPA identity response ", ccm.u.resp, " mismatch");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* forward to the upper layers, so they can map conn_id with unit_id */
|
|
|
|
f_send_IPA_EVT(ts_ASP_IPA_EV(ASP_IPA_EVENT_ID_RESP, conn_id, ccm.u.resp));
|
2018-04-17 09:23:04 +00:00
|
|
|
/* acknowledge any identity that the client may have sent */
|
2020-05-18 14:50:12 +00:00
|
|
|
f_ccm_tx(valueof(ts_IPA_ACK), conn_id);
|
2018-02-21 11:18:46 +00:00
|
|
|
}
|
2017-11-21 23:45:07 +00:00
|
|
|
case else {
|
|
|
|
log("Unknown/unsupported IPA CCM message type", ccm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-22 11:46:46 +00:00
|
|
|
private function f_to_asp(IPA_RecvFrom ipa_rx) return ASP_IPA_Unitdata {
|
|
|
|
var ASP_IPA_Unitdata ret := {
|
|
|
|
streamId := ipa_rx.streamId,
|
2017-11-23 20:11:34 +00:00
|
|
|
streamIdExt := ipa_rx.streamIdExt,
|
2017-11-22 11:46:46 +00:00
|
|
|
payload := ipa_rx.msg
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-02-12 20:08:28 +00:00
|
|
|
private function f_from_asp(IPL4asp_Types.ConnectionId connId, ASP_IPA_Unitdata ipa_tx) return IPA_Send {
|
2017-11-24 19:40:12 +00:00
|
|
|
var IPA_Send ret := valueof(t_IPA_Send(connId, ipa_tx.streamId, ipa_tx.payload,
|
|
|
|
ipa_tx.streamIdExt));
|
2017-11-22 11:46:46 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2017-11-21 23:45:07 +00:00
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_RSL
|
2018-02-12 20:08:28 +00:00
|
|
|
private function f_from_rsl(IPL4asp_Types.ConnectionId connId, ASP_RSL_Unitdata rsl_tx) return IPA_Send {
|
2017-12-07 16:58:28 +00:00
|
|
|
var octetstring payload := enc_RSL_Message(rsl_tx.rsl);
|
2020-05-25 12:01:04 +00:00
|
|
|
|
|
|
|
/* ASP_RSL_Unitdata may (optionally) contain TCP/IP connection ID */
|
|
|
|
if (rsl_tx.conn_id != omit) {
|
|
|
|
connId := rsl_tx.conn_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
return valueof(t_IPA_Send(connId, rsl_tx.streamId, payload));
|
2017-12-07 16:58:28 +00:00
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-12-07 16:58:28 +00:00
|
|
|
|
2019-02-06 21:26:46 +00:00
|
|
|
#ifdef IPA_EMULATION_OML
|
|
|
|
private function f_from_oml(IPL4asp_Types.ConnectionId connId, OML_PDU oml_tx) return IPA_Send {
|
|
|
|
var octetstring payload := enc_OML_PDU(oml_tx);
|
|
|
|
var IPA_Send ret := valueof(t_IPA_Send(connId, IPAC_PROTO_OML, payload));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-12-09 00:15:44 +00:00
|
|
|
/* main function to use for a client-side IPA implementation */
|
2018-02-12 20:08:28 +00:00
|
|
|
function main_client(charstring remote_host, IPL4asp_Types.PortNumber remote_port,
|
|
|
|
charstring local_host, IPL4asp_Types.PortNumber local_port,
|
2018-04-17 09:23:04 +00:00
|
|
|
IPA_CCM_Parameters ccm_pars := c_IPA_default_ccm_pars,
|
|
|
|
boolean ccm_enabled := true) runs on IPA_Emulation_CT {
|
2017-11-23 17:22:10 +00:00
|
|
|
g_mode := IPA_MODE_CLIENT;
|
2018-04-17 09:23:04 +00:00
|
|
|
g_ccm_enabled := ccm_enabled;
|
2017-12-07 16:49:00 +00:00
|
|
|
f_connect(remote_host, remote_port, local_host, local_port, ccm_pars);
|
2018-04-17 09:23:04 +00:00
|
|
|
if (g_ccm_enabled) {
|
|
|
|
/* we're a client: Send ID_ACK immediately after connect */
|
2020-05-18 14:50:12 +00:00
|
|
|
f_ccm_tx(valueof(ts_IPA_ACK), g_self_conn_id);
|
2018-04-17 09:23:04 +00:00
|
|
|
}
|
2020-05-18 14:50:12 +00:00
|
|
|
f_send_IPA_EVT(ts_ASP_IPA_EV(ASP_IPA_EVENT_UP, g_self_conn_id));
|
2017-11-23 17:22:10 +00:00
|
|
|
ScanEvents();
|
|
|
|
}
|
|
|
|
|
2017-12-09 00:15:44 +00:00
|
|
|
/* main function to use for a server-side IPA implementation */
|
2018-04-17 09:23:04 +00:00
|
|
|
function main_server(charstring local_host, IPL4asp_Types.PortNumber local_port,
|
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
|
|
|
boolean ccm_enabled := true,
|
2021-01-28 18:53:21 +00:00
|
|
|
IpaInitBehavior init_behavior := IPA_INIT_SEND_IPA_ID_GET,
|
|
|
|
boolean server_stop_on_ipa_ev_down := true)
|
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
|
|
|
runs on IPA_Emulation_CT {
|
2017-11-23 17:22:10 +00:00
|
|
|
g_mode := IPA_MODE_SERVER;
|
2018-04-17 09:23:04 +00:00
|
|
|
g_ccm_enabled := ccm_enabled;
|
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
|
|
|
g_init_behavior := init_behavior;
|
2021-01-28 18:53:21 +00:00
|
|
|
g_server_stop_on_ipa_ev_down := server_stop_on_ipa_ev_down;
|
2017-11-23 17:22:10 +00:00
|
|
|
f_bind(local_host, local_port);
|
|
|
|
ScanEvents();
|
|
|
|
}
|
|
|
|
|
2019-06-11 13:35:19 +00:00
|
|
|
#ifdef IPA_EMULATION_CTRL
|
2017-12-09 01:06:07 +00:00
|
|
|
private function f_ctrl_to_user(octetstring msg) runs on IPA_Emulation_CT {
|
|
|
|
var charstring msg_ch := oct2char(msg);
|
|
|
|
IPA_CTRL_PORT.send(dec_CtrlMessage(msg_ch));
|
|
|
|
}
|
2019-06-11 13:35:19 +00:00
|
|
|
#endif
|
2017-12-09 01:06:07 +00:00
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_GSUP
|
2017-12-28 21:51:51 +00:00
|
|
|
private function f_gsup_to_user(octetstring msg) runs on IPA_Emulation_CT {
|
2018-01-24 19:52:38 +00:00
|
|
|
var GSUP_PDU gsup := dec_GSUP_PDU(msg);
|
|
|
|
f_gsup_postprocess_decoded(gsup);
|
|
|
|
IPA_GSUP_PORT.send(gsup);
|
2017-12-28 21:51:51 +00:00
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
|
|
|
|
2018-10-10 10:28:27 +00:00
|
|
|
#ifdef IPA_EMULATION_RSPRO
|
|
|
|
private function f_rspro_to_user(octetstring msg) runs on IPA_Emulation_CT {
|
|
|
|
var RsproPDU rspro := dec_RsproPDU(msg);
|
|
|
|
IPA_RSPRO_PORT.send(rspro);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-06-09 14:19:26 +00:00
|
|
|
#ifdef IPA_EMULATION_OSMO_PCU
|
|
|
|
private function f_osmo_pcu_to_user(octetstring msg) runs on IPA_Emulation_CT {
|
|
|
|
var PCUIF_Message pcuif_msg := dec_PCUIF_Message(msg);
|
|
|
|
IPA_OSMO_PCU_PORT.send(pcuif_msg);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_MGCP
|
|
|
|
private function f_mgcp_to_user(octetstring msg) runs on IPA_Emulation_CT {
|
|
|
|
var charstring msg_ch := oct2char(msg);
|
|
|
|
if (g_is_bsc_mgw) {
|
|
|
|
log("============");
|
|
|
|
log(msg_ch);
|
|
|
|
IPA_MGCP_PORT.send(dec_MgcpCommand(msg_ch));
|
|
|
|
} else {
|
|
|
|
IPA_MGCP_PORT.send(dec_MgcpResponse(msg_ch));
|
|
|
|
}
|
|
|
|
}
|
2017-12-28 21:51:51 +00:00
|
|
|
|
2017-11-25 01:31:20 +00:00
|
|
|
private function f_mgcp_to_ud(octetstring payload) runs on IPA_Emulation_CT return ASP_IPA_Unitdata {
|
|
|
|
if (mp_ipa_mgcp_uses_osmo_ext) {
|
|
|
|
return valueof(t_ASP_IPA_UD(IPAC_PROTO_MGCP_OLD, payload));
|
|
|
|
} else {
|
|
|
|
return valueof(t_ASP_IPA_UD(IPAC_PROTO_OSMO, payload, IPAC_PROTO_EXT_MGCP));
|
|
|
|
}
|
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-11-25 01:31:20 +00:00
|
|
|
|
2020-05-18 14:50:12 +00:00
|
|
|
/* Resolve TCP/IP connection identifier depending on g_mode */
|
|
|
|
private function f_ipa_conn_id() runs on IPA_Emulation_CT
|
|
|
|
return IPL4asp_Types.ConnectionId {
|
|
|
|
var IPL4asp_Types.ConnectionId conn_id;
|
|
|
|
|
|
|
|
select (g_mode) {
|
|
|
|
case (IPA_MODE_CLIENT) { conn_id := g_self_conn_id; }
|
|
|
|
case (IPA_MODE_SERVER) { conn_id := g_last_conn_id; }
|
|
|
|
case else {
|
|
|
|
setverdict(fail, "Unknown mode");
|
|
|
|
mtc.stop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (conn_id == -1) { /* Just to be sure */
|
|
|
|
setverdict(fail, "Connection is not established");
|
|
|
|
mtc.stop;
|
|
|
|
}
|
|
|
|
|
|
|
|
return conn_id;
|
|
|
|
}
|
|
|
|
|
2017-12-09 00:15:44 +00:00
|
|
|
/* main loop function for both client and server. 'thread' of the component */
|
2017-11-23 17:22:10 +00:00
|
|
|
private function ScanEvents() runs on IPA_Emulation_CT {
|
2017-11-21 23:45:07 +00:00
|
|
|
var IPA_RecvFrom ipa_rx;
|
2017-11-23 17:22:10 +00:00
|
|
|
var ASP_Event asp_evt;
|
2018-02-12 20:08:28 +00:00
|
|
|
var Socket_API_Definitions.PortEvent port_evt;
|
2018-02-20 14:49:30 +00:00
|
|
|
var octetstring payload;
|
|
|
|
var ASP_IPA_Unitdata ipa_ud;
|
2022-01-11 11:48:34 +00:00
|
|
|
var IPL4asp_Types.Result res;
|
2019-08-18 17:36:10 +00:00
|
|
|
#ifdef IPA_EMULATION_CTRL
|
|
|
|
var CtrlMessage ctrl_msg;
|
|
|
|
#endif
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_SCCP
|
|
|
|
var ASP_MTP3_TRANSFERreq mtp_req;
|
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_MGCP
|
2017-11-24 19:40:12 +00:00
|
|
|
var MgcpCommand mgcp_cmd;
|
|
|
|
var MgcpResponse mgcp_rsp;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_GSUP
|
2017-12-28 21:51:51 +00:00
|
|
|
var GSUP_PDU gsup_msg;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_RSL
|
2017-12-07 16:58:28 +00:00
|
|
|
var ASP_RSL_Unitdata rsl;
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2019-02-06 21:26:46 +00:00
|
|
|
#ifdef IPA_EMULATION_OML
|
|
|
|
var OML_PDU oml;
|
|
|
|
#endif
|
2018-10-10 10:28:27 +00:00
|
|
|
#ifdef IPA_EMULATION_RSPRO
|
|
|
|
var RsproPDU rspro;
|
|
|
|
#endif
|
2021-06-09 14:19:26 +00:00
|
|
|
#ifdef IPA_EMULATION_OSMO_PCU
|
|
|
|
var PCUIF_Message pcu;
|
|
|
|
#endif
|
2017-11-21 23:45:07 +00:00
|
|
|
|
2017-12-12 13:39:46 +00:00
|
|
|
/* Set function for dissecting the binary */
|
|
|
|
var f_IPL4_getMsgLen vl_f := refers(f_IPL4_fixedMsgLen);
|
2020-05-18 14:50:12 +00:00
|
|
|
IPA_CodecPort_CtrlFunct.f_IPL4_setGetMsgLen(IPA_PORT, g_self_conn_id, vl_f, {0, 2, 3, 1, 0});
|
2017-12-12 13:39:46 +00:00
|
|
|
|
2017-11-21 23:45:07 +00:00
|
|
|
while (true) {
|
|
|
|
alt {
|
|
|
|
/* Received IPA -> up into SCCP stack */
|
2018-04-17 09:23:04 +00:00
|
|
|
[g_ccm_enabled] IPA_PORT.receive(IPA_RecvFrom:{?,IPAC_PROTO_CCM,omit,?}) -> value ipa_rx {
|
|
|
|
var PDU_IPA_CCM ccm := dec_PDU_IPA_CCM(ipa_rx.msg);
|
|
|
|
log("CCM Rx:", ccm);
|
|
|
|
select (g_mode) {
|
|
|
|
case (IPA_MODE_CLIENT) {
|
|
|
|
f_ccm_rx_client(ccm);
|
|
|
|
}
|
|
|
|
case (IPA_MODE_SERVER) {
|
2020-05-18 14:50:12 +00:00
|
|
|
f_ccm_rx_server(ccm, ipa_rx.connId);
|
2018-04-17 09:23:04 +00:00
|
|
|
}
|
|
|
|
case else {
|
|
|
|
setverdict(fail, "Unknown mode");
|
2018-07-05 15:35:03 +00:00
|
|
|
mtc.stop;
|
2018-04-17 09:23:04 +00:00
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
}
|
2018-04-17 09:23:04 +00:00
|
|
|
}
|
|
|
|
[] IPA_PORT.receive(IPA_RecvFrom:?) -> value ipa_rx {
|
|
|
|
select (ipa_rx.streamId) {
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_SCCP
|
|
|
|
case (IPAC_PROTO_SCCP) {
|
2017-11-21 23:45:07 +00:00
|
|
|
var ASP_MTP3_TRANSFERind mtp;
|
|
|
|
mtp := valueof(ts_MTP3_XFER_ind(0, ipa_rx.msg));
|
|
|
|
MTP3_SP_PORT.send(mtp);
|
2018-02-20 14:49:30 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_MGCP
|
|
|
|
case (IPAC_PROTO_MGCP_OLD) {
|
2017-11-24 19:40:12 +00:00
|
|
|
f_mgcp_to_user(ipa_rx.msg);
|
2018-02-20 14:49:30 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_RSL
|
|
|
|
case (t_IpaSidRSL) {
|
2020-05-25 12:01:04 +00:00
|
|
|
rsl := valueof(ts_ASP_RSL_UD(
|
|
|
|
rsl := dec_RSL_Message(ipa_rx.msg),
|
|
|
|
sid := ipa_rx.streamId,
|
|
|
|
conn_id := ipa_rx.connId
|
|
|
|
));
|
2017-12-07 16:58:28 +00:00
|
|
|
IPA_RSL_PORT.send(rsl);
|
2018-02-20 14:49:30 +00:00
|
|
|
}
|
2019-02-06 21:26:46 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_OML
|
|
|
|
case (IPAC_PROTO_OML) {
|
|
|
|
oml := dec_OML_PDU(ipa_rx.msg)
|
|
|
|
IPA_OML_PORT.send(oml);
|
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
|
|
|
case (IPAC_PROTO_OSMO) {
|
2017-11-24 19:40:12 +00:00
|
|
|
select (ipa_rx.streamIdExt) {
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_MGCP
|
2017-11-24 19:40:12 +00:00
|
|
|
case (IPAC_PROTO_EXT_MGCP) {
|
|
|
|
f_mgcp_to_user(ipa_rx.msg);
|
2018-02-20 14:49:30 +00:00
|
|
|
}
|
|
|
|
#endif
|
2019-08-18 17:36:10 +00:00
|
|
|
#ifdef IPA_EMULATION_CTRL
|
2018-02-20 14:49:30 +00:00
|
|
|
case (IPAC_PROTO_EXT_CTRL) {
|
2017-12-09 01:06:07 +00:00
|
|
|
f_ctrl_to_user(ipa_rx.msg);
|
2018-02-20 14:49:30 +00:00
|
|
|
}
|
2019-08-18 17:36:10 +00:00
|
|
|
#endif
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_GSUP
|
|
|
|
case (IPAC_PROTO_EXT_GSUP) {
|
2017-12-28 21:51:51 +00:00
|
|
|
f_gsup_to_user(ipa_rx.msg);
|
2018-02-20 14:49:30 +00:00
|
|
|
}
|
2018-10-10 10:28:27 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_RSPRO
|
|
|
|
case (IPAC_PROTO_EXT_RSPRO) {
|
|
|
|
f_rspro_to_user(ipa_rx.msg);
|
|
|
|
}
|
2021-06-09 14:19:26 +00:00
|
|
|
#endif
|
|
|
|
#ifdef IPA_EMULATION_OSMO_PCU
|
|
|
|
case (IPAC_PROTO_EXT_OSMO_PCU) {
|
|
|
|
f_osmo_pcu_to_user(ipa_rx.msg);
|
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
|
|
|
case else {
|
2017-11-24 19:40:12 +00:00
|
|
|
IPA_SP_PORT.send(f_to_asp(ipa_rx));
|
|
|
|
}
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
}
|
|
|
|
case else {
|
2017-11-22 11:46:46 +00:00
|
|
|
IPA_SP_PORT.send(f_to_asp(ipa_rx));
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-23 17:22:10 +00:00
|
|
|
/* server only */
|
|
|
|
[] IPA_PORT.receive(ASP_Event:{connOpened:=?}) -> value asp_evt {
|
2020-05-18 14:50:12 +00:00
|
|
|
g_last_conn_id := asp_evt.connOpened.connId;
|
|
|
|
log("Established a new IPA connection (conn_id=", g_last_conn_id, ")");
|
|
|
|
|
|
|
|
f_send_IPA_EVT(ts_ASP_IPA_EV(ASP_IPA_EVENT_UP, g_last_conn_id));
|
2018-04-17 09:23:04 +00:00
|
|
|
if (g_mode == IPA_MODE_SERVER and g_ccm_enabled) {
|
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
|
|
|
select (g_init_behavior) {
|
|
|
|
case (IPA_INIT_SEND_IPA_ID_GET) {
|
2020-05-18 14:50:12 +00:00
|
|
|
f_ccm_tx(valueof(ts_IPA_ID_GET), g_last_conn_id);
|
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
|
|
|
}
|
|
|
|
case (IPA_INIT_SEND_IPA_ID_ACK) {
|
2020-05-18 14:50:12 +00:00
|
|
|
f_ccm_tx(valueof(ts_IPA_ACK), g_last_conn_id);
|
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
|
|
|
}
|
|
|
|
}
|
2017-11-23 17:22:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[] IPA_PORT.receive(ASP_Event:{connClosed:=?}) -> value asp_evt {
|
|
|
|
log("IPA: Closed");
|
2020-05-18 14:50:12 +00:00
|
|
|
g_self_conn_id := -1;
|
|
|
|
f_send_IPA_EVT(ts_ASP_IPA_EV(ASP_IPA_EVENT_DOWN, asp_evt.connClosed.connId));
|
2021-01-28 18:53:21 +00:00
|
|
|
if (g_mode != IPA_MODE_SERVER or g_server_stop_on_ipa_ev_down) {
|
|
|
|
self.stop;
|
|
|
|
}
|
2017-11-23 17:22:10 +00:00
|
|
|
}
|
|
|
|
|
2018-02-12 20:08:28 +00:00
|
|
|
[] IPA_PORT.receive(Socket_API_Definitions.PortEvent:{result:={errorCode:=ERROR_SOCKET, connId:=?, os_error_code:=?, os_error_text:=?}}) -> value port_evt {
|
|
|
|
log("PortEvent: ERROR_SOCKET: ", port_evt);
|
2020-05-18 14:50:12 +00:00
|
|
|
g_self_conn_id := -1;
|
|
|
|
f_send_IPA_EVT(ts_ASP_IPA_EV(ASP_IPA_EVENT_DOWN, port_evt.result.connId));
|
2018-02-12 20:08:28 +00:00
|
|
|
self.stop;
|
|
|
|
}
|
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_SCCP
|
2017-11-21 23:45:07 +00:00
|
|
|
/* Received SCCP -> down into IPA */
|
|
|
|
[] MTP3_SP_PORT.receive(ASP_MTP3_TRANSFERreq: ?) -> value mtp_req {
|
2020-05-18 14:50:12 +00:00
|
|
|
var IPA_Send ipa_tx := valueof(t_IPA_Send(f_ipa_conn_id(), IPAC_PROTO_SCCP,
|
2017-11-24 19:40:12 +00:00
|
|
|
mtp_req.data));
|
2017-11-21 23:45:07 +00:00
|
|
|
IPA_PORT.send(ipa_tx);
|
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-11-22 11:46:46 +00:00
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_MGCP
|
2017-11-24 19:40:12 +00:00
|
|
|
/* Received MGCP -> down into IPA */
|
|
|
|
[] IPA_MGCP_PORT.receive(MgcpCommand:?) -> value mgcp_cmd {
|
2017-11-25 01:31:20 +00:00
|
|
|
payload := char2oct(enc_MgcpCommand(mgcp_cmd));
|
|
|
|
ipa_ud := f_mgcp_to_ud(payload);
|
2020-05-18 14:50:12 +00:00
|
|
|
IPA_PORT.send(f_from_asp(f_ipa_conn_id(), ipa_ud));
|
2017-11-24 19:40:12 +00:00
|
|
|
}
|
|
|
|
[] IPA_MGCP_PORT.receive(MgcpResponse:?) -> value mgcp_rsp {
|
2017-11-25 01:25:27 +00:00
|
|
|
payload := char2oct(enc_MgcpResponse(mgcp_rsp));
|
2017-11-25 01:31:20 +00:00
|
|
|
ipa_ud := f_mgcp_to_ud(payload);
|
2020-05-18 14:50:12 +00:00
|
|
|
IPA_PORT.send(f_from_asp(f_ipa_conn_id(), ipa_ud));
|
2017-11-24 19:40:12 +00:00
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-11-24 19:40:12 +00:00
|
|
|
|
2019-06-11 13:35:19 +00:00
|
|
|
#ifdef IPA_EMULATION_CTRL
|
2017-12-09 01:06:07 +00:00
|
|
|
[] IPA_CTRL_PORT.receive(CtrlMessage:?) -> value ctrl_msg {
|
|
|
|
payload := char2oct(enc_CtrlMessage(ctrl_msg));
|
|
|
|
ipa_ud := valueof(t_ASP_IPA_UD(IPAC_PROTO_OSMO, payload, IPAC_PROTO_EXT_CTRL));
|
2020-05-18 14:50:12 +00:00
|
|
|
IPA_PORT.send(f_from_asp(f_ipa_conn_id(), ipa_ud));
|
2017-12-09 01:06:07 +00:00
|
|
|
}
|
2019-06-11 13:35:19 +00:00
|
|
|
#endif
|
2017-12-09 01:06:07 +00:00
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_GSUP
|
2017-12-28 21:51:51 +00:00
|
|
|
[] IPA_GSUP_PORT.receive(GSUP_PDU:?) -> value gsup_msg {
|
2018-01-24 19:52:38 +00:00
|
|
|
f_gsup_preprocess_encoded(gsup_msg);
|
2017-12-28 21:51:51 +00:00
|
|
|
payload := enc_GSUP_PDU(gsup_msg);
|
|
|
|
ipa_ud := valueof(t_ASP_IPA_UD(IPAC_PROTO_OSMO, payload, IPAC_PROTO_EXT_GSUP));
|
2020-05-18 14:50:12 +00:00
|
|
|
IPA_PORT.send(f_from_asp(f_ipa_conn_id(), ipa_ud));
|
2017-12-28 21:51:51 +00:00
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2017-12-28 21:51:51 +00:00
|
|
|
|
2018-10-10 10:28:27 +00:00
|
|
|
#ifdef IPA_EMULATION_RSPRO
|
|
|
|
[] IPA_RSPRO_PORT.receive(RsproPDU:?) -> value rspro {
|
|
|
|
payload := enc_RsproPDU(rspro);
|
|
|
|
ipa_ud := valueof(t_ASP_IPA_UD(IPAC_PROTO_OSMO, payload, IPAC_PROTO_EXT_RSPRO));
|
2020-05-18 14:50:12 +00:00
|
|
|
IPA_PORT.send(f_from_asp(f_ipa_conn_id(), ipa_ud));
|
2018-10-10 10:28:27 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-06-09 14:19:26 +00:00
|
|
|
#ifdef IPA_EMULATION_OSMO_PCU
|
|
|
|
[] IPA_OSMO_PCU_PORT.receive(PCUIF_Message:?) -> value pcu {
|
|
|
|
payload := enc_PCUIF_Message(pcu);
|
|
|
|
ipa_ud := valueof(t_ASP_IPA_UD(IPAC_PROTO_OSMO, payload, IPAC_PROTO_EXT_OSMO_PCU));
|
|
|
|
IPA_PORT.send(f_from_asp(f_ipa_conn_id(), ipa_ud));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-02-20 14:49:30 +00:00
|
|
|
#ifdef IPA_EMULATION_RSL
|
2017-12-07 16:58:28 +00:00
|
|
|
/* Received RSL -> down into IPA */
|
|
|
|
[] IPA_RSL_PORT.receive(ASP_RSL_Unitdata:?) -> value rsl {
|
2020-05-18 14:50:12 +00:00
|
|
|
IPA_PORT.send(f_from_rsl(f_ipa_conn_id(), rsl));
|
2017-12-07 16:58:28 +00:00
|
|
|
}
|
2018-02-20 14:49:30 +00:00
|
|
|
#endif
|
2019-02-06 21:26:46 +00:00
|
|
|
#ifdef IPA_EMULATION_OML
|
|
|
|
/* Received OML -> down into IPA */
|
|
|
|
[] IPA_OML_PORT.receive(OML_PDU:?) -> value oml {
|
2020-05-18 14:50:12 +00:00
|
|
|
IPA_PORT.send(f_from_oml(f_ipa_conn_id(), oml));
|
2019-02-06 21:26:46 +00:00
|
|
|
}
|
|
|
|
[] IPA_OML_PORT.receive(octetstring:?) -> value payload {
|
2020-05-18 14:50:12 +00:00
|
|
|
IPA_PORT.send(t_IPA_Send(f_ipa_conn_id(), IPAC_PROTO_OML, payload));
|
2019-02-06 21:26:46 +00:00
|
|
|
}
|
|
|
|
#endif
|
2017-12-07 16:58:28 +00:00
|
|
|
/* Received MISC (OML/CTRL) -> down into IPA */
|
2017-11-22 11:46:46 +00:00
|
|
|
[] IPA_SP_PORT.receive(ASP_IPA_Unitdata: ?) -> value ipa_ud {
|
2020-05-18 14:50:12 +00:00
|
|
|
IPA_PORT.send(f_from_asp(f_ipa_conn_id(), ipa_ud));
|
2017-11-22 11:46:46 +00:00
|
|
|
}
|
|
|
|
|
2022-01-11 11:48:34 +00:00
|
|
|
/* Received call to configure/operate the component */
|
|
|
|
[] CFG_PORT.getcall(IPA_CFG_disconnect:{?}) {
|
|
|
|
res := f_close();
|
|
|
|
CFG_PORT.reply(IPA_CFG_disconnect:{res});
|
|
|
|
}
|
2017-11-22 11:46:46 +00:00
|
|
|
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-24 18:00:00 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* IPA Event waiter component. Wait for ASP_IPA_EVENT_ID_ACK
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
type component IPA_EventWaiter_CT {
|
|
|
|
port IPA_SP_PT IPA_SP_PORT;
|
|
|
|
}
|
|
|
|
|
2020-05-18 13:44:14 +00:00
|
|
|
function waiter_main(template ASP_IPA_Event wait_for := tr_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK))
|
2018-05-24 18:00:00 +00:00
|
|
|
runs on IPA_EventWaiter_CT {
|
|
|
|
|
|
|
|
alt {
|
|
|
|
[] IPA_SP_PORT.receive(wait_for) {
|
|
|
|
setverdict(pass);
|
|
|
|
}
|
|
|
|
[] IPA_SP_PORT.receive { repeat; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-11-21 23:45:07 +00:00
|
|
|
}
|