aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_vxlan.py
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-12-06 17:35:12 +0100
committerNeale Ranns <nranns@cisco.com>2018-12-10 08:01:56 +0000
commit7f99183a20d60cd5c648cc23d7a2f30a594a215b (patch)
treebb3934aab296ce5fa531bfc5ab47921a113ffd26 /test/test_vxlan.py
parent521a8d7df423a0b5aaf259d49ca9230705bc25ee (diff)
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 <ot@cisco.com>
Diffstat (limited to 'test/test_vxlan.py')
-rw-r--r--test/test_vxlan.py20
1 files changed, 2 insertions, 18 deletions
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)