diff options
author | Neale Ranns <nranns@cisco.com> | 2019-03-11 05:34:50 -0700 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-03-12 16:02:07 +0000 |
commit | f726f539185609cb4f3aee7f34906e8b538cd33e (patch) | |
tree | 4232b62eea207b2bb576d959316bedf80cd72030 | |
parent | fa0ac2c5668cb8f387a8e16dcf8d2d7154a09fe2 (diff) |
FIB: path parsing, table-id not fib-index (VPP-1586)
Change-Id: Ib27952935393163eaabf005c69b1cbc2feca2b98
Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r-- | src/vnet/fib/fib_api.c | 12 | ||||
-rw-r--r-- | test/test_abf.py | 30 | ||||
-rw-r--r-- | test/test_bier.py | 10 |
3 files changed, 44 insertions, 8 deletions
diff --git a/src/vnet/fib/fib_api.c b/src/vnet/fib/fib_api.c index 98f92c3e73f..ada0012ecd0 100644 --- a/src/vnet/fib/fib_api.c +++ b/src/vnet/fib/fib_api.c @@ -56,10 +56,20 @@ fib_path_api_parse (const vl_api_fib_path_t *in, out->frp_proto = in->afi; // .frp_addr = (NULL == next_hop ? zero_addr : *next_hop), out->frp_sw_if_index = ntohl(in->sw_if_index); - out->frp_fib_index = ntohl(in->table_id); out->frp_weight = in->weight; out->frp_preference = in->preference; + if (DPO_PROTO_IP4 == out->frp_proto || + DPO_PROTO_IP6 == out->frp_proto || + DPO_PROTO_MPLS == out->frp_proto) + { + out->frp_fib_index = fib_table_find (dpo_proto_to_fib(out->frp_proto), + ntohl (in->table_id)); + + if (~0 == out->frp_fib_index) + return (VNET_API_ERROR_NO_SUCH_FIB); + } + /* * the special INVALID label meams we are not recursing via a * label. Exp-null value is never a valid via-label so that diff --git a/test/test_abf.py b/test/test_abf.py index cff56c4d309..69d561bc19c 100644 --- a/test/test_abf.py +++ b/test/test_abf.py @@ -5,7 +5,7 @@ import unittest from framework import VppTestCase, VppTestRunner from vpp_ip import DpoProto -from vpp_ip_route import VppIpRoute, VppRoutePath, VppMplsLabel +from vpp_ip_route import VppIpRoute, VppRoutePath, VppMplsLabel, VppIpTable from scapy.packet import Raw from scapy.layers.l2 import Ether @@ -144,9 +144,9 @@ class TestAbf(VppTestCase): def setUp(self): super(TestAbf, self).setUp() - self.create_pg_interfaces(range(4)) + self.create_pg_interfaces(range(5)) - for i in self.pg_interfaces: + for i in self.pg_interfaces[:4]: i.admin_up() i.config_ip4() i.resolve_arp() @@ -266,6 +266,30 @@ class TestAbf(VppTestCase): self.send_and_assert_no_replies(self.pg1, p_2 * 65, "Detached") + # + # Swap to route via a next-hop in the non-default table + # + table_20 = VppIpTable(self, 20) + table_20.add_vpp_config() + + self.pg4.set_table_ip4(table_20.table_id) + self.pg4.admin_up() + self.pg4.config_ip4() + self.pg4.resolve_arp() + + abf_13 = VppAbfPolicy(self, 13, acl_1, + [VppRoutePath(self.pg4.remote_ip4, + 0xffffffff, + nh_table_id=table_20.table_id)]) + abf_13.add_vpp_config() + attach_5 = VppAbfAttach(self, 13, self.pg0.sw_if_index, 30) + attach_5.add_vpp_config() + + self.send_and_expect(self.pg0, p_1*65, self.pg4) + + self.pg4.unconfig_ip4() + self.pg4.set_table_ip4(0) + def test_abf6(self): """ IPv6 ACL Based Forwarding """ diff --git a/test/test_bier.py b/test/test_bier.py index 58ca3b08ebc..cd2d4c03af9 100644 --- a/test/test_bier.py +++ b/test/test_bier.py @@ -583,10 +583,12 @@ class TestBier(VppTestCase): proto=DpoProto.DPO_PROTO_BIER, nh_table_id=8)]) bier_route_1.add_vpp_config() - bier_route_max = VppBierRoute(self, bti, max_bp, - [VppRoutePath("0.0.0.0", - 0xffffffff, - nh_table_id=8)]) + bier_route_max = VppBierRoute( + self, bti, max_bp, + [VppRoutePath("0.0.0.0", + 0xffffffff, + nh_table_id=8, + proto=DpoProto.DPO_PROTO_BIER)]) bier_route_max.add_vpp_config() # |