Review at  https://gerrit.osmocom.org/7995

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
---
M include/osmocom/bsc/meas_feed.h
M src/libbsc/bsc_vty.c
A tests/osmo-bsc.vty
3 files changed, 69 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/95/7995/1

diff --git a/include/osmocom/bsc/meas_feed.h b/include/osmocom/bsc/meas_feed.h
index 55bce09..1849a89 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 @@
 
 #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 c8d1637..1efca0c 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>
 
@@ -1016,6 +1017,22 @@
        else
                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 @@
        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 @@
        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 0000000..560fb36
--- /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
+...

-- 
To view, visit https://gerrit.osmocom.org/7995
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I186c7a995dd2b81746c32a58b55da64ed195a1ce
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to