diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-04-14 10:05:13 -0400 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-04-14 10:05:13 -0400 |
commit | 44ed4979c9fc6143023aad796cfd8628b08fc47a (patch) | |
tree | 14b6cfccb3b714498b93c6b3538bceb5b7389dca /openbsc/tests | |
parent | f1a61bb99f13b054d912f47dac90a15b2cf56651 (diff) |
nat/vty: Use different port for the mock MSC
Update the comment to reflect that the NAT itself will bind to port
5000 and then the mock MSC will fail to bind to it. Try to move the
mock MSC to another port.
Could fix:
======================================================================
ERROR: testBSCreload (__main__.TestVTYNAT)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./vty_test_runner.py", line 654, in testBSCreload
msc = nat_msc_test(self, ip)
File "./vty_test_runner.py", line 1101, in nat_msc_test
msc.bind((ip, 5000))
File "<string>", line 1, in bind
error: [Errno 98] Address already in use
----------------------------------------------------------------------
Diffstat (limited to 'openbsc/tests')
-rw-r--r-- | openbsc/tests/vty_test_runner.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py index 11b788bcc..a4cfb607f 100644 --- a/openbsc/tests/vty_test_runner.py +++ b/openbsc/tests/vty_test_runner.py @@ -627,7 +627,10 @@ class TestVTYNAT(TestVTYGenericBSC): return (4244, "src/osmo-bsc_nat/osmo-bsc_nat", "OsmoBSCNAT", "nat") def testBSCreload(self): + # Use different port for the mock msc to avoid clashing with + # the osmo-bsc_nat itself ip = "127.0.0.1" + port = 5001 self.vty.enable() bscs1 = self.vty.command("show bscs-config") nat_bsc_reload(self) @@ -650,8 +653,8 @@ class TestVTYNAT(TestVTYGenericBSC): self.vty.command("token xyu") self.vty.command("end") - nat_msc_ip(self, ip) - msc = nat_msc_test(self, ip) + nat_msc_ip(self, ip, port) + msc = nat_msc_test(self, ip, port) b0 = nat_bsc_sock_test(0, "lol") b1 = nat_bsc_sock_test(1, "xyu") b2 = nat_bsc_sock_test(5, "key") @@ -1086,19 +1089,20 @@ def nat_bsc_reload(x): x.vty.command("bscs-config-file bscs.config") x.vty.command("end") -def nat_msc_ip(x, ip): +def nat_msc_ip(x, ip, port): x.vty.command("configure terminal") x.vty.command("nat") x.vty.command("msc ip " + ip) + x.vty.command("msc port " + port) x.vty.command("end") def data2str(d): return "".join("{:02x}".format(ord(c)) for c in d) -def nat_msc_test(x, ip, verbose = False): +def nat_msc_test(x, ip, port, verbose = False): msc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) msc.settimeout(32) - msc.bind((ip, 5000)) + msc.bind((ip, port)) msc.listen(5) if (verbose): print "MSC is ready at " + ip |