aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-06-01 07:45:05 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2018-04-17 22:29:46 +0000
commite821ab100aea2fb3f740a98650eb750ff5911c49 (patch)
treee679732692ca211858ca64a3125a1e2a82104a7c /test
parent167d458cba92e2f64f48fa7bc4430c770f290561 (diff)
IP mcast: allow unicast address as a next-hop
Change-Id: I5e679f2601e37688f2768620479dc2efb7d19ca3 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_ip_mcast.py53
-rw-r--r--test/vpp_ip_route.py15
-rw-r--r--test/vpp_papi_provider.py4
3 files changed, 64 insertions, 8 deletions
diff --git a/test/test_ip_mcast.py b/test/test_ip_mcast.py
index b4554c67f42..017f0629cd2 100644
--- a/test/test_ip_mcast.py
+++ b/test/test_ip_mcast.py
@@ -111,7 +111,7 @@ class TestIPMcast(VppTestCase):
capture.remove(p)
return capture
- def verify_capture_ip4(self, rx_if, sent):
+ def verify_capture_ip4(self, rx_if, sent, dst_mac=None):
rxd = rx_if.get_capture(len(sent))
try:
@@ -129,8 +129,11 @@ class TestIPMcast(VppTestCase):
tx_ip = tx[IP]
rx_ip = rx[IP]
+ if dst_mac is None:
+ dst_mac = getmacbyip(rx_ip.dst)
+
# check the MAC address on the RX'd packet is correctly formed
- self.assertEqual(eth.dst, getmacbyip(rx_ip.dst))
+ self.assertEqual(eth.dst, dst_mac)
self.assertEqual(rx_ip.src, tx_ip.src)
self.assertEqual(rx_ip.dst, tx_ip.dst)
@@ -226,6 +229,26 @@ class TestIPMcast(VppTestCase):
route_1_1_1_1_232_1_1_1.add_vpp_config()
#
+ # An (S,G).
+ # one accepting interface, pg0, 2 forwarding interfaces
+ # that use unicast next-hops
+ #
+ route_1_1_1_1_232_1_1_2 = VppIpMRoute(
+ self,
+ "1.1.1.1",
+ "232.1.1.2", 64,
+ MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
+ [VppMRoutePath(self.pg0.sw_if_index,
+ MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT),
+ VppMRoutePath(self.pg1.sw_if_index,
+ MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
+ nh=self.pg1.remote_ip4),
+ VppMRoutePath(self.pg2.sw_if_index,
+ MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
+ nh=self.pg2.remote_ip4)])
+ route_1_1_1_1_232_1_1_2.add_vpp_config()
+
+ #
# An (*,G/m).
# one accepting interface, pg0, 1 forwarding interfaces
#
@@ -284,6 +307,26 @@ class TestIPMcast(VppTestCase):
remark="IP multicast packets forwarded on PG3")
#
+ # a stream to the unicast next-hops
+ #
+ self.vapi.cli("clear trace")
+ tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "232.1.1.2")
+ self.pg0.add_stream(tx)
+
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+
+ # We expect replications on Pg1->7
+ self.verify_capture_ip4(self.pg1, tx, dst_mac=self.pg1.remote_mac)
+ self.verify_capture_ip4(self.pg2, tx, dst_mac=self.pg2.remote_mac)
+
+ # no replications on Pg0 nor pg3
+ self.pg0.assert_nothing_captured(
+ remark="IP multicast packets forwarded on PG0")
+ self.pg3.assert_nothing_captured(
+ remark="IP multicast packets forwarded on PG3")
+
+ #
# a stream that matches the route for (*,232.0.0.0/8)
# Send packets with the 9th bit set so we test the correct clearing
# of that bit in the mac rewrite
@@ -316,7 +359,7 @@ class TestIPMcast(VppTestCase):
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
- # We expect replications on Pg1, 2, 3.
+ # We expect replications on Pg1->7
self.verify_capture_ip4(self.pg1, tx)
self.verify_capture_ip4(self.pg2, tx)
self.verify_capture_ip4(self.pg3, tx)
@@ -325,6 +368,10 @@ class TestIPMcast(VppTestCase):
self.verify_capture_ip4(self.pg6, tx)
self.verify_capture_ip4(self.pg7, tx)
+ # no replications on Pg0
+ self.pg0.assert_nothing_captured(
+ remark="IP multicast packets forwarded on PG0")
+
def test_ip6_mcast(self):
""" IPv6 Multicast Replication """
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index 39b2b1ae1e8..17a42fec706 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -185,12 +185,14 @@ class VppRoutePath(object):
class VppMRoutePath(VppRoutePath):
def __init__(self, nh_sw_if_index, flags,
+ nh=None,
proto=DpoProto.DPO_PROTO_IP4,
bier_imp=0):
- super(VppMRoutePath, self).__init__(
- "::" if proto is DpoProto.DPO_PROTO_IP6 else "0.0.0.0",
- nh_sw_if_index,
- proto=proto)
+ if not nh:
+ nh = "::" if proto is DpoProto.DPO_PROTO_IP6 else "0.0.0.0"
+ super(VppMRoutePath, self).__init__(nh,
+ nh_sw_if_index,
+ proto=proto)
self.nh_i_flags = flags
self.bier_imp = bier_imp
@@ -337,6 +339,7 @@ class VppIpMRoute(VppObject):
self.e_flags,
path.proto,
path.nh_itf,
+ path.nh_addr,
path.nh_i_flags,
bier_imp=path.bier_imp,
rpf_id=self.rpf_id,
@@ -352,6 +355,7 @@ class VppIpMRoute(VppObject):
self.e_flags,
path.proto,
path.nh_itf,
+ path.nh_addr,
path.nh_i_flags,
table_id=self.table_id,
bier_imp=path.bier_imp,
@@ -366,6 +370,7 @@ class VppIpMRoute(VppObject):
self.e_flags,
0,
0xffffffff,
+ "",
0,
table_id=self.table_id,
is_ipv6=self.is_ip6)
@@ -378,6 +383,7 @@ class VppIpMRoute(VppObject):
self.e_flags,
0,
0xffffffff,
+ "",
0,
rpf_id=self.rpf_id,
table_id=self.table_id,
@@ -394,6 +400,7 @@ class VppIpMRoute(VppObject):
self.e_flags,
path.proto,
path.nh_itf,
+ path.nh_addr,
path.nh_i_flags,
table_id=self.table_id,
is_ipv6=self.is_ip6)
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 6804b4cfe4a..44cb7b6fc68 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -2300,6 +2300,7 @@ class VppPapiProvider(object):
e_flags,
next_hop_afi,
next_hop_sw_if_index,
+ next_hop_address,
i_flags,
bier_imp=0,
rpf_id=0,
@@ -2324,7 +2325,8 @@ class VppPapiProvider(object):
'next_hop_afi': next_hop_afi,
'grp_address_length': grp_address_length,
'grp_address': grp_address,
- 'src_address': src_address})
+ 'src_address': src_address,
+ 'nh_address': next_hop_address})
def mfib_signal_dump(self):
return self.api(self.papi.mfib_signal_dump, {})