Initialize MGW pool on start up
Make the MGW pool configurable in the VTY and connect to each configured MGW instance on start up. This is in preparation for the subscr_conn_fsm, which will allocate own MGCP connections while processing BSSMAP assignment request and related messages. Related: SYS#5560 Change-Id: I6030a1f5a9d5fb06f148b2a2e03ae57bcb6b3766
This commit is contained in:
parent
99dd4efaa2
commit
e04bf1402d
|
@ -57,6 +57,7 @@ PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.6.0)
|
||||||
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.2.0)
|
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 1.2.0)
|
||||||
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.1.0)
|
PKG_CHECK_MODULES(LIBOSMONETIF, libosmo-netif >= 1.1.0)
|
||||||
PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.5.0)
|
PKG_CHECK_MODULES(LIBOSMOSIGTRAN, libosmo-sigtran >= 1.5.0)
|
||||||
|
PKG_CHECK_MODULES(LIBOSMOMGCPCLIENT, libosmo-mgcp-client >= 1.9.0)
|
||||||
|
|
||||||
dnl checks for header files
|
dnl checks for header files
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
|
|
@ -33,6 +33,7 @@ osmo-build-dep.sh libosmocore "" --disable-doxygen
|
||||||
osmo-build-dep.sh libosmo-abis
|
osmo-build-dep.sh libosmo-abis
|
||||||
osmo-build-dep.sh libosmo-netif
|
osmo-build-dep.sh libosmo-netif
|
||||||
osmo-build-dep.sh libosmo-sccp
|
osmo-build-dep.sh libosmo-sccp
|
||||||
|
osmo-build-dep.sh osmo-mgw
|
||||||
|
|
||||||
# Additional configure options and depends
|
# Additional configure options and depends
|
||||||
CONFIG=""
|
CONFIG=""
|
||||||
|
|
|
@ -35,6 +35,7 @@ BuildRequires: systemd-rpm-macros
|
||||||
BuildRequires: pkgconfig(libcrypto) >= 0.9.5
|
BuildRequires: pkgconfig(libcrypto) >= 0.9.5
|
||||||
BuildRequires: pkgconfig(libosmo-netif) >= 1.1.0
|
BuildRequires: pkgconfig(libosmo-netif) >= 1.1.0
|
||||||
BuildRequires: pkgconfig(libosmo-sigtran) >= 1.5.0
|
BuildRequires: pkgconfig(libosmo-sigtran) >= 1.5.0
|
||||||
|
BuildRequires: pkgconfig(libosmo-mgcp-client) >= 1.9.0
|
||||||
BuildRequires: pkgconfig(libosmoabis) >= 1.2.0
|
BuildRequires: pkgconfig(libosmoabis) >= 1.2.0
|
||||||
BuildRequires: pkgconfig(libosmocore) >= 1.6.0
|
BuildRequires: pkgconfig(libosmocore) >= 1.6.0
|
||||||
BuildRequires: pkgconfig(libosmoctrl) >= 1.6.0
|
BuildRequires: pkgconfig(libosmoctrl) >= 1.6.0
|
||||||
|
|
|
@ -15,6 +15,7 @@ Build-Depends: debhelper (>=9),
|
||||||
libosmo-sigtran-dev (>= 1.5.0),
|
libosmo-sigtran-dev (>= 1.5.0),
|
||||||
libosmo-abis-dev (>= 1.2.0),
|
libosmo-abis-dev (>= 1.2.0),
|
||||||
libosmo-netif-dev (>= 1.1.0),
|
libosmo-netif-dev (>= 1.1.0),
|
||||||
|
libosmo-mgcp-client-dev (>= 1.9.0),
|
||||||
osmo-gsm-manuals-dev (>= 1.2.0)
|
osmo-gsm-manuals-dev (>= 1.2.0)
|
||||||
Standards-Version: 3.9.8
|
Standards-Version: 3.9.8
|
||||||
Vcs-Git: git://git.osmocom.org/osmo-bsc-nat.git
|
Vcs-Git: git://git.osmocom.org/osmo-bsc-nat.git
|
||||||
|
|
|
@ -17,3 +17,10 @@ cs7 instance 1
|
||||||
bsc-nat
|
bsc-nat
|
||||||
cs7-instance-cn 0
|
cs7-instance-cn 0
|
||||||
cs7-instance-ran 1
|
cs7-instance-ran 1
|
||||||
|
|
||||||
|
mgw 0
|
||||||
|
mgw remote-ip 127.0.0.14
|
||||||
|
mgw remote-port 2427
|
||||||
|
mgw local-ip 127.0.0.15
|
||||||
|
mgw local-port 2427
|
||||||
|
mgw endpoint-domain bscnat
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <osmocom/core/fsm.h>
|
#include <osmocom/core/fsm.h>
|
||||||
|
#include <osmocom/core/tdef.h>
|
||||||
|
#include <osmocom/mgcp_client/mgcp_client_pool.h>
|
||||||
#include <osmocom/sigtran/sccp_sap.h>
|
#include <osmocom/sigtran/sccp_sap.h>
|
||||||
|
|
||||||
enum bsc_nat_net {
|
enum bsc_nat_net {
|
||||||
|
@ -39,6 +41,11 @@ struct bsc_nat {
|
||||||
struct osmo_fsm_inst *fi;
|
struct osmo_fsm_inst *fi;
|
||||||
struct llist_head subscr_conns; /* list of struct subscr_conn */
|
struct llist_head subscr_conns; /* list of struct subscr_conn */
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct mgcp_client_pool *pool;
|
||||||
|
struct osmo_tdef *tdefs;
|
||||||
|
} mgw;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct bsc_nat_sccp_inst *sccp_inst;
|
struct bsc_nat_sccp_inst *sccp_inst;
|
||||||
uint32_t subscr_conn_id_next;
|
uint32_t subscr_conn_id_next;
|
||||||
|
@ -61,3 +68,4 @@ const char *bsc_nat_print_addr(enum bsc_nat_net net, struct osmo_sccp_addr *addr
|
||||||
|
|
||||||
extern void *tall_bsc_nat_ctx;
|
extern void *tall_bsc_nat_ctx;
|
||||||
extern struct bsc_nat *g_bsc_nat;
|
extern struct bsc_nat *g_bsc_nat;
|
||||||
|
extern struct osmo_tdef_group g_bsc_nat_tdef_group[];
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <osmocom/vty/command.h>
|
#include <osmocom/vty/command.h>
|
||||||
|
|
||||||
enum bsc_nat_vty_nodes {
|
enum bsc_nat_vty_nodes {
|
||||||
|
MGW_NODE,
|
||||||
BSC_NAT_NODE = _LAST_OSMOVTY_NODE,
|
BSC_NAT_NODE = _LAST_OSMOVTY_NODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ AM_CFLAGS = \
|
||||||
$(LIBOSMONETIF_CFLAGS) \
|
$(LIBOSMONETIF_CFLAGS) \
|
||||||
$(COVERAGE_CFLAGS) \
|
$(COVERAGE_CFLAGS) \
|
||||||
$(LIBOSMOABIS_CFLAGS) \
|
$(LIBOSMOABIS_CFLAGS) \
|
||||||
|
$(LIBOSMOMGCPCLIENT_CFLAGS) \
|
||||||
$(LIBOSMOSIGTRAN_CFLAGS) \
|
$(LIBOSMOSIGTRAN_CFLAGS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
@ -45,5 +46,6 @@ osmo_bsc_nat_LDADD = \
|
||||||
$(LIBOSMONETIF_LIBS) \
|
$(LIBOSMONETIF_LIBS) \
|
||||||
$(COVERAGE_LDFLAGS) \
|
$(COVERAGE_LDFLAGS) \
|
||||||
$(LIBOSMOABIS_LIBS) \
|
$(LIBOSMOABIS_LIBS) \
|
||||||
|
$(LIBOSMOMGCPCLIENT_LIBS) \
|
||||||
$(LIBOSMOSIGTRAN_LIBS) \
|
$(LIBOSMOSIGTRAN_LIBS) \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
|
@ -28,6 +28,16 @@
|
||||||
#include <osmocom/bsc_nat/msc.h>
|
#include <osmocom/bsc_nat/msc.h>
|
||||||
#include <osmocom/bsc_nat/subscr_conn.h>
|
#include <osmocom/bsc_nat/subscr_conn.h>
|
||||||
|
|
||||||
|
struct osmo_tdef g_mgw_tdefs[] = {
|
||||||
|
{ .T = -2427, .default_val = 5, .desc = "timeout for MGCP response from MGW" },
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct osmo_tdef_group g_bsc_nat_tdef_group[] = {
|
||||||
|
{ .name = "mgw", .tdefs = g_mgw_tdefs, .desc = "MGW (Media Gateway) interface" },
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
struct bsc_nat *bsc_nat_alloc(void *tall_ctx)
|
struct bsc_nat *bsc_nat_alloc(void *tall_ctx)
|
||||||
{
|
{
|
||||||
struct bsc_nat *bsc_nat;
|
struct bsc_nat *bsc_nat;
|
||||||
|
@ -35,6 +45,10 @@ struct bsc_nat *bsc_nat_alloc(void *tall_ctx)
|
||||||
bsc_nat = talloc_zero(tall_ctx, struct bsc_nat);
|
bsc_nat = talloc_zero(tall_ctx, struct bsc_nat);
|
||||||
OSMO_ASSERT(bsc_nat);
|
OSMO_ASSERT(bsc_nat);
|
||||||
|
|
||||||
|
bsc_nat->mgw.pool = mgcp_client_pool_alloc(bsc_nat);
|
||||||
|
bsc_nat->mgw.tdefs = g_mgw_tdefs;
|
||||||
|
osmo_tdefs_reset(bsc_nat->mgw.tdefs);
|
||||||
|
|
||||||
bsc_nat->cn.sccp_inst = talloc_zero(bsc_nat, struct bsc_nat_sccp_inst);
|
bsc_nat->cn.sccp_inst = talloc_zero(bsc_nat, struct bsc_nat_sccp_inst);
|
||||||
OSMO_ASSERT(bsc_nat->cn.sccp_inst);
|
OSMO_ASSERT(bsc_nat->cn.sccp_inst);
|
||||||
talloc_set_name_const(bsc_nat->cn.sccp_inst, "struct bsc_nat_sccp_inst (CN)");
|
talloc_set_name_const(bsc_nat->cn.sccp_inst, "struct bsc_nat_sccp_inst (CN)");
|
||||||
|
|
|
@ -344,6 +344,24 @@ static void sccp_inst_free(struct bsc_nat_sccp_inst *sccp_inst)
|
||||||
talloc_free(sccp_inst);
|
talloc_free(sccp_inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mgw_init(struct mgcp_client_pool *pool)
|
||||||
|
{
|
||||||
|
unsigned int pool_members_initialized;
|
||||||
|
|
||||||
|
/* Initialize MGW pool. This initalizes and connects all MGCP clients that are currently configured in
|
||||||
|
* the pool. Adding additional MGCP clients to the pool is possible but the user has to configure and
|
||||||
|
* (re)connect them manually from the VTY. */
|
||||||
|
pool_members_initialized = mgcp_client_pool_connect(pool);
|
||||||
|
if (!pool_members_initialized) {
|
||||||
|
LOGP(DMAIN, LOGL_ERROR, "Failed to initialize any MGW pool members!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGP(DMAIN, LOGL_NOTICE, "MGW pool with %u pool member(s) initialized\n", pool_members_initialized);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void st_starting_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
|
static void st_starting_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
|
||||||
{
|
{
|
||||||
struct bsc_nat *bsc_nat = (struct bsc_nat *)fi->priv;
|
struct bsc_nat *bsc_nat = (struct bsc_nat *)fi->priv;
|
||||||
|
@ -358,6 +376,11 @@ static void st_starting_on_enter(struct osmo_fsm_inst *fi, uint32_t prev_state)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mgw_init(bsc_nat->mgw.pool) < 0) {
|
||||||
|
osmo_fsm_inst_state_chg(fi, BSC_NAT_FSM_ST_STOPPED, 0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
osmo_fsm_inst_state_chg(fi, BSC_NAT_FSM_ST_STARTED, 0, 0);
|
osmo_fsm_inst_state_chg(fi, BSC_NAT_FSM_ST_STARTED, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,10 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <osmocom/mgcp_client/mgcp_client_pool.h>
|
||||||
#include <osmocom/vty/command.h>
|
#include <osmocom/vty/command.h>
|
||||||
#include <osmocom/vty/logging.h>
|
#include <osmocom/vty/logging.h>
|
||||||
|
#include <osmocom/vty/tdef_vty.h>
|
||||||
#include <osmocom/vty/telnet_interface.h>
|
#include <osmocom/vty/telnet_interface.h>
|
||||||
#include <osmocom/bsc_nat/bsc_nat.h>
|
#include <osmocom/bsc_nat/bsc_nat.h>
|
||||||
#include <osmocom/bsc_nat/vty.h>
|
#include <osmocom/bsc_nat/vty.h>
|
||||||
|
@ -77,4 +79,8 @@ void bsc_nat_vty_init(void)
|
||||||
install_node(&bsc_nat_node, config_write_bsc_nat);
|
install_node(&bsc_nat_node, config_write_bsc_nat);
|
||||||
install_element(BSC_NAT_NODE, &cfg_cs7_instance_cn_cmd);
|
install_element(BSC_NAT_NODE, &cfg_cs7_instance_cn_cmd);
|
||||||
install_element(BSC_NAT_NODE, &cfg_cs7_instance_ran_cmd);
|
install_element(BSC_NAT_NODE, &cfg_cs7_instance_ran_cmd);
|
||||||
|
|
||||||
|
osmo_tdef_vty_groups_init(CONFIG_NODE, g_bsc_nat_tdef_group);
|
||||||
|
|
||||||
|
mgcp_client_pool_vty_init(CONFIG_NODE, MGW_NODE, "", g_bsc_nat->mgw.pool);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue