From 7f99183a20d60cd5c648cc23d7a2f30a594a215b Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Thu, 6 Dec 2018 17:35:12 +0100 Subject: Test framework: StringIO fixes for Python3 Add 2/3 support to binarytomac and mactobinary and move to vpp_mac.py Change-Id: I3dc7e4a24486aee22140c781aae7e44e58935877 Signed-off-by: Ole Troan --- test/test_vxlan.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'test/test_vxlan.py') diff --git a/test/test_vxlan.py b/test/test_vxlan.py index 3c824b5761a..34bf11a53e4 100644 --- a/test/test_vxlan.py +++ b/test/test_vxlan.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import socket -from util import ip4n_range, ip4_range +from util import ip4n_range, ip4_range, reassemble4 import unittest from framework import VppTestCase, VppTestRunner from template_bd import BridgeDomain @@ -11,22 +11,6 @@ from scapy.layers.inet import IP, UDP from scapy.layers.vxlan import VXLAN from scapy.utils import atol -import StringIO - - -def reassemble(listoffragments): - buffer = StringIO.StringIO() - first = listoffragments[0] - buffer.seek(20) - for pkt in listoffragments: - buffer.seek(pkt[IP].frag*8) - buffer.write(pkt[IP].payload) - first.len = len(buffer.getvalue()) + 20 - first.flags = 0 - del(first.chksum) - header = str(first[IP])[:20] - return first[IP].__class__(header + buffer.getvalue()) - class TestVxlan(BridgeDomain, VppTestCase): """ VXLAN Test Case """ @@ -259,7 +243,7 @@ class TestVxlan(BridgeDomain, VppTestCase): # Pick first received frame and check if it's correctly encapsulated. out = self.pg0.get_capture(2) ether = out[0] - pkt = reassemble(out) + pkt = reassemble4(out) pkt = ether / pkt self.check_encapsulation(pkt, self.single_tunnel_bd) -- cgit 1.2.3-korg