[PATCH] osmo-msc[master]: Remove traces of meas_feed

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jan 24 13:38:24 UTC 2018


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

Remove traces of meas_feed

Measurement reporting (and the relate feed) are functions of the BSC,
not the MSC.  This code should never have been inherited from OsmoNITB
to OsmoMSC in the first place, let's remove it.

Change-Id: I0d57ac214e574e267fa9752daf76566197b9aa64
---
M .gitignore
M include/osmocom/msc/Makefile.am
D include/osmocom/msc/meas_feed.h
M src/libmsc/Makefile.am
D src/libmsc/meas_feed.c
M src/libmsc/vty_interface_layer3.c
M tests/vty_test_runner.py
7 files changed, 0 insertions(+), 276 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/19/6019/1

diff --git a/.gitignore b/.gitignore
index 4873bbe..a502ad4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,10 +40,6 @@
 # apps and app data
 src/osmo-msc/osmo-msc
 src/libcommon/gsup_test_client
-src/utils/meas_vis
-src/utils/meas_json
-src/utils/osmo-meas-pcap2db
-src/utils/osmo-meas-udp2db
 src/utils/smpp_mirror
 sms.db
 src/osmo-msc/*.cfg*
diff --git a/include/osmocom/msc/Makefile.am b/include/osmocom/msc/Makefile.am
index 1419e8e..61c915a 100644
--- a/include/osmocom/msc/Makefile.am
+++ b/include/osmocom/msc/Makefile.am
@@ -33,7 +33,6 @@
 	iucs.h \
 	iucs_ranap.h \
 	iu_dummy.h \
-	meas_feed.h \
 	meas_rep.h \
 	misdn.h \
 	mncc.h \
diff --git a/include/osmocom/msc/meas_feed.h b/include/osmocom/msc/meas_feed.h
deleted file mode 100644
index 02b7d95..0000000
--- a/include/osmocom/msc/meas_feed.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef _OPENBSC_MEAS_FEED_H
-#define _OPENBSC_MEAS_FEED_H
-
-#include <stdint.h>
-
-#include <osmocom/msc/meas_rep.h>
-
-struct meas_feed_hdr {
-	uint8_t msg_type;
-	uint8_t reserved;
-	uint16_t version;
-};
-
-struct meas_feed_meas {
-	struct meas_feed_hdr hdr;
-	char imsi[15+1];
-	char name[31+1];
-	char scenario[31+1];
-	struct gsm_meas_rep mr;
-	/* The logical channel type, enum gsm_chan_t */
-	uint8_t lchan_type;
-	/* The physical channel type, enum gsm_phys_chan_config */
-	uint8_t pchan_type;
-	/* number of ths BTS in network */
-	uint8_t bts_nr;
-	/* number of this TRX in the BTS */
-	uint8_t trx_nr;
-	/* number of this timeslot at the TRX */
-	uint8_t ts_nr;
-	/* The logical subslot number in the TS */
-	uint8_t ss_nr;
-};
-
-enum meas_feed_msgtype {
-	MEAS_FEED_MEAS		= 0,
-};
-
-#define MEAS_FEED_VERSION	1
-
-
-#endif
diff --git a/src/libmsc/Makefile.am b/src/libmsc/Makefile.am
index 3ff97a3..6449948 100644
--- a/src/libmsc/Makefile.am
+++ b/src/libmsc/Makefile.am
@@ -19,7 +19,6 @@
 	$(NULL)
 
 noinst_HEADERS = \
-	meas_feed.h \
 	$(NULL)
 
 noinst_LIBRARIES = \
@@ -49,7 +48,6 @@
 	transaction.c \
 	osmo_msc.c \
 	ctrl_commands.c \
-	meas_feed.c \
 	subscr_conn.c \
 	$(NULL)
 if BUILD_IU
diff --git a/src/libmsc/meas_feed.c b/src/libmsc/meas_feed.c
deleted file mode 100644
index 3daebee..0000000
--- a/src/libmsc/meas_feed.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* UDP-Feed of measurement reports */
-
-#include <unistd.h>
-
-#include <sys/socket.h>
-
-#include <osmocom/core/msgb.h>
-#include <osmocom/core/socket.h>
-#include <osmocom/core/write_queue.h>
-#include <osmocom/core/talloc.h>
-#include <osmocom/core/utils.h>
-
-#include <osmocom/vty/command.h>
-#include <osmocom/vty/vty.h>
-
-#include <osmocom/msc/meas_rep.h>
-#include <osmocom/msc/signal.h>
-#include <osmocom/msc/gsm_subscriber.h>
-#include <osmocom/msc/meas_feed.h>
-#include <osmocom/msc/vty.h>
-#include <osmocom/msc/vlr.h>
-
-#include "meas_feed.h"
-
-struct meas_feed_state {
-	struct osmo_wqueue wqueue;
-	char scenario[31+1];
-	char *dst_host;
-	uint16_t dst_port;
-};
-
-
-static struct meas_feed_state g_mfs;
-
-static int process_meas_rep(struct gsm_meas_rep *mr)
-{
-	struct msgb *msg;
-	struct meas_feed_meas *mfm;
-	struct vlr_subscr *vsub;
-
-	/* ignore measurements as long as we don't know who it is */
-	if (!mr->lchan || !mr->lchan->conn || !mr->lchan->conn->vsub)
-		return 0;
-
-	vsub = mr->lchan->conn->vsub;
-
-	msg = msgb_alloc(sizeof(struct meas_feed_meas), "Meas. Feed");
-	if (!msg)
-		return 0;
-
-	/* fill in the header */
-	mfm = (struct meas_feed_meas *) msgb_put(msg, sizeof(*mfm));
-	mfm->hdr.msg_type = MEAS_FEED_MEAS;
-	mfm->hdr.version = MEAS_FEED_VERSION;
-
-	/* fill in MEAS_FEED_MEAS specific header */
-	osmo_strlcpy(mfm->imsi, vsub->imsi, sizeof(mfm->imsi));
-	osmo_strlcpy(mfm->name, vsub->name, sizeof(mfm->name));
-	osmo_strlcpy(mfm->scenario, g_mfs.scenario, sizeof(mfm->scenario));
-
-	/* copy the entire measurement report */
-	memcpy(&mfm->mr, mr, sizeof(mfm->mr));
-
-	/* copy channel information */
-	/* we assume that the measurement report always belong to some timeslot */
-	mfm->lchan_type = (uint8_t)mr->lchan->type;
-	mfm->pchan_type = (uint8_t)mr->lchan->ts->pchan;
-	mfm->bts_nr = mr->lchan->ts->trx->bts->nr;
-	mfm->trx_nr = mr->lchan->ts->trx->nr;
-	mfm->ts_nr = mr->lchan->ts->nr;
-	mfm->ss_nr = mr->lchan->nr;
-
-	/* and send it to the socket */
-	if (osmo_wqueue_enqueue(&g_mfs.wqueue, msg) != 0)
-		msgb_free(msg);
-
-	return 0;
-}
-
-static int meas_feed_sig_cb(unsigned int subsys, unsigned int signal,
-			    void *handler_data, void *signal_data)
-{
-	struct lchan_signal_data *sdata = signal_data;
-
-	if (subsys != SS_LCHAN)
-		return 0;
-
-	if (signal == S_LCHAN_MEAS_REP)
-		process_meas_rep(sdata->mr);
-
-	return 0;
-}
-
-static int feed_write_cb(struct osmo_fd *ofd, struct msgb *msg)
-{
-	return write(ofd->fd, msgb_data(msg), msgb_length(msg));
-}
-
-static int feed_read_cb(struct osmo_fd *ofd)
-{
-	int rc;
-	char buf[256];
-
-	rc = read(ofd->fd, buf, sizeof(buf));
-	ofd->fd &= ~BSC_FD_READ;
-
-	return rc;
-}
-
-int meas_feed_cfg_set(const char *dst_host, uint16_t dst_port)
-{
-	int rc;
-	int already_initialized = 0;
-
-	if (g_mfs.wqueue.bfd.fd)
-		already_initialized = 1;
-
-
-	if (already_initialized &&
-	    !strcmp(dst_host, g_mfs.dst_host) &&
-	    dst_port == g_mfs.dst_port)
-		return 0;
-
-	if (!already_initialized) {
-		osmo_wqueue_init(&g_mfs.wqueue, 10);
-		g_mfs.wqueue.write_cb = feed_write_cb;
-		g_mfs.wqueue.read_cb = feed_read_cb;
-		osmo_signal_register_handler(SS_LCHAN, meas_feed_sig_cb, NULL);
-	}
-
-	if (already_initialized) {
-		osmo_wqueue_clear(&g_mfs.wqueue);
-		osmo_fd_unregister(&g_mfs.wqueue.bfd);
-		close(g_mfs.wqueue.bfd.fd);
-		/* don't set to zero, as that would mean 'not yet initialized' */
-		g_mfs.wqueue.bfd.fd = -1;
-	}
-	rc = osmo_sock_init_ofd(&g_mfs.wqueue.bfd, AF_UNSPEC, SOCK_DGRAM,
-				IPPROTO_UDP, dst_host, dst_port,
-				OSMO_SOCK_F_CONNECT);
-	if (rc < 0)
-		return rc;
-
-	g_mfs.wqueue.bfd.when &= ~BSC_FD_READ;
-
-	if (g_mfs.dst_host)
-		talloc_free(g_mfs.dst_host);
-	g_mfs.dst_host = talloc_strdup(NULL, dst_host);
-	g_mfs.dst_port = dst_port;
-
-	return 0;
-}
-
-void meas_feed_cfg_get(char **host, uint16_t *port)
-{
-	*port = g_mfs.dst_port;
-	*host = g_mfs.dst_host;
-}
-
-void meas_feed_scenario_set(const char *name)
-{
-	osmo_strlcpy(g_mfs.scenario, name, sizeof(g_mfs.scenario));
-}
-
-const char *meas_feed_scenario_get(void)
-{
-	return g_mfs.scenario;
-}
diff --git a/src/libmsc/vty_interface_layer3.c b/src/libmsc/vty_interface_layer3.c
index c7ec586..dbd826d 100644
--- a/src/libmsc/vty_interface_layer3.c
+++ b/src/libmsc/vty_interface_layer3.c
@@ -56,8 +56,6 @@
 
 #include <osmocom/msc/osmo_msc.h>
 
-#include "meas_feed.h"
-
 extern struct gsm_network *gsmnet_from_vty(struct vty *v);
 
 static void subscr_dump_full_vty(struct vty *vty, struct vlr_subscr *vsub)
@@ -754,13 +752,6 @@
 
 static int config_write_mncc_int(struct vty *vty)
 {
-	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();
-
 	vty_out(vty, "mncc-int%s", VTY_NEWLINE);
 	vty_out(vty, " default-codec tch-f %s%s",
 		get_value_string(tchf_codec_names, mncc_int.def_codec[0]),
@@ -768,13 +759,6 @@
 	vty_out(vty, " default-codec tch-h %s%s",
 		get_value_string(tchh_codec_names, mncc_int.def_codec[1]),
 		VTY_NEWLINE);
-	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;
 }
@@ -797,29 +781,6 @@
       "Half-Rate\n" "Adaptive Multi-Rate\n")
 {
 	mncc_int.def_codec[1] = get_string_value(tchh_codec_names, argv[0]);
-
-	return CMD_SUCCESS;
-}
-
-#define MEAS_STR "Measurement export related\n"
-DEFUN(mnccint_meas_feed, mnccint_meas_feed_cmd,
-	"meas-feed destination ADDR <0-65535>",
-	MEAS_STR "destination\n" "address or hostname\n" "port number\n")
-{
-	int rc;
-
-	rc = meas_feed_cfg_set(argv[0], atoi(argv[1]));
-	if (rc < 0)
-		return CMD_WARNING;
-
-	return CMD_SUCCESS;
-}
-
-DEFUN(meas_feed_scenario, meas_feed_scenario_cmd,
-	"meas-feed scenario NAME",
-	MEAS_STR "scenario\n" "Name up to 31 characters included in report\n")
-{
-	meas_feed_scenario_set(argv[0]);
 
 	return CMD_SUCCESS;
 }
@@ -924,14 +885,11 @@
 	install_element(ENABLE_NODE, &smsqueue_clear_cmd);
 	install_element(ENABLE_NODE, &smsqueue_fail_cmd);
 	install_element(ENABLE_NODE, &subscriber_send_pending_sms_cmd);
-	install_element(ENABLE_NODE, &meas_feed_scenario_cmd);
 
 	install_element(CONFIG_NODE, &cfg_mncc_int_cmd);
 	install_node(&mncc_int_node, config_write_mncc_int);
 	install_element(MNCC_INT_NODE, &mnccint_def_codec_f_cmd);
 	install_element(MNCC_INT_NODE, &mnccint_def_codec_h_cmd);
-	install_element(MNCC_INT_NODE, &mnccint_meas_feed_cmd);
-	install_element(MNCC_INT_NODE, &meas_feed_scenario_cmd);
 
 	install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd);
 
diff --git a/tests/vty_test_runner.py b/tests/vty_test_runner.py
index de1997c..707fc5c 100644
--- a/tests/vty_test_runner.py
+++ b/tests/vty_test_runner.py
@@ -225,24 +225,6 @@
         res = self.vty.command("show network")
         self.assert_(res.startswith('BSC is on Country Code') >= 0)
 
-    def testMeasurementFeed(self):
-        self.vty.enable()
-        self.vty.command("configure terminal")
-        self.vty.command("mncc-int")
-
-        res = self.vty.command("write terminal")
-        self.assertEquals(res.find('meas-feed scenario'), -1)
-
-        self.vty.command("meas-feed scenario bla")
-        res = self.vty.command("write terminal")
-        self.assert_(res.find('meas-feed scenario bla') > 0)
-
-        self.vty.command("meas-feed scenario abcdefghijklmnopqrstuvwxyz01234567890")
-        res = self.vty.command("write terminal")
-        self.assertEquals(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz01234567890'), -1)
-        self.assertEquals(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz012345'), -1)
-        self.assert_(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz01234') > 0)
-
 def ipa_handle_small(x, verbose = False):
     s = data2str(x.recv(4))
     if len(s) != 4*2:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d57ac214e574e267fa9752daf76566197b9aa64
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list