aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2018-11-25 11:21:50 -0800
committerOle Trøan <otroan@employees.org>2018-12-05 12:08:24 +0000
commita6fe463c1cb67a52f06e519a514a47a9b6af8057 (patch)
tree86bd5509eb7dfe35c52e04a713ffe8654bbf16fd
parent2e02ba0ddaa8fecbd4b6397787658bd29fcca749 (diff)
VPP-1508 python3 tests: xrange
xrange is not supported. Use six.range. py27 runtests: commands[5] | stestr --test-path ./test run --slowest test_ip4 test_ip6 ============================================================================== IPv4 disabled ============================================================================== ============================================================================== ICMP Echo Test Case ============================================================================== {0} test.test_ip4.TestIPDisabled.test_ip_disabled [5.256819s] ... ok 07:24:41,902 Couldn't stat : /tmp/vpp-unittest-TestICMPEcho-hU4IsB/stats.sock {1} test.test_ip4.TestICMPEcho.test_icmp_echo [0.367035s] ... ok ============================================================================== IPv4 Deaggregate Routes ============================================================================== ============================================================================== IPv4 Input Exceptions ============================================================================== 07:24:47,314 Couldn't stat : /tmp/vpp-unittest-TestIPDeag-eE1VgC/stats.sock {1} test.test_ip4.TestIPDeag.test_ip_deag [5.895646s] ... ok {0} test.test_ip4.TestIPInput.test_ip_input [5.819001s] ... ok ============================================================================== IPv4 longest Prefix Match ... output truncated ... ============================== Failed 4 tests - output below: ============================== test.test_ip4.TestIPv4FibCrud.test_3_add_new_routes --------------------------------------------------- Captured traceback: ~~~~~~~~~~~~~~~~~~ Traceback (most recent call last): File "/vpp/test/test_ip4.py", line 509, in test_3_add_new_routes self.deleted_routes.remove(x) ValueError: list.remove(x): x not in list test.test_ip4.TestIPv4FibCrud.test_2_del_routes ----------------------------------------------- Captured traceback: ~~~~~~~~~~~~~~~~~~ Traceback (most recent call last): File "/vpp/test/test_ip4.py", line 478, in test_2_del_routes self.configured_routes.remove(x) ValueError: list.remove(x): x not in list test.test_ip4_vrf_multi_instance.TestIp4VrfMultiInst.test_ip4_vrf_03 -------------------------------------------------------------------- Captured traceback: ~~~~~~~~~~~~~~~~~~ Traceback (most recent call last): File "/vpp/test/test_ip4_vrf_multi_instance.py", line 465, in test_ip4_vrf_03 self.create_vrf_and_assign_interfaces(1) File "/vpp/test/test_ip4_vrf_multi_instance.py", line 189, in create_vrf_and_assign_interfaces pg_if.set_table_ip4(vrf_id) File "/vpp/test/vpp_interface.py", line 322, in set_table_ip4 self.sw_if_index, 0, self.ip4_table_id) File "/vpp/test/vpp_papi_provider.py", line 264, in sw_interface_set_table 'vrf_id': table_id}) File "/vpp/test/vpp_papi_provider.py", line 196, in api raise UnexpectedApiReturnValueError(msg) test.vpp_papi_provider.UnexpectedApiReturnValueError: API call failed, expected 0 return value instead of -114 in sw_interface_set_table_reply(_0=91, context=1007, retval=-114) test.test_ip4_vrf_multi_instance.TestIp4VrfMultiInst.test_ip4_vrf_02 -------------------------------------------------------------------- Captured traceback: ~~~~~~~~~~~~~~~~~~ Traceback (most recent call last): File "/vpp/test/test_ip4_vrf_multi_instance.py", line 445, in test_ip4_vrf_02 self.reset_vrf_and_remove_from_vrf_list(1) File "/vpp/test/test_ip4_vrf_multi_instance.py", line 208, in reset_vrf_and_remove_from_vrf_list self.vapi.reset_fib(vrf_id, is_ipv6=0) File "/vpp/test/vpp_papi_provider.py", line 1137, in reset_fib 'is_ipv6': is_ipv6, File "/vpp/test/vpp_papi_provider.py", line 196, in api raise UnexpectedApiReturnValueError(msg) test.vpp_papi_provider.UnexpectedApiReturnValueError: API call failed, expected 0 return value instead of -3 in reset_fib_reply(_0=259, context=1198, retval=-3) ====== Totals ====== Ran: 57 tests in 266.0000 sec. - Passed: 53 - Skipped: 0 - Expected Fail: 0 - Unexpected Success: 0 - Failed: 4 Sum of execute time for each test: 157.3925 sec. ============== Worker Balance ============== - Worker 0 (29 tests) => 0:03:52.608995 - Worker 1 (28 tests) => 0:04:08.615473 Test id Runtime (s) --------------------------------------------- ----------- test.test_ip_mcast.TestIPMcast.test_ip6_mcast 8.535 test.test_ip4.TestIPPunt.test_ip_punt 8.082 test.test_ip6.TestIP6Punt.test_ip_punt 6.582 test.test_ip6.TestIPDeag.test_ip_deag 6.175 test.test_ip6.TestIPv6.test_ns 6.171 test.test_ip4.TestIPDeag.test_ip_deag 5.896 test.test_ip6.TestIPv6.test_fib 5.846 test.test_ip4.TestIPInput.test_ip_input 5.819 test.test_ip6.TestIPv6.test_rs 5.737 test.test_ip4.TestIPv4.test_fib 5.267 ERROR: InvocationError for command '/vpp/.tox/py27/bin/stestr --test-path ./test run --slowest test_ip4 test_ip6' (exited with code 1) ______________________________________________________ summary ______________________________________________________ ERROR: py27: commands failed Change-Id: Id9f6ecb4897386f790d82ab908963e4971a3aac8 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-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