aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-04-20 15:53:53 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2018-05-04 15:02:24 +0000
commitf28f1ef9afa4edfcbdc32e4d820d23886e0e38b2 (patch)
tree8564d96d6183fa65686b7454e78b621418bb6d8b
parentad7277073c1a8e24a24969ee38747a7cc74dcd1b (diff)
resurrect meas_feed.c: vty, vty-test
At this point, meas-feed is usable again, however, osmo-bsc is not able to include the IMSI in every report like osmo-nitb did. In consequence, the meas-vis and meas-web tools are unable to handle the current measurement reports: these so far use the IMSI to list reports, and all reports without an IMSI are collapsed onto the same line, swapping values. So though osmo-bsc now sends usable measurement reports via meas-feed, two avenues to improve should be pursued: OS#3192: the visualization tools should use bts,ts,ss numbers, not IMSI. OS#2969: osmo-bsc should always know a mobile identity. Related: OS#2968 Change-Id: I186c7a995dd2b81746c32a58b55da64ed195a1ce
-rw-r--r--include/osmocom/bsc/meas_feed.h8
-rw-r--r--src/libbsc/bsc_vty.c45
-rw-r--r--tests/osmo-bsc.vty19
3 files changed, 69 insertions, 3 deletions
diff --git a/include/osmocom/bsc/meas_feed.h b/include/osmocom/bsc/meas_feed.h
index 55bce098e..1849a8932 100644
--- a/include/osmocom/bsc/meas_feed.h
+++ b/include/osmocom/bsc/meas_feed.h
@@ -1,5 +1,4 @@
-#ifndef _OPENBSC_MEAS_FEED_H
-#define _OPENBSC_MEAS_FEED_H
+#pragma once
#include <stdint.h>
@@ -37,5 +36,8 @@ enum meas_feed_msgtype {
#define MEAS_FEED_VERSION 1
+int meas_feed_cfg_set(const char *dst_host, uint16_t dst_port);
+void meas_feed_scenario_set(const char *name);
-#endif
+void meas_feed_cfg_get(char **host, uint16_t *port);
+const char *meas_feed_scenario_get(void);
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index c8d1637d3..1efca0c88 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -61,6 +61,7 @@
#include <osmocom/bsc/handover_vty.h>
#include <osmocom/bsc/gsm_04_08_utils.h>
#include <osmocom/bsc/acc_ramp.h>
+#include <osmocom/bsc/meas_feed.h>
#include <inttypes.h>
@@ -1017,6 +1018,22 @@ static int config_write_net(struct vty *vty)
vty_out(vty, " periodic location update %u%s",
gsmnet->t3212 * 6, VTY_NEWLINE);
+ {
+ uint16_t meas_port;
+ char *meas_host;
+ const char *meas_scenario;
+
+ meas_feed_cfg_get(&meas_host, &meas_port);
+ meas_scenario = meas_feed_scenario_get();
+
+ if (meas_port)
+ vty_out(vty, " meas-feed destination %s %u%s",
+ meas_host, meas_port, VTY_NEWLINE);
+ if (strlen(meas_scenario) > 0)
+ vty_out(vty, " meas-feed scenario %s%s",
+ meas_scenario, VTY_NEWLINE);
+ }
+
return CMD_SUCCESS;
}
@@ -4699,6 +4716,32 @@ DEFUN(cfg_net_no_per_loc_upd, cfg_net_no_per_loc_upd_cmd,
return CMD_SUCCESS;
}
+#define MEAS_FEED_STR "Measurement Report export\n"
+
+DEFUN(cfg_net_meas_feed_dest, cfg_net_meas_feed_dest_cmd,
+ "meas-feed destination ADDR <0-65535>",
+ MEAS_FEED_STR "Where to forward Measurement Report feeds\n" "address or hostname\n" "port number\n")
+{
+ int rc;
+ const char *host = argv[0];
+ uint16_t port = atoi(argv[1]);
+
+ rc = meas_feed_cfg_set(host, port);
+ if (rc < 0)
+ return CMD_WARNING;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_meas_feed_scenario, cfg_net_meas_feed_scenario_cmd,
+ "meas-feed scenario NAME",
+ MEAS_FEED_STR "Set a name to include in the Measurement Report feeds\n" "Name string, up to 31 characters\n")
+{
+ meas_feed_scenario_set(argv[0]);
+
+ return CMD_SUCCESS;
+}
+
extern int bsc_vty_init_extra(void);
int bsc_vty_init(struct gsm_network *network)
@@ -4741,6 +4784,8 @@ int bsc_vty_init(struct gsm_network *network)
install_element(GSMNET_NODE, &cfg_net_per_loc_upd_cmd);
install_element(GSMNET_NODE, &cfg_net_no_per_loc_upd_cmd);
install_element(GSMNET_NODE, &cfg_net_dyn_ts_allow_tch_f_cmd);
+ install_element(GSMNET_NODE, &cfg_net_meas_feed_dest_cmd);
+ install_element(GSMNET_NODE, &cfg_net_meas_feed_scenario_cmd);
install_element_ve(&bsc_show_net_cmd);
install_element_ve(&show_bts_cmd);
diff --git a/tests/osmo-bsc.vty b/tests/osmo-bsc.vty
new file mode 100644
index 000000000..560fb3683
--- /dev/null
+++ b/tests/osmo-bsc.vty
@@ -0,0 +1,19 @@
+OsmoBSC> enable
+
+OsmoBSC# configure terminal
+OsmoBSC(config)# network
+OsmoBSC(config-net)# list
+...
+ meas-feed destination ADDR <0-65535>
+ meas-feed scenario NAME
+...
+
+OsmoBSC(config-net)# meas-feed destination 127.0.0.23 4223
+OsmoBSC(config-net)# meas-feed scenario foo23
+OsmoBSC(config-net)# show running-config
+...
+network
+...
+ meas-feed destination 127.0.0.23 4223
+ meas-feed scenario foo23
+...