aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2013-02-05 09:39:09 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-22 16:00:00 +0100
commitec37bb29563c92bf405b732019db4ed3b2cc9477 (patch)
tree112802c922245fa98f8a4d6d42555825a34b473d /openbsc
parentd9e403951631a44508928f60372ced5ae541c377 (diff)
bsc: Add a VTY command to show the paging group for a BSC/IMSI
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/libbsc/bsc_vty.c35
-rw-r--r--openbsc/tests/vty_test_runner.py6
2 files changed, 41 insertions, 0 deletions
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 5a9976be..b0349816 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -27,6 +27,8 @@
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/misc.h>
+#include <osmocom/gsm/gsm0502.h>
+
#include <arpa/inet.h>
#include <osmocom/core/linuxlist.h>
@@ -51,6 +53,8 @@
#include <openbsc/osmo_msc_data.h>
#include <openbsc/osmo_bsc_rf.h>
+#include <inttypes.h>
+
#include "../../bscconfig.h"
@@ -1150,6 +1154,36 @@ DEFUN(show_paging,
return CMD_SUCCESS;
}
+DEFUN(show_paging_group,
+ show_paging_group_cmd,
+ "show paging-group <0-255> IMSI",
+ SHOW_STR "Display the paging group\n"
+ "BTS Number\n" "IMSI\n")
+{
+ struct gsm_network *net = gsmnet_from_vty(vty);
+ struct gsm_bts *bts;
+ unsigned int page_group;
+ int 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);
+ if (!bts) {
+ vty_out(vty, "%% can't find BTS %s%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
+ str_to_imsi(argv[1]));
+ vty_out(vty, "%%Paging group for IMSI %" PRIu64 " on BTS #%d is %u%s",
+ str_to_imsi(argv[1]), bts->nr,
+ page_group, VTY_NEWLINE);
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_net,
cfg_net_cmd,
"network", NETWORK_STR)
@@ -3095,6 +3129,7 @@ int bsc_vty_init(const struct log_info *cat)
install_element_ve(&logging_fltr_imsi_cmd);
install_element_ve(&show_paging_cmd);
+ install_element_ve(&show_paging_group_cmd);
logging_vty_add_cmds(cat);
install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd);
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 45b0c063..08c94b1b 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -224,6 +224,12 @@ class TestVTYNITB(TestVTYGenericBSC):
res = self.vty.command('show subscriber imsi '+imsi)
self.assert_(res.find(" IMSI: "+imsi) > 0)
+ def testShowPagingGroup(self):
+ res = self.vty.command("show paging-group 255 1234567")
+ self.assertEqual(res, "% can't find BTS 255")
+ res = self.vty.command("show paging-group 0 1234567")
+ self.assertEquals(res, "%Paging group for IMSI 1234567 on BTS #0 is 7")
+
class TestVTYBSC(TestVTYGenericBSC):
def vty_command(self):