aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_ip4.py24
-rw-r--r--test/test_ip6.py41
2 files changed, 34 insertions, 31 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 9ec7f4e8129..c18ce4caa0a 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -4,17 +4,18 @@ import random
import socket
import unittest
+from scapy.contrib.mpls import MPLS
+from scapy.layers.inet import IP, UDP, TCP, ICMP, icmptypes, icmpcodes
+from scapy.layers.l2 import Ether, Dot1Q, ARP
+from scapy.packet import Raw
+from six import moves
+
from framework import VppTestCase, VppTestRunner
-from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint
+from util import ppp
from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpMRoute, \
VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind, \
VppMplsTable, VppIpTable, VppIpAddress
-
-from scapy.packet import Raw
-from scapy.layers.l2 import Ether, Dot1Q, ARP
-from scapy.layers.inet import IP, UDP, TCP, ICMP, icmptypes, icmpcodes
-from util import ppp
-from scapy.contrib.mpls import MPLS
+from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint
class TestIPv4(VppTestCase):
@@ -134,11 +135,12 @@ class TestIPv4(VppTestCase):
UDP(sport=1234, dport=1234))
pkts = [self.modify_packet(src_if, i, pkt_tmpl)
- for i in xrange(self.pg_if_packet_sizes[0],
- self.pg_if_packet_sizes[1], 10)]
+ for i in moves.range(self.pg_if_packet_sizes[0],
+ self.pg_if_packet_sizes[1], 10)]
pkts_b = [self.modify_packet(src_if, i, pkt_tmpl)
- for i in xrange(self.pg_if_packet_sizes[1] + hdr_ext,
- self.pg_if_packet_sizes[2] + hdr_ext, 50)]
+ for i in moves.range(self.pg_if_packet_sizes[1] + hdr_ext,
+ self.pg_if_packet_sizes[2] + hdr_ext,
+ 50)]
pkts.extend(pkts_b)
return pkts
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 849e9f73a41..df2364213d4 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -1,30 +1,30 @@
#!/usr/bin/env python
-import unittest
import socket
+import unittest
+
+import scapy.layers.inet6 as inet6
+from scapy.contrib.mpls import MPLS
+from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6ND_RS, \
+ ICMPv6ND_RA, ICMPv6NDOptMTU, ICMPv6NDOptSrcLLAddr, ICMPv6NDOptPrefixInfo, \
+ ICMPv6ND_NA, ICMPv6NDOptDstLLAddr, ICMPv6DestUnreach, icmp6types, \
+ ICMPv6TimeExceeded, ICMPv6EchoRequest, ICMPv6EchoReply
+from scapy.layers.l2 import Ether, Dot1Q
+from scapy.packet import Raw
+from scapy.utils import inet_pton, inet_ntop
+from scapy.utils6 import in6_getnsma, in6_getnsmac, in6_ptop, in6_islladdr, \
+ in6_mactoifaceid
+from six import moves
from framework import VppTestCase, VppTestRunner
from util import ppp, ip6_normalize
-from vpp_sub_interface import VppSubInterface, VppDot1QSubint
-from vpp_pg_interface import is_ipv6_misc
from vpp_ip import DpoProto
from vpp_ip_route import VppIpRoute, VppRoutePath, find_route, VppIpMRoute, \
VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind, \
VppMplsRoute, VppMplsTable, VppIpTable, VppIpAddress
from vpp_neighbor import find_nbr, VppNeighbor
-
-from scapy.packet import Raw
-from scapy.layers.l2 import Ether, Dot1Q
-import scapy.layers.inet6 as inet6
-from scapy.layers.inet6 import IPv6, ICMPv6ND_NS, ICMPv6ND_RS, \
- ICMPv6ND_RA, getmacbyip6, ICMPv6MRD_Solicitation, \
- ICMPv6NDOptMTU, ICMPv6NDOptSrcLLAddr, ICMPv6NDOptPrefixInfo, \
- ICMPv6ND_NA, ICMPv6NDOptDstLLAddr, ICMPv6DestUnreach, icmp6types, \
- ICMPv6TimeExceeded, ICMPv6EchoRequest, ICMPv6EchoReply
-from scapy.utils6 import in6_getnsma, in6_getnsmac, in6_ptop, in6_islladdr, \
- in6_mactoifaceid, in6_ismaddr
-from scapy.utils import inet_pton, inet_ntop
-from scapy.contrib.mpls import MPLS
+from vpp_pg_interface import is_ipv6_misc
+from vpp_sub_interface import VppSubInterface, VppDot1QSubint
AF_INET6 = socket.AF_INET6
@@ -284,11 +284,12 @@ class TestIPv6(TestIPv6ND):
inet6.UDP(sport=1234, dport=1234))
pkts = [self.modify_packet(src_if, i, pkt_tmpl)
- for i in xrange(self.pg_if_packet_sizes[0],
- self.pg_if_packet_sizes[1], 10)]
+ for i in moves.range(self.pg_if_packet_sizes[0],
+ self.pg_if_packet_sizes[1], 10)]
pkts_b = [self.modify_packet(src_if, i, pkt_tmpl)
- for i in xrange(self.pg_if_packet_sizes[1] + hdr_ext,
- self.pg_if_packet_sizes[2] + hdr_ext, 50)]
+ for i in moves.range(self.pg_if_packet_sizes[1] + hdr_ext,
+ self.pg_if_packet_sizes[2] + hdr_ext,
+ 50)]
pkts.extend(pkts_b)
return pkts