meas: Install the scenario command and test it

This commit is contained in:
Holger Hans Peter Freyther 2015-01-31 09:47:37 +01:00
parent 54c0124533
commit 65b8992a20
2 changed files with 25 additions and 0 deletions

View File

@ -953,8 +953,10 @@ 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",
@ -966,6 +968,9 @@ static int config_write_mncc_int(struct vty *vty)
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;
@ -1138,6 +1143,7 @@ int bsc_vty_init_extra(void)
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, &log_level_sms_cmd);
install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd);

View File

@ -296,6 +296,25 @@ class TestVTYNITB(TestVTYGenericBSC):
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)
class TestVTYBSC(TestVTYGenericBSC):
def vty_command(self):