mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-11-02 21:13:44 +00:00
bsc: Add vty command to send location trap through VTY
I have manually tested this by entering the VTY command and observing the CTRL interface using wireshark. Ticket: OW#1129
This commit is contained in:
@@ -55,4 +55,6 @@ int bsc_handle_dt1(struct osmo_bsc_sccp_con *conn, struct msgb *msg, unsigned in
|
|||||||
|
|
||||||
int bsc_ctrl_cmds_install();
|
int bsc_ctrl_cmds_install();
|
||||||
|
|
||||||
|
void bsc_gen_location_state_trap(struct gsm_bts *bts);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -214,6 +214,14 @@ static void generate_location_state_trap(struct gsm_bts *bts, struct bsc_msc_con
|
|||||||
talloc_free(cmd);
|
talloc_free(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bsc_gen_location_state_trap(struct gsm_bts *bts)
|
||||||
|
{
|
||||||
|
struct osmo_msc_data *msc;
|
||||||
|
|
||||||
|
llist_for_each_entry(msc, &bts->network->bsc_data->mscs, entry)
|
||||||
|
generate_location_state_trap(bts, msc->msc_con);
|
||||||
|
}
|
||||||
|
|
||||||
static int location_equal(struct bts_location *a, struct bts_location *b)
|
static int location_equal(struct bts_location *a, struct bts_location *b)
|
||||||
{
|
{
|
||||||
return ((a->tstamp == b->tstamp) && (a->valid == b->valid) && (a->lat == b->lat) &&
|
return ((a->tstamp == b->tstamp) && (a->valid == b->valid) && (a->lat == b->lat) &&
|
||||||
@@ -279,10 +287,8 @@ static int get_bts_loc(struct ctrl_cmd *cmd, void *data)
|
|||||||
static int set_bts_loc(struct ctrl_cmd *cmd, void *data)
|
static int set_bts_loc(struct ctrl_cmd *cmd, void *data)
|
||||||
{
|
{
|
||||||
char *saveptr, *lat, *lon, *height, *tstamp, *valid, *tmp;
|
char *saveptr, *lat, *lon, *height, *tstamp, *valid, *tmp;
|
||||||
struct osmo_msc_data *msc;
|
|
||||||
struct bts_location *curloc, *lastloc;
|
struct bts_location *curloc, *lastloc;
|
||||||
int ret;
|
int ret;
|
||||||
struct gsm_network *gsmnet = (struct gsm_network *)data;
|
|
||||||
struct gsm_bts *bts = (struct gsm_bts *) cmd->node;
|
struct gsm_bts *bts = (struct gsm_bts *) cmd->node;
|
||||||
if (!bts) {
|
if (!bts) {
|
||||||
cmd->reply = "bts not found.";
|
cmd->reply = "bts not found.";
|
||||||
@@ -322,8 +328,7 @@ static int set_bts_loc(struct ctrl_cmd *cmd, void *data)
|
|||||||
ret = get_bts_loc(cmd, data);
|
ret = get_bts_loc(cmd, data);
|
||||||
|
|
||||||
if (!location_equal(curloc, lastloc))
|
if (!location_equal(curloc, lastloc))
|
||||||
llist_for_each_entry(msc, &gsmnet->bsc_data->mscs, entry)
|
bsc_gen_location_state_trap(bts);
|
||||||
generate_location_state_trap(bts, msc->msc_con);
|
|
||||||
|
|
||||||
cleanup_locations(&bts->loc_list);
|
cleanup_locations(&bts->loc_list);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Osmo BSC VTY Configuration */
|
/* Osmo BSC VTY Configuration */
|
||||||
/* (C) 2009-2011 by Holger Hans Peter Freyther
|
/* (C) 2009-2014 by Holger Hans Peter Freyther
|
||||||
* (C) 2009-2011 by On-Waves
|
* (C) 2009-2014 by On-Waves
|
||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
|
#include <openbsc/osmo_bsc.h>
|
||||||
#include <openbsc/osmo_msc_data.h>
|
#include <openbsc/osmo_msc_data.h>
|
||||||
#include <openbsc/vty.h>
|
#include <openbsc/vty.h>
|
||||||
|
|
||||||
@@ -670,6 +671,28 @@ DEFUN(show_pos,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFUN(gen_position_trap,
|
||||||
|
gen_position_trap_cmd,
|
||||||
|
"generate-location-state-trap <0-255>",
|
||||||
|
"Generate location state report\n"
|
||||||
|
"BTS to report\n")
|
||||||
|
{
|
||||||
|
int bts_nr;
|
||||||
|
struct gsm_bts *bts;
|
||||||
|
struct gsm_network *net = bsc_gsmnet;
|
||||||
|
|
||||||
|
bts_nr = atoi(argv[0]);
|
||||||
|
if (bts_nr >= net->num_bts) {
|
||||||
|
vty_out(vty, "%% can't find BTS '%s'%s", argv[0],
|
||||||
|
VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
bts = gsm_bts_num(net, bts_nr);
|
||||||
|
bsc_gen_location_state_trap(bts);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
int bsc_vty_init_extra(void)
|
int bsc_vty_init_extra(void)
|
||||||
{
|
{
|
||||||
install_element(CONFIG_NODE, &cfg_net_msc_cmd);
|
install_element(CONFIG_NODE, &cfg_net_msc_cmd);
|
||||||
@@ -718,5 +741,7 @@ int bsc_vty_init_extra(void)
|
|||||||
install_element_ve(&show_mscs_cmd);
|
install_element_ve(&show_mscs_cmd);
|
||||||
install_element_ve(&show_pos_cmd);
|
install_element_ve(&show_pos_cmd);
|
||||||
|
|
||||||
|
install_element(ENABLE_NODE, &gen_position_trap_cmd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user