aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_mpls.py
diff options
context:
space:
mode:
authorRajesh Goel <rajegoel@cisco.com>2019-10-06 13:17:36 +0530
committerOle Trøan <otroan@employees.org>2019-10-09 09:20:51 +0000
commitd6f1c9c5141c177a14d011a514e392a9357398fb (patch)
treec4a08dd88f69035ae659301980a97fe83923f85a /test/test_mpls.py
parentab96454e3aba8e60094e773a39e9d28f50d7192e (diff)
mpls: support fragmentation of mpls output packet
Type: fix Signed-off-by: Rajesh Goel <rajegoel@cisco.com> Change-Id: Ie4372c5cf58ab215cdec5ce56f8a994daaba2844
Diffstat (limited to 'test/test_mpls.py')
-rw-r--r--test/test_mpls.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/test_mpls.py b/test/test_mpls.py
index 7388cf46c73..5b3054801e7 100644
--- a/test/test_mpls.py
+++ b/test/test_mpls.py
@@ -379,6 +379,30 @@ class TestMPLS(VppTestCase):
except:
raise
+ def verify_capture_fragmented_labelled_ip4(self, src_if, capture, sent,
+ mpls_labels, ip_ttl=None):
+ try:
+ capture = verify_filter(capture, sent)
+
+ for i in range(len(capture)):
+ tx = sent[0]
+ rx = capture[i]
+ tx_ip = tx[IP]
+ rx_ip = rx[IP]
+
+ verify_mpls_stack(self, rx, mpls_labels)
+
+ self.assertEqual(rx_ip.src, tx_ip.src)
+ self.assertEqual(rx_ip.dst, tx_ip.dst)
+ if not ip_ttl:
+ # IP processing post pop has decremented the TTL
+ self.assertEqual(rx_ip.ttl + 1, tx_ip.ttl)
+ else:
+ self.assertEqual(rx_ip.ttl, ip_ttl)
+
+ except:
+ raise
+
def test_swap(self):
""" MPLS label swap tests """
@@ -851,6 +875,38 @@ class TestMPLS(VppTestCase):
route_10_0_0_2.remove_vpp_config()
route_10_0_0_1.remove_vpp_config()
+ def test_imposition_fragmentation(self):
+ """ MPLS label imposition fragmentation test """
+
+ #
+ # Add a ipv4 non-recursive route with a single out label
+ #
+ route_10_0_0_1 = VppIpRoute(self, "10.0.0.1", 32,
+ [VppRoutePath(self.pg0.remote_ip4,
+ self.pg0.sw_if_index,
+ labels=[VppMplsLabel(32)])])
+ route_10_0_0_1.add_vpp_config()
+
+ #
+ # a stream that matches the route for 10.0.0.1
+ # PG0 is in the default table
+ #
+ tx = self.create_stream_ip4(self.pg0, "10.0.0.1")
+ for i in range(0, 257):
+ self.extend_packet(tx[i], 10000)
+
+ #
+ # 5 fragments per packet (257*5=1285)
+ #
+ rx = self.send_and_expect(self.pg0, tx, self.pg0, 1285)
+ self.verify_capture_fragmented_labelled_ip4(self.pg0, rx, tx,
+ [VppMplsLabel(32)])
+
+ #
+ # cleanup
+ #
+ route_10_0_0_1.remove_vpp_config()
+
def test_tunnel_pipe(self):
""" MPLS Tunnel Tests - Pipe """