aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_ip_route.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2016-11-22 17:07:28 +0000
committerDamjan Marion <dmarion.lists@gmail.com>2017-01-27 19:53:46 +0000
commit32e1c010b0c34fd0984f7fc45fae648a182025c5 (patch)
tree06a440bdc9dc039ad0dcf866acc9e10a6ea5e2e7 /test/vpp_ip_route.py
parent6f692d6e5a8ffc920a728372ef773199bc5466c0 (diff)
IP Multicast FIB (mfib)
- IPv[46] mfib tables with support for (*,G/m), (*,G) and (S,G) exact and longest prefix match - Replication represented via a new replicate DPO. - RPF configuration and data-plane checking - data-plane signals sent to listening control planes. The functions of multicast forwarding entries differ from their unicast conterparts, so we introduce a new mfib_table_t and mfib_entry_t objects. However, we re-use the fib_path_list to resolve and build the entry's output list. the fib_path_list provides the service to construct a replicate DPO for multicast. 'make tests' is added to with two new suites; TEST=mfib, this is invocation of the CLI command 'test mfib' which deals with many path add/remove, flag set/unset scenarios, TEST=ip-mcast, data-plane forwarding tests. Updated applications to use the new MIFB functions; - IPv6 NS/RA. - DHCPv6 unit tests for these are undated accordingly. Change-Id: I49ec37b01f1b170335a5697541c8fd30e6d3a961 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/vpp_ip_route.py')
-rw-r--r--test/vpp_ip_route.py101
1 files changed, 100 insertions, 1 deletions
diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py
index fc9133fbec6..1804fbbdc41 100644
--- a/test/vpp_ip_route.py
+++ b/test/vpp_ip_route.py
@@ -11,7 +11,7 @@ MPLS_IETF_MAX_LABEL = 0xfffff
MPLS_LABEL_INVALID = MPLS_IETF_MAX_LABEL + 1
-class RoutePath:
+class RoutePath(object):
def __init__(
self,
@@ -31,6 +31,14 @@ class RoutePath:
self.nh_addr = socket.inet_pton(socket.AF_INET, nh_addr)
+class MRoutePath(RoutePath):
+
+ def __init__(self, nh_sw_if_index, flags):
+ super(MRoutePath, self).__init__("0.0.0.0",
+ nh_sw_if_index)
+ self.nh_i_flags = flags
+
+
class IpRoute:
"""
IP Route
@@ -94,6 +102,97 @@ class IpRoute:
is_add=0)
+class IpMRoute:
+ """
+ IP Multicast Route
+ """
+
+ def __init__(self, test, src_addr, grp_addr,
+ grp_addr_len, e_flags, paths, table_id=0, is_ip6=0):
+ self._test = test
+ self.paths = paths
+ self.grp_addr_len = grp_addr_len
+ self.table_id = table_id
+ self.e_flags = e_flags
+ self.is_ip6 = is_ip6
+
+ if is_ip6:
+ self.grp_addr = socket.inet_pton(socket.AF_INET6, grp_addr)
+ self.src_addr = socket.inet_pton(socket.AF_INET6, src_addr)
+ else:
+ self.grp_addr = socket.inet_pton(socket.AF_INET, grp_addr)
+ self.src_addr = socket.inet_pton(socket.AF_INET, src_addr)
+
+ def add_vpp_config(self):
+ for path in self.paths:
+ self._test.vapi.ip_mroute_add_del(self.src_addr,
+ self.grp_addr,
+ self.grp_addr_len,
+ self.e_flags,
+ path.nh_itf,
+ path.nh_i_flags,
+ table_id=self.table_id,
+ is_ipv6=self.is_ip6)
+
+ def remove_vpp_config(self):
+ for path in self.paths:
+ self._test.vapi.ip_mroute_add_del(self.src_addr,
+ self.grp_addr,
+ self.grp_addr_len,
+ self.e_flags,
+ path.nh_itf,
+ path.nh_i_flags,
+ table_id=self.table_id,
+ is_add=0,
+ is_ipv6=self.is_ip6)
+
+ def update_entry_flags(self, flags):
+ self.e_flags = flags
+ self._test.vapi.ip_mroute_add_del(self.src_addr,
+ self.grp_addr,
+ self.grp_addr_len,
+ self.e_flags,
+ 0xffffffff,
+ 0,
+ table_id=self.table_id,
+ is_ipv6=self.is_ip6)
+
+ def update_path_flags(self, itf, flags):
+ for path in self.paths:
+ if path.nh_itf == itf:
+ path.nh_i_flags = flags
+ break
+ self._test.vapi.ip_mroute_add_del(self.src_addr,
+ self.grp_addr,
+ self.grp_addr_len,
+ self.e_flags,
+ path.nh_itf,
+ path.nh_i_flags,
+ table_id=self.table_id,
+ is_ipv6=self.is_ip6)
+
+
+class MFibSignal:
+ def __init__(self, test, route, interface, packet):
+ self.route = route
+ self.interface = interface
+ self.packet = packet
+ self.test = test
+
+ def compare(self, signal):
+ self.test.assertEqual(self.interface, signal.sw_if_index)
+ self.test.assertEqual(self.route.table_id, signal.table_id)
+ self.test.assertEqual(self.route.grp_addr_len,
+ signal.grp_address_len)
+ for i in range(self.route.grp_addr_len / 8):
+ self.test.assertEqual(self.route.grp_addr[i],
+ signal.grp_address[i])
+ if (self.route.grp_addr_len > 32):
+ for i in range(4):
+ self.test.assertEqual(self.route.src_addr[i],
+ signal.src_address[i])
+
+
class MplsIpBind:
"""
MPLS to IP Binding