X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_mtu.py;h=e9b4ffed9c1b41f84c3427e41d8e716ada79c36f;hb=ffba3c3;hp=1327c4bfd8e7f14e8657dbe49d89d21ecb2be256;hpb=d723161e038d00e59766aa67a6a0dcc350227e4b;p=vpp.git diff --git a/test/test_mtu.py b/test/test_mtu.py index 1327c4bfd8e..e9b4ffed9c1 100644 --- a/test/test_mtu.py +++ b/test/test_mtu.py @@ -12,7 +12,8 @@ import unittest from scapy.layers.inet6 import IPv6, Ether, IP, UDP, ICMPv6PacketTooBig from scapy.layers.inet import ICMP from framework import VppTestCase, VppTestRunner -from vpp_ip_route import VppIpRoute, VppRoutePath, DpoProto +from vpp_ip import DpoProto +from vpp_ip_route import VppIpRoute, VppRoutePath from socket import AF_INET, AF_INET6, inet_pton import StringIO @@ -119,7 +120,6 @@ class TestMTU(VppTestCase): # n.show2() self.validate_bytes(str(p[1]), icmp4_reply) - ''' # Now with DF off. Expect fragments. # First go with 1500 byte packets. p_payload = UDP(sport=1234, dport=1234) / self.payload( @@ -127,19 +127,18 @@ class TestMTU(VppTestCase): p4 = p_ether / p_ip4 / p_payload p4.flags = 0 p4_reply = p_ip4 / p_payload - p4_reply.ttl = 62 # check this + p4_reply.ttl = 62 # check this p4_reply.flags = 0 p4_reply.id = 256 self.pg_enable_capture() self.pg0.add_stream(p4*1) self.pg_start() rx = self.pg1.get_capture(3) - print('RX', len(rx)) reass_pkt = reassemble(rx) self.validate(reass_pkt, p4_reply) + ''' # Now what happens with a 9K frame - ''' p_payload = UDP(sport=1234, dport=1234) / self.payload( current_mtu - 20 - 8) p4 = p_ether / p_ip4 / p_payload @@ -158,6 +157,7 @@ class TestMTU(VppTestCase): p4_reply.show2() self.validate(reass_pkt, p4_reply) ''' + # Reset MTU self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [current_mtu, 0, 0, 0]) @@ -188,16 +188,16 @@ class TestMTU(VppTestCase): p_icmp6 = ICMPv6PacketTooBig(mtu=1280, cksum=0x4c7a) icmp6_reply = (IPv6(src=self.pg0.local_ip6, dst=self.pg0.remote_ip6, - hlim=254, plen=1240) / + hlim=255, plen=1240) / p_icmp6 / p_ip6 / p_payload) icmp6_reply[2].hlim -= 1 n = icmp6_reply.__class__(str(icmp6_reply)) s = str(icmp6_reply) - icmp6_reply = s[0:1280] + icmp6_reply_str = s[0:1280] rx = self.send_and_expect(self.pg0, p6*9, self.pg0) for p in rx: - self.validate_bytes(str(p[1]), icmp6_reply) + self.validate_bytes(str(p[1]), icmp6_reply_str) # Reset MTU self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index,