summaryrefslogtreecommitdiffstats
path: root/test/test_vxlan.py
diff options
context:
space:
mode:
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)