aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2018-06-07 10:17:57 +0200
committerDamjan Marion <dmarion@me.com>2018-06-11 10:25:59 +0000
commitd723161e038d00e59766aa67a6a0dcc350227e4b (patch)
tree24f5a1d87ebdc0012f28d42aa80a9f5d760073bf /test
parentf4fd0d4217ab6c41fe6b093871bd40ac130e6486 (diff)
MTU: Software interface / Per-protocol MTU support
This patch separates setting of hardware interfaec and software interface MTU. Software MTU is L2 payload MTU (i.e. not including L2 header). Per-protocol MTU for IPv4, IPv6 and MPLS can also be set. Currently only IP4, IP6 are enabled in adjacency / rewrite code. Documentation in src/vnet/MTU.md Change-Id: Iee2fd6f0bbc8210748dd8e073ab9fab87d323690 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_ip4.py6
-rw-r--r--test/test_mtu.py26
-rw-r--r--test/vpp_papi_provider.py2
3 files changed, 13 insertions, 21 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 5b5cf09c86f..83129e2462d 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -1298,7 +1298,7 @@ class TestIPInput(VppTestCase):
UDP(sport=1234, dport=1234) /
Raw('\xa5' * 2000))
- self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, 1500)
+ self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [1500, 0, 0, 0])
rx = self.send_and_expect(self.pg0, p_mtu * 65, self.pg0)
rx = rx[0]
@@ -1310,9 +1310,11 @@ class TestIPInput(VppTestCase):
self.assertEqual(icmp.src, self.pg0.remote_ip4)
self.assertEqual(icmp.dst, self.pg1.remote_ip4)
- self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, 2500)
+ self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [2500, 0, 0, 0])
rx = self.send_and_expect(self.pg0, p_mtu * 65, self.pg1)
+ # Reset MTU for subsequent tests
+ self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [9000, 0, 0, 0])
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)
diff --git a/test/test_mtu.py b/test/test_mtu.py
index cef0ec0d8d5..1327c4bfd8e 100644
--- a/test/test_mtu.py
+++ b/test/test_mtu.py
@@ -76,23 +76,17 @@ class TestMTU(VppTestCase):
rv = self.vapi.sw_interface_dump()
for i in rv:
if i.sw_if_index == sw_if_index:
- return i.link_mtu
+ return i.mtu[0]
return 0
def test_ip4_mtu(self):
""" IP4 MTU test """
- #
- # TODO: Link MTU is 216 bytes 'off'. Fix when L3 MTU patches committed
- #
- mtu_offset = 216
p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac)
p_ip4 = IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4,
flags='DF')
- # TODO: Re-enable when MTU fixes are committed
current_mtu = self.get_mtu(self.pg1.sw_if_index)
- current_mtu -= mtu_offset
p_payload = UDP(sport=1234, dport=1234) / self.payload(
current_mtu - 20 - 8)
@@ -105,8 +99,8 @@ class TestMTU(VppTestCase):
self.validate(p[1], p4_reply)
# MTU
- self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, 576 + mtu_offset)
- self.assertEqual(576, self.get_mtu(self.pg1.sw_if_index) - mtu_offset)
+ self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [576, 0, 0, 0])
+ self.assertEqual(576, self.get_mtu(self.pg1.sw_if_index))
# Should fail. Too large MTU
p_icmp4 = ICMP(type='dest-unreach', code='fragmentation-needed',
@@ -166,17 +160,12 @@ class TestMTU(VppTestCase):
'''
# Reset MTU
self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index,
- current_mtu + mtu_offset)
+ [current_mtu, 0, 0, 0])
def test_ip6_mtu(self):
""" IP6 MTU test """
- #
- # TODO: Link MTU is 216 bytes 'off'. Fix when L3 MTU patches committed
- #
- mtu_offset = 216
current_mtu = self.get_mtu(self.pg1.sw_if_index)
- current_mtu -= mtu_offset
p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac)
p_ip6 = IPv6(src=self.pg0.remote_ip6, dst=self.pg1.remote_ip6)
@@ -192,8 +181,8 @@ class TestMTU(VppTestCase):
self.validate(p[1], p6_reply)
# MTU (only checked on encap)
- self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, 1280 + mtu_offset)
- self.assertEqual(1280, self.get_mtu(self.pg1.sw_if_index) - mtu_offset)
+ self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [1280, 0, 0, 0])
+ self.assertEqual(1280, self.get_mtu(self.pg1.sw_if_index))
# Should fail. Too large MTU
p_icmp6 = ICMPv6PacketTooBig(mtu=1280, cksum=0x4c7a)
@@ -211,7 +200,8 @@ class TestMTU(VppTestCase):
self.validate_bytes(str(p[1]), icmp6_reply)
# Reset MTU
- self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, current_mtu)
+ self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index,
+ [current_mtu, 0, 0, 0])
if __name__ == '__main__':
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 1a09d8c5e21..34010125e3a 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -702,7 +702,7 @@ class VppPapiProvider(object):
{'sw_if_index': sw_if_index,
'admin_up_down': admin_up_down})
- def sw_interface_set_mtu(self, sw_if_index, mtu):
+ def sw_interface_set_mtu(self, sw_if_index, mtu=[0, 0, 0, 0]):
"""
:param sw_if_index:
:param mtu: