summaryrefslogtreecommitdiffstats
path: root/src/scripts/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-03-04 05:37:52 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2017-03-10 19:24:57 +0000
commitd79b41e993981df80245b0e6d90eb691bdaae648 (patch)
tree44f9a96c04dfab309fbf8a06369446620da35188 /src/scripts/vnet
parent8d55247297a335241097cc503a99854bbc79d4cd (diff)
VPP-659 TCP improvements
- builtin test echo server - fix SYN-ACK retransmit canceling - avoid sending spurious ACK if in LAST_ACK - improved client dummy test app - renamed tx fifo dequeuing and sending functions to avoid confusion - improved RST handling Change-Id: Ia14aad3df319540dcf6e6a4e18a9f8d423a4b83b Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/scripts/vnet')
-rw-r--r--src/scripts/vnet/uri/afp_setup.cli (renamed from src/scripts/vnet/uri/tcp_server)0
-rw-r--r--src/scripts/vnet/uri/dummy_app.py26
-rw-r--r--src/scripts/vnet/uri/tap_setup.cli5
3 files changed, 28 insertions, 3 deletions
diff --git a/src/scripts/vnet/uri/tcp_server b/src/scripts/vnet/uri/afp_setup.cli
index c29afc6f5a1..c29afc6f5a1 100644
--- a/src/scripts/vnet/uri/tcp_server
+++ b/src/scripts/vnet/uri/afp_setup.cli
diff --git a/src/scripts/vnet/uri/dummy_app.py b/src/scripts/vnet/uri/dummy_app.py
index b80fbb28163..50333923d6e 100644
--- a/src/scripts/vnet/uri/dummy_app.py
+++ b/src/scripts/vnet/uri/dummy_app.py
@@ -2,7 +2,7 @@
import socket
import sys
-import bitstring
+import time
# action can be reflect or drop
action = "drop"
@@ -22,6 +22,7 @@ def handle_connection (connection, client_address):
def run_server(ip, port):
print("Starting server {}:{}".format(repr(ip), repr(port)))
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_address = (ip, int(port))
sock.bind(server_address)
sock.listen(1)
@@ -39,12 +40,31 @@ def prepare_data():
def run_client(ip, port):
print("Starting client {}:{}".format(repr(ip), repr(port)))
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- server_address = ("6.0.1.1", 1234)
+ server_address = (ip, port)
sock.connect(server_address)
data = prepare_data()
+ n_rcvd = 0
+ n_sent = len (data)
try:
sock.sendall(data)
+
+ timeout = time.time() + 2
+ while n_rcvd < n_sent and time.time() < timeout:
+ tmp = sock.recv(1500)
+ tmp = bytearray (tmp)
+ n_read = len(tmp)
+ for i in range(n_read):
+ if (data[n_rcvd + i] != tmp[i]):
+ print("Difference at byte {}. Sent {} got {}"
+ .format(n_rcvd + i, data[n_rcvd + i], tmp[i]))
+ n_rcvd += n_read
+
+ if (n_rcvd < n_sent or n_rcvd > n_sent):
+ print("Sent {} and got back {}".format(n_sent, n_rcvd))
+ else:
+ print("Got back what we've sent!!");
+
finally:
sock.close()
@@ -62,4 +82,4 @@ if __name__ == "__main__":
if (len(sys.argv) == 5):
action = sys.argv[4]
- run (sys.argv[1], sys.argv[2], sys.argv[3])
+ run (sys.argv[1], sys.argv[2], int(sys.argv[3]))
diff --git a/src/scripts/vnet/uri/tap_setup.cli b/src/scripts/vnet/uri/tap_setup.cli
new file mode 100644
index 00000000000..1d9a1b36287
--- /dev/null
+++ b/src/scripts/vnet/uri/tap_setup.cli
@@ -0,0 +1,5 @@
+tap connect tap0 address 6.0.1.2/24
+set int ip addr tap-0 6.0.1.1/24
+set int state tap-0 up
+trace add tapcli-rx 10
+session enable