msc-vty-complete
This commit is contained in:
parent
50643e419d
commit
e198087a15
|
@ -484,16 +484,20 @@ struct gsm_network {
|
|||
} mgcpgw;
|
||||
|
||||
struct {
|
||||
/* CS7 instance id number (set via VTY) */
|
||||
uint32_t cs7_instance;
|
||||
enum nsap_addr_enc rab_assign_addr_enc;
|
||||
struct osmo_sccp_instance *sccp;
|
||||
} iu;
|
||||
|
||||
struct {
|
||||
/* CS7 instance id number (set via VTY) */
|
||||
uint32_t cs7_instance;
|
||||
/* A list with the context information about
|
||||
* all BSCs we have connections with */
|
||||
struct llist_head bscs;
|
||||
struct osmo_sccp_instance *sccp;
|
||||
} a;
|
||||
|
||||
struct osmo_sccp_instance *sccp;
|
||||
};
|
||||
|
||||
struct osmo_esme;
|
||||
|
|
|
@ -64,6 +64,26 @@ DEFUN(cfg_msc_no_assign_tmsi, cfg_msc_no_assign_tmsi_cmd,
|
|||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_msc_cs7_instance_a,
|
||||
cfg_msc_cs7_instance_a_cmd,
|
||||
"cs7-instance-a <0-15>",
|
||||
"Set SS7 to be used by the A-Interface.\n" "SS7 instance reference number\n")
|
||||
{
|
||||
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
|
||||
gsmnet->a.cs7_instance = atoi(argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN(cfg_msc_cs7_instance_iu,
|
||||
cfg_msc_cs7_instance_iu_cmd,
|
||||
"cs7-instance-iu <0-15>",
|
||||
"Set SS7 to be used by the Iu-Interface.\n" "SS7 instance reference number\n")
|
||||
{
|
||||
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
|
||||
gsmnet->iu.cs7_instance = atoi(argv[0]);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static int config_write_msc(struct vty *vty)
|
||||
{
|
||||
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
|
||||
|
@ -72,6 +92,11 @@ static int config_write_msc(struct vty *vty)
|
|||
vty_out(vty, " %sassign-tmsi%s",
|
||||
gsmnet->vlr->cfg.assign_tmsi? "" : "no ", VTY_NEWLINE);
|
||||
|
||||
vty_out(vty, " cs7-instance-a %u%s", gsmnet->a.cs7_instance,
|
||||
VTY_NEWLINE);
|
||||
vty_out(vty, " cs7-instance-iu %u%s", gsmnet->iu.cs7_instance,
|
||||
VTY_NEWLINE);
|
||||
|
||||
mgcpgw_client_config_write(vty, " ");
|
||||
iu_vty_config_write(vty, " ");
|
||||
|
||||
|
@ -121,6 +146,9 @@ void msc_vty_init(struct gsm_network *msc_network)
|
|||
vty_install_default(MSC_NODE);
|
||||
install_element(MSC_NODE, &cfg_msc_assign_tmsi_cmd);
|
||||
install_element(MSC_NODE, &cfg_msc_no_assign_tmsi_cmd);
|
||||
install_element(MSC_NODE, &cfg_msc_cs7_instance_a_cmd);
|
||||
install_element(MSC_NODE, &cfg_msc_cs7_instance_iu_cmd);
|
||||
|
||||
mgcpgw_client_vty_init(MSC_NODE, &msc_network->mgcpgw.conf);
|
||||
iu_vty_init(MSC_NODE, &msc_network->iu.rab_assign_addr_enc);
|
||||
}
|
||||
|
|
|
@ -337,6 +337,55 @@ static int rx_iu_event(struct ue_conn_ctx *ctx, enum iu_event_type type,
|
|||
return iucs_rx_ranap_event(msc_network, ctx, type, data);
|
||||
}
|
||||
|
||||
#define A_DEFAULT_PC 1
|
||||
#define A_DEFAULT_LOCAL_IP "127.0.0.3"
|
||||
#define A_DEFAULT_REMOTE_IP "127.0.0.1"
|
||||
#define IU_DEFAULT_PC 3
|
||||
#define IU_DEFAULT_LOCAL_IP "127.0.0.6"
|
||||
#define IU_DEFAULT_REMOTE_IP "127.0.0.1"
|
||||
|
||||
/* Setup sigtran connection */
|
||||
int ss7_setup(void *ctx)
|
||||
{
|
||||
uint32_t cs7_instance_a = msc_network->a.cs7_instance;
|
||||
uint32_t cs7_instance_iu = msc_network->iu.cs7_instance;
|
||||
|
||||
LOGP(DMSC, LOGL_NOTICE, "CS7 Instance identifier, A-Interface: %u\n",
|
||||
cs7_instance_a);
|
||||
LOGP(DMSC, LOGL_NOTICE, "CS7 Instance identifier, Iu-Interface: %u\n",
|
||||
cs7_instance_iu);
|
||||
|
||||
/* Create first SCCP instance (Iu) */
|
||||
msc_network->iu.sccp =
|
||||
osmo_sccp_simple_client_on_ss7_id(ctx, cs7_instance_iu,
|
||||
"OsmoMSC-Iu", IU_DEFAULT_PC,
|
||||
OSMO_SS7_ASP_PROT_M3UA, 0,
|
||||
IU_DEFAULT_LOCAL_IP, 0,
|
||||
IU_DEFAULT_REMOTE_IP);
|
||||
if (!msc_network->iu.sccp)
|
||||
return -EINVAL;
|
||||
|
||||
/* If the VTY settings indicate, that the user wants to use only a
|
||||
single cs7 instance (A and Iu are running on the same instance,
|
||||
we just copy the pointer and exit early */
|
||||
if (cs7_instance_a == cs7_instance_iu) {
|
||||
msc_network->a.sccp = msc_network->iu.sccp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create second SCCP instance (A) */
|
||||
msc_network->a.sccp =
|
||||
osmo_sccp_simple_client_on_ss7_id(ctx, cs7_instance_a,
|
||||
"OsmoMSC-A", A_DEFAULT_PC,
|
||||
OSMO_SS7_ASP_PROT_M3UA, 0,
|
||||
A_DEFAULT_LOCAL_IP, 0,
|
||||
A_DEFAULT_REMOTE_IP);
|
||||
if (!msc_network->a.sccp)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
|
@ -353,6 +402,7 @@ int main(int argc, char **argv)
|
|||
vty_init(&msc_vty_info);
|
||||
|
||||
osmo_ss7_init();
|
||||
osmo_ss7_vty_init_sg();
|
||||
|
||||
/* Parse options */
|
||||
handle_options(argc, argv);
|
||||
|
@ -495,22 +545,16 @@ TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_i
|
|||
return 7;
|
||||
}
|
||||
|
||||
/* Set up STP link to receive connections from BSC and HNBGW */
|
||||
msc_network->sccp = osmo_sccp_simple_client(tall_msc_ctx, "OsmoMSC",
|
||||
1 /* FIXME: configurable */,
|
||||
OSMO_SS7_ASP_PROT_M3UA, 0,
|
||||
"127.0.0.3" /* FIXME: configurable */,
|
||||
M3UA_PORT, "127.0.0.1" /* FIXME: configurable */);
|
||||
if (!msc_network->sccp) {
|
||||
if (ss7_setup(tall_msc_ctx)) {
|
||||
printf("Setting up SCCP client failed.\n");
|
||||
return 8;
|
||||
}
|
||||
|
||||
/* Set up IuCS */
|
||||
iu_init(tall_msc_ctx, msc_network->sccp, rcvmsg_iu_cs, rx_iu_event);
|
||||
iu_init(tall_msc_ctx, msc_network->iu.sccp, rcvmsg_iu_cs, rx_iu_event);
|
||||
|
||||
/* Set up A interface */
|
||||
a_init(msc_network->sccp, msc_network);
|
||||
a_init(msc_network->a.sccp, msc_network);
|
||||
|
||||
if (msc_cmdline_config.daemonize) {
|
||||
rc = osmo_daemonize();
|
||||
|
|
Loading…
Reference in New Issue