From 44ed4979c9fc6143023aad796cfd8628b08fc47a Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 14 Apr 2016 10:05:13 -0400 Subject: 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 "", line 1, in bind error: [Errno 98] Address already in use ---------------------------------------------------------------------- --- openbsc/tests/vty_test_runner.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'openbsc/tests') 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 -- cgit v1.2.3