From 28f160e76c3c53029bc6e8de101b2d7ee26eea16 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 5 Sep 2019 14:48:35 +0200 Subject: Introduce osmo_tdef infra and timer VTY commands This will allow for configuration of some of the timers by the user, and allow him to inspect current values being used. It will be also useful for TTCN3 tests which may want to test some of the timers without having to wait for lots of time. Timers are splitted into 2 groups: BTS controlled ones and PCU controlled ones. The BTS controlled ones are read-only by the user (hence no "timer" VTY command is provided to change them). TbfTest.err output changes due to timers being set up correctly as a consequence of changes. Other application such as pcu_emu.cpp and pcu_main.cpp had to previosuly set the initial values by hand (and did so), but apparently TbfTest.c was missing that part, which is now fixed for free. Depends: libosmocore.git Id56a1226d724a374f04231df85fe5b49ffd2c43c Change-Id: I5cfb9ef01706124be262d4536617b9edb4601dd5 --- src/pcu_vty.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/pcu_vty.c') diff --git a/src/pcu_vty.c b/src/pcu_vty.c index a566e735..380b173a 100644 --- a/src/pcu_vty.c +++ b/src/pcu_vty.c @@ -4,6 +4,8 @@ #include #include #include +#include +#include #include #include #include @@ -1109,6 +1111,38 @@ DEFUN(cfg_pcu_gb_dialect, return CMD_SUCCESS; } +DEFUN(show_bts_timer, show_bts_timer_cmd, + "show bts-timer " OSMO_TDEF_VTY_ARG_T_OPTIONAL, + SHOW_STR "Show BTS controlled timers\n" + OSMO_TDEF_VTY_DOC_T) +{ + struct gprs_rlcmac_bts *bts = bts_main_data(); + const char *T_arg = argc > 0 ? argv[0] : NULL; + return osmo_tdef_vty_show_cmd(vty, bts->T_defs_bts, T_arg, NULL); +} + +DEFUN(show_timer, show_timer_cmd, + "show timer " OSMO_TDEF_VTY_ARG_T_OPTIONAL, + SHOW_STR "Show PCU timers\n" + OSMO_TDEF_VTY_DOC_T) +{ + struct gprs_rlcmac_bts *bts = bts_main_data(); + const char *T_arg = argc > 0 ? argv[0] : NULL; + return osmo_tdef_vty_show_cmd(vty, bts->T_defs_pcu, T_arg, NULL); +} + +DEFUN(cfg_pcu_timer, cfg_pcu_timer_cmd, + "timer " OSMO_TDEF_VTY_ARG_SET_OPTIONAL, + "Configure or show PCU timers\n" + OSMO_TDEF_VTY_DOC_SET) +{ + struct gprs_rlcmac_bts *bts = bts_main_data(); + /* If any arguments are missing, redirect to 'show' */ + if (argc < 2) + return show_timer(self, vty, argc, argv); + return osmo_tdef_vty_set_cmd(vty, bts->T_defs_pcu, argv); +} + DEFUN(show_tbf, show_tbf_cmd, "show tbf (all|ccch|pacch)", @@ -1251,12 +1285,15 @@ int pcu_vty_init(void) install_element(PCU_NODE, &cfg_pcu_no_gsmtap_categ_cmd); install_element(PCU_NODE, &cfg_pcu_sock_cmd); install_element(PCU_NODE, &cfg_pcu_gb_dialect_cmd); + install_element(PCU_NODE, &cfg_pcu_timer_cmd); install_element_ve(&show_bts_stats_cmd); install_element_ve(&show_tbf_cmd); install_element_ve(&show_ms_all_cmd); install_element_ve(&show_ms_tlli_cmd); install_element_ve(&show_ms_imsi_cmd); + install_element_ve(&show_bts_timer_cmd); + install_element_ve(&show_timer_cmd); return 0; } -- cgit v1.2.3