summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-02-09 06:05:16 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-02-12 11:23:33 +0000
commitffd78d1ef8fe80d1b756a71d42d5eadda60ae996 (patch)
tree99770e8773a7c3dd27c8b9b116edb6a39ace09ea /test
parent2d6f66e1748be190664cbd72c826db32616d759a (diff)
Improve MTU handling
- setting MTU on an interface updates the L3 max bytes too - value cached in the adjacency is also updated - MTU exceeded generates ICMP to sender Change-Id: I343ec71d8e903b529594c4bd0543f04bc7f370b3 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_ip4.py26
-rw-r--r--test/vpp_papi_provider.py10
2 files changed, 36 insertions, 0 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 79d4a36285c..1a611251eb5 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -1287,6 +1287,32 @@ class TestIPInput(VppTestCase):
self.assertEqual(icmp.src, self.pg0.remote_ip4)
self.assertEqual(icmp.dst, self.pg1.remote_ip4)
+ #
+ # MTU exceeded
+ #
+ p_mtu = (Ether(src=self.pg0.remote_mac,
+ dst=self.pg0.local_mac) /
+ IP(src=self.pg0.remote_ip4,
+ dst=self.pg1.remote_ip4,
+ ttl=10) /
+ UDP(sport=1234, dport=1234) /
+ Raw('\xa5' * 2000))
+
+ self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, 1500)
+
+ rx = self.send_and_expect(self.pg0, p_mtu * 65, self.pg0)
+ rx = rx[0]
+ icmp = rx[ICMP]
+
+ self.assertEqual(icmptypes[icmp.type], "dest-unreach")
+ self.assertEqual(icmpcodes[icmp.type][icmp.code],
+ "fragmentation-needed")
+ 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)
+ rx = self.send_and_expect(self.pg0, p_mtu * 65, self.pg1)
+
if __name__ == '__main__':
unittest.main(testRunner=VppTestRunner)
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 15a566c5bc7..b7c76530307 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -629,6 +629,16 @@ 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):
+ """
+ :param sw_if_index:
+ :param mtu:
+
+ """
+ return self.api(self.papi.sw_interface_set_mtu,
+ {'sw_if_index': sw_if_index,
+ 'mtu': mtu})
+
def create_subif(self, sw_if_index, sub_id, outer_vlan, inner_vlan,
no_tags=0, one_tag=0, two_tags=0, dot1ad=0, exact_match=0,
default_sub=0, outer_vlan_id_any=0, inner_vlan_id_any=0):