Change in openbsc[master]: vty_test_runner: Handle MGCP message recv len dynamically

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed Mar 27 21:22:23 UTC 2019


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/13435


Change subject: vty_test_runner: Handle MGCP message recv len dynamically
......................................................................

vty_test_runner: Handle MGCP message recv len dynamically

Change-Id: I536d78a2a1962240e5e369cda9927d8c9955ab86
---
M openbsc/tests/vty_test_runner.py
1 file changed, 12 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/35/13435/1

diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index ca0b879..44ccdd8 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -20,6 +20,7 @@
 import unittest
 import socket
 import subprocess
+import struct
 
 import osmopy.obscvty as obscvty
 import osmopy.osmoutil as osmoutil
@@ -1089,6 +1090,16 @@
         if (verbose):
             print "\tBSC <- NAT: ", s
 
+def ipa_handle_mgcp(x, verbose = False):
+    data = x.recv(3)
+    s = data2str(data)
+    if s[4:] != "fc":
+        print "expected IPA(MGCP) but received %r instead" % (s[4:])
+    ipa_len, = struct.unpack('>H', data[:2])
+    mgcp_msg = x.recv(ipa_len) # MGCP msg
+    if (verbose):
+        print "\tBSC <- NAT (MGCP[%d]): %s" % (ipa_len, mgcp_msg)
+
 def nat_bsc_num_con(x):
     return len(x.vty.command("show bsc connections").split('\n'))
 
@@ -1106,7 +1117,7 @@
     ipa_handle_resp(bsc, tk, verbose, proc=proc)
     if proc:
       print "\tproc.poll() = %r" % proc.poll()
-    bsc.recv(27) # MGCP msg
+    ipa_handle_mgcp(bsc, verbose)
     if proc:
       print "\tproc.poll() = %r" % proc.poll()
     ipa_handle_small(bsc, verbose)

-- 
To view, visit https://gerrit.osmocom.org/13435
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I536d78a2a1962240e5e369cda9927d8c9955ab86
Gerrit-Change-Number: 13435
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190327/684bf692/attachment.html>


More information about the gerrit-log mailing list