API: Change ip4_address and ip6_address to use type alias.
[vpp.git] / test / test_ip4.py
index 9ec7f4e..c130241 100644 (file)
@@ -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
@@ -1211,7 +1213,7 @@ class TestIPPunt(VppTestCase):
         for p in punts:
             self.assertEqual(p.punt.tx_sw_if_index, self.pg3.sw_if_index)
         self.assertNotEqual(punts[1].punt.nh.un.ip4, self.pg3.remote_ip4)
-        self.assertEqual(punts[2].punt.nh.un.ip4.address, '\x00'*4)
+        self.assertEqual(punts[2].punt.nh.un.ip4, '\x00'*4)
 
 
 class TestIPDeag(VppTestCase):