aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/contrib
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-05-28 02:45:26 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-05-28 02:45:26 +0800
commit34b5480a6a8310732d28bd6d04d803e62023fa73 (patch)
tree1a1011e42ef50c543500247b8f17de95d8f94060 /openbsc/contrib
parent06e877228b7975083b89b4f8489ff7b98b8409aa (diff)
gprs: Simplify test case code..
Diffstat (limited to 'openbsc/contrib')
-rwxr-xr-xopenbsc/contrib/gb-proxy-unblock-bug.py35
1 files changed, 17 insertions, 18 deletions
diff --git a/openbsc/contrib/gb-proxy-unblock-bug.py b/openbsc/contrib/gb-proxy-unblock-bug.py
index 5a6b587ed..60341c338 100755
--- a/openbsc/contrib/gb-proxy-unblock-bug.py
+++ b/openbsc/contrib/gb-proxy-unblock-bug.py
@@ -21,7 +21,12 @@ socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
socket.bind(("0.0.0.0", 0))
socket.setblocking(1)
-def send_and_receive(packet, port):
+
+import sys
+port = int(sys.argv[1])
+print "Sending data to port: %d" % port
+
+def send_and_receive(packet):
socket.sendto(packet, ("127.0.0.1", port))
try:
@@ -33,27 +38,21 @@ def send_and_receive(packet, port):
return data
#send stuff once
-import sys
-port = int(sys.argv[1])
-print "Sending data to port: %d" % port
-
-res = send_and_receive(bts_ns_reset, port)
-if res != ns_reset_ack:
- print "Failed to get the reset ack"
- sys.exit(-1)
+to_send = [
+ (bts_ns_reset, ns_reset_ack, "reset ack"),
+ (bts_ns_unblock, ns_unblock_ack, "unblock ack"),
+ (bts_bvc_reset_0, ns_bvc_reset_0_ack, "BVCI=0 reset ack"),
+]
-res = send_and_receive(bts_ns_unblock, port)
-if res != ns_unblock_ack:
- print "Failed to get the unblock ack"
- sys.exit(-1)
-res = send_and_receive(bts_bvc_reset_0, port)
-if res != ns_bvc_reset_0_ack:
- print "Failed to get NS BVCI=0 reset ack"
- sys.exit(-1)
+for (out, inp, type) in to_send:
+ res = send_and_receive(out)
+ if res != inp:
+ print "Failed to get the %s" % type
+ sys.exit(-1)
import time
time.sleep(3)
-res = send_and_receive(bts_bvc_reset_8167, port)
+res = send_and_receive(bts_bvc_reset_8167)
print "Send all messages... check wireshark for the last response"