aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/msc_vty.c
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2017-06-23 14:43:55 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2017-06-28 13:35:10 +0200
commit40703dd1f441ee754a3b9b8b838feb66bc8e032d (patch)
tree7f870f861931021464144bc2f59e4c19640d1384 /openbsc/src/libmsc/msc_vty.c
parent030312043a84b0bfaf35c36790e56e3016c68661 (diff)
a_iface: use vty to configure BSC/MSC connections
Use the VTY to configure the connections between BSC and MSC on both sides. We now can add new connections, we also can write the config, removing existing connections is implemented on the MSC side, but not yet on the BSC side.
Diffstat (limited to 'openbsc/src/libmsc/msc_vty.c')
-rw-r--r--openbsc/src/libmsc/msc_vty.c104
1 files changed, 104 insertions, 0 deletions
diff --git a/openbsc/src/libmsc/msc_vty.c b/openbsc/src/libmsc/msc_vty.c
index b6fff56af..b9519ceeb 100644
--- a/openbsc/src/libmsc/msc_vty.c
+++ b/openbsc/src/libmsc/msc_vty.c
@@ -32,6 +32,8 @@
#include <openbsc/gsm_subscriber.h>
#include <openbsc/vlr.h>
#include <openbsc/iu.h>
+#include <openbsc/a_iface.h>
+#include <osmocom/sccp/sccp_types.h>
static struct cmd_node msc_node = {
MSC_NODE,
@@ -105,9 +107,96 @@ DEFUN(cfg_msc_no_assign_tmsi, cfg_msc_no_assign_tmsi_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_msc_register_bsc, cfg_msc_register_bsc_cmd,
+ "bsc cs7-instance <0-15> calling-addr NAME called-addr NAME",
+ "Register a new BSC connection to this MSC.\n"
+ "Associated SS7 instance\n"
+ "SS7 instance reference number\n"
+ "Calling Address (local address of this MSC)\n"
+ "SCCP address name\n"
+ "Called Address (remote address of the BSC)\n" "SCCP address name\n")
+{
+ struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+ struct osmo_sccp_addr *calling_addr;
+ struct osmo_sccp_addr *called_addr;
+ struct osmo_ss7_instance *inst;
+
+ uint32_t inst_id = atoi(argv[0]);
+ const char *calling_addr_name = argv[1];
+ const char *called_addr_name = argv[2];
+
+ inst = osmo_ss7_instance_find(inst_id);
+ if (!inst) {
+ vty_out(vty, "No SS7 instance %d found%s", inst_id,
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ calling_addr = osmo_sccp_addr_by_name(calling_addr_name, inst);
+ if (!calling_addr) {
+ vty_out(vty, "No sccp address %s found%s", calling_addr_name,
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ called_addr = osmo_sccp_addr_by_name(called_addr_name, inst);
+ if (!called_addr) {
+ vty_out(vty, "No sccp address %s found%s", called_addr_name,
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ a_init(gsmnet, calling_addr, called_addr, inst);
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_msc_no_register_bsc, cfg_msc_no_register_bsc_cmd,
+ "no bsc cs7-instance <0-15> calling-addr NAME called-addr NAME",
+ NO_STR
+ "Remove a BSC connection to this MSC.\n"
+ "Associated SS7 instance\n"
+ "SS7 instance reference number\n"
+ "Calling Address (local address of this MSC)\n"
+ "SCCP address name\n"
+ "Called Address (remote address of the BSC)\n" "SCCP address name\n")
+{
+ struct osmo_sccp_addr *calling_addr;
+ struct osmo_sccp_addr *called_addr;
+ struct osmo_ss7_instance *inst;
+
+ uint32_t inst_id = atoi(argv[0]);
+ const char *calling_addr_name = argv[1];
+ const char *called_addr_name = argv[2];
+
+ inst = osmo_ss7_instance_find(inst_id);
+ if (!inst) {
+ vty_out(vty, "No SS7 instance %d found%s", inst_id,
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ calling_addr = osmo_sccp_addr_by_name(calling_addr_name, inst);
+ if (!calling_addr) {
+ vty_out(vty, "No sccp address %s found%s", calling_addr_name,
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ called_addr = osmo_sccp_addr_by_name(called_addr_name, inst);
+ if (!called_addr) {
+ vty_out(vty, "No sccp address %s found%s", called_addr_name,
+ VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ a_drop(calling_addr, called_addr);
+ return CMD_SUCCESS;
+}
+
static int config_write_msc(struct vty *vty)
{
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+ struct bsc_context *bsc_ctx;
vty_out(vty, "msc%s", VTY_NEWLINE);
if (!gsmnet->auto_create_subscr)
@@ -127,6 +216,18 @@ static int config_write_msc(struct vty *vty)
mgcpgw_client_config_write(vty, " ");
iu_vty_config_write(vty, " ");
+ /* write sccp connection configuration */
+ llist_for_each_entry(bsc_ctx, &gsmnet->a.bscs, list) {
+ OSMO_ASSERT(bsc_ctx->ss7);
+ vty_out(vty,
+ " bsc cs7-instance %u calling-addr %s called-addr %s%s",
+ bsc_ctx->ss7->cfg.id,
+ osmo_sccp_name_by_addr(&bsc_ctx->calling_addr,
+ bsc_ctx->ss7),
+ osmo_sccp_name_by_addr(&bsc_ctx->called_addr,
+ bsc_ctx->ss7), VTY_NEWLINE);
+ }
+
return CMD_SUCCESS;
}
@@ -176,6 +277,9 @@ void msc_vty_init(struct gsm_network *msc_network)
install_element(MSC_NODE, &cfg_msc_no_subscr_create_cmd);
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_register_bsc_cmd);
+ install_element(MSC_NODE, &cfg_msc_no_register_bsc_cmd);
+
mgcpgw_client_vty_init(MSC_NODE, &msc_network->mgcpgw.conf);
iu_vty_init(MSC_NODE, &msc_network->iu.rab_assign_addr_enc);
}