summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_mpls.py77
-rw-r--r--test/vpp_ip_route.py9
2 files changed, 78 insertions, 8 deletions
diff --git a/test/test_mpls.py b/test/test_mpls.py
index d0c9e249..77cec429 100644
--- a/test/test_mpls.py
+++ b/test/test_mpls.py
@@ -102,7 +102,10 @@ class TestMPLS(VppTestCase):
pkts.append(p)
return pkts
- def create_stream_labelled_ip6(self, src_if, mpls_label, mpls_ttl):
+ def create_stream_labelled_ip6(self, src_if, mpls_label, mpls_ttl,
+ dst_ip=None):
+ if dst_ip is None:
+ dst_ip = src_if.remote_ip6
self.reset_packet_infos()
pkts = []
for i in range(0, 257):
@@ -110,7 +113,7 @@ class TestMPLS(VppTestCase):
payload = self.info_to_payload(info)
p = (Ether(dst=src_if.local_mac, src=src_if.remote_mac) /
MPLS(label=mpls_label, ttl=mpls_ttl) /
- IPv6(src=src_if.remote_ip6, dst=src_if.remote_ip6) /
+ IPv6(src=src_if.remote_ip6, dst=dst_ip) /
UDP(sport=1234, dport=1234) /
Raw(payload))
info.data = p.copy()
@@ -928,8 +931,8 @@ class TestMPLS(VppTestCase):
rx = self.pg3.get_capture(257)
self.verify_capture_tunneled_ip4(self.pg0, rx, tx, [43])
- def test_mcast_tail(self):
- """ MPLS Multicast Tail """
+ def test_mcast_ip4_tail(self):
+ """ MPLS IPv4 Multicast Tail """
#
# Add a multicast route that will forward the traffic
@@ -994,6 +997,72 @@ class TestMPLS(VppTestCase):
dst_ip="232.1.1.1")
self.send_and_assert_no_replies(self.pg0, tx, "RPF-ID drop 56")
+ def test_mcast_ip6_tail(self):
+ """ MPLS IPv6 Multicast Tail """
+
+ #
+ # Add a multicast route that will forward the traffic
+ # post-disposition
+ #
+ route_ff = VppIpMRoute(
+ self,
+ "::",
+ "ff01::1", 32,
+ MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
+ table_id=1,
+ paths=[VppMRoutePath(self.pg1.sw_if_index,
+ MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)],
+ is_ip6=1)
+ route_ff.add_vpp_config()
+
+ #
+ # An interface receive label that maps traffic to RX on interface
+ # pg1
+ # by injecting the packet in on pg0, which is in table 0
+ # doing an rpf-id and matching a route in table 1
+ # if the packet egresses, then we must have matched the route in
+ # table 1
+ #
+ route_34_eos = VppMplsRoute(
+ self, 34, 1,
+ [VppRoutePath("::",
+ self.pg1.sw_if_index,
+ nh_table_id=1,
+ rpf_id=55,
+ is_ip6=1)],
+ is_multicast=1)
+
+ route_34_eos.add_vpp_config()
+
+ #
+ # Drop due to interface lookup miss
+ #
+ tx = self.create_stream_labelled_ip6(self.pg0, [34], 255,
+ dst_ip="ff01::1")
+
+ #
+ # set the RPF-ID of the enrtry to match the input packet's
+ #
+ route_ff.update_rpf_id(55)
+
+ tx = self.create_stream_labelled_ip6(self.pg0, [34], 255,
+ dst_ip="ff01::1")
+ self.pg0.add_stream(tx)
+
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+
+ rx = self.pg1.get_capture(257)
+ self.verify_capture_ip6(self.pg1, rx, tx)
+
+ #
+ # set the RPF-ID of the enrtry to not match the input packet's
+ #
+ route_ff.update_rpf_id(56)
+ tx = self.create_stream_labelled_ip6(self.pg0, [34], 225,
+ dst_ip="ff01::1")
+ self.send_and_assert_no_replies(self.pg0, tx, "RPF-ID drop 56")
+
class TestMPLSDisabled(VppTestCase):
""" MPLS disabled """
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index b68e2105..badb3102 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -66,10 +66,11 @@ class VppRoutePath(object):
self.nh_labels = labels
self.weight = 1
self.rpf_id = rpf_id
- if is_ip6:
- self.nh_addr = inet_pton(AF_INET6, nh_addr)
- else:
+ self.is_ip4 = 1 if is_ip6 == 0 else 0
+ if self.is_ip4:
self.nh_addr = inet_pton(AF_INET, nh_addr)
+ else:
+ self.nh_addr = inet_pton(AF_INET6, nh_addr)
self.is_resolve_host = is_resolve_host
self.is_resolve_attached = is_resolve_attached
self.is_interface_rx = is_interface_rx
@@ -400,7 +401,7 @@ class VppMplsRoute(VppObject):
self._test.vapi.mpls_route_add_del(
self.local_label,
self.eos_bit,
- 1,
+ path.is_ip4,
path.nh_addr,
path.nh_itf,
is_multicast=self.is_multicast,