aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-04 20:23:56 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-07 19:24:34 +0200
commit8d998a713e30684a491e2e6a964a4b3d503d77ae (patch)
treea445098130d48047f45c4dff45bdfd364593636a /openbsc
parent294741138379df3f64183a7b25f66c554efad193 (diff)
mgcp: Verify that the force-ptime is written back to the file
When the command was added it was not verified that. Add a very basic MGCP VTY test and test that the string appears in the config.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/doc/examples/osmo-bsc_mgcp/mgcp.cfg1
-rw-r--r--openbsc/src/libmgcp/mgcp_vty.c4
-rw-r--r--openbsc/tests/vty_test_runner.py22
3 files changed, 26 insertions, 1 deletions
diff --git a/openbsc/doc/examples/osmo-bsc_mgcp/mgcp.cfg b/openbsc/doc/examples/osmo-bsc_mgcp/mgcp.cfg
index 7409dd00d..791497f84 100644
--- a/openbsc/doc/examples/osmo-bsc_mgcp/mgcp.cfg
+++ b/openbsc/doc/examples/osmo-bsc_mgcp/mgcp.cfg
@@ -12,6 +12,7 @@ mgcp
bind ip 127.0.0.1
bind port 2427
rtp base 4000
+ rtp force-ptime 20
sdp audio payload number 98
sdp audio payload name AMR/8000
number endpoints 31
diff --git a/openbsc/src/libmgcp/mgcp_vty.c b/openbsc/src/libmgcp/mgcp_vty.c
index 0b116691e..e42c691ad 100644
--- a/openbsc/src/libmgcp/mgcp_vty.c
+++ b/openbsc/src/libmgcp/mgcp_vty.c
@@ -2,7 +2,7 @@
/* The protocol implementation */
/*
- * (C) 2009-2011 by Holger Hans Peter Freyther <zecke@selfish.org>
+ * (C) 2009-2014 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009-2011 by On-Waves
* All Rights Reserved
*
@@ -128,6 +128,8 @@ static int config_write_mgcp(struct vty *vty)
else
vty_out(vty, " rtp transcoder-range %u %u%s",
g_cfg->transcoder_ports.range_start, g_cfg->transcoder_ports.range_end, VTY_NEWLINE);
+ if (g_cfg->bts_force_ptime > 0)
+ vty_out(vty, " rtp force-ptime %d%s", g_cfg->bts_force_ptime, VTY_NEWLINE);
vty_out(vty, " transcoder-remote-base %u%s", g_cfg->transcoder_remote_base, VTY_NEWLINE);
vty_out(vty, " osmux %s%s",
g_cfg->osmux == 1 ? "on" : "off", VTY_NEWLINE);
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 6bbc606cf..db8294d3a 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -56,6 +56,27 @@ class TestVTYBase(unittest.TestCase):
self.vty = None
osmoutil.end_proc(self.proc)
+class TestVTYMGCP(TestVTYBase):
+ def vty_command(self):
+ return ["./src/osmo-bsc_mgcp/osmo-bsc_mgcp", "-c",
+ "doc/examples/osmo-bsc_mgcp/mgcp.cfg"]
+
+ def vty_app(self):
+ return (4243, "./src/osmo-bsc_mgcp/osmo-bsc_mgcp", "OpenBSC MGCP", "mgcp")
+
+ def testForcePtime(self):
+ self.vty.enable()
+ res = self.vty.command("show running-config")
+ self.assert_(res.find(' rtp force-ptime 20\r') > 0)
+ self.assertEquals(res.find(' no rtp force-ptime\r'), -1)
+
+ self.vty.command("configure terminal")
+ self.vty.command("mgcp")
+ self.vty.command("no rtp force-ptime")
+ res = self.vty.command("show running-config")
+ self.assertEquals(res.find(' rtp force-ptime 20\r'), -1)
+ self.assertEquals(res.find(' no rtp force-ptime\r'), -1)
+
class TestVTYGenericBSC(TestVTYBase):
@@ -656,6 +677,7 @@ if __name__ == '__main__':
os.chdir(workdir)
print "Running tests for specific VTY commands"
suite = unittest.TestSuite()
+ suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYMGCP))
suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYNITB))
add_bsc_test(suite, workdir)
add_nat_test(suite, workdir)