aboutsummaryrefslogtreecommitdiffstats
path: root/src/vat
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-11-08 12:42:31 +0000
committerOle Trøan <otroan@employees.org>2019-11-26 09:15:11 +0000
commit9db6ada779794779158163f6293b479ae7f6ad5e (patch)
tree53dd65975958b2d87b1cd312e612b45d7225e531 /src/vat
parent0d3d4824a46205e776ff32c82be4cb514f459a5f (diff)
fib: Table Replace
Type: feature from the API doc, a table replace is: " The use-case is that, for some unspecified reason, the control plane has a very different set of entries it wants in the table than VPP currently has. The CP would thus like to 'replace' VPP's current table only by specifying what the new set of entries shall be, i.e. it is not going to delete anything that already eixts. the CP delcartes the start of this procedure with this begin_replace API Call, and when it has populated all the entries it wants, it calls the below end_replace API. From this point on it is of coursce free to add and delete entries as usual. The underlying mechanism by which VPP implements this replace is purposefully left unspecified. " In the FIB, the algorithm is implemented using mark and sweep. Algorithm goes: 1) replace_begin: this marks all the entries in that table as 'stale' 2) download all the entries that should be in this table - this clears the stale flag on those entries 3) signal the table converged: ip_table_replace_end - this removes all entries that are still stale this procedure can be used when an agent first connects to VPP, as an alternative to dump and diff state reconciliation. Change-Id: I168edec10cf7670866076b129ebfe6149ea8222e Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vat')
-rw-r--r--src/vat/api_format.c93
1 files changed, 78 insertions, 15 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 7b5d5949159..924d9c60290 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -5071,6 +5071,9 @@ _(l2fib_flush_int_reply) \
_(l2fib_flush_bd_reply) \
_(ip_route_add_del_reply) \
_(ip_table_add_del_reply) \
+_(ip_table_replace_begin_reply) \
+_(ip_table_flush_reply) \
+_(ip_table_replace_end_reply) \
_(ip_mroute_add_del_reply) \
_(mpls_route_add_del_reply) \
_(mpls_table_add_del_reply) \
@@ -5081,7 +5084,6 @@ _(proxy_arp_add_del_reply) \
_(proxy_arp_intfc_enable_disable_reply) \
_(sw_interface_set_unnumbered_reply) \
_(ip_neighbor_add_del_reply) \
-_(reset_fib_reply) \
_(set_ip_flow_hash_reply) \
_(sw_interface_ip6_enable_disable_reply) \
_(ip6nd_proxy_add_del_reply) \
@@ -5270,6 +5272,9 @@ _(SW_INTERFACE_BOND_DETAILS, sw_interface_bond_details) \
_(SW_INTERFACE_SLAVE_DETAILS, sw_interface_slave_details) \
_(IP_ROUTE_ADD_DEL_REPLY, ip_route_add_del_reply) \
_(IP_TABLE_ADD_DEL_REPLY, ip_table_add_del_reply) \
+_(IP_TABLE_REPLACE_BEGIN_REPLY, ip_table_replace_begin_reply) \
+_(IP_TABLE_FLUSH_REPLY, ip_table_flush_reply) \
+_(IP_TABLE_REPLACE_END_REPLY, ip_table_replace_end_reply) \
_(IP_MROUTE_ADD_DEL_REPLY, ip_mroute_add_del_reply) \
_(MPLS_TABLE_ADD_DEL_REPLY, mpls_table_add_del_reply) \
_(MPLS_ROUTE_ADD_DEL_REPLY, mpls_route_add_del_reply) \
@@ -5285,7 +5290,6 @@ _(SW_INTERFACE_SET_UNNUMBERED_REPLY, \
_(IP_NEIGHBOR_ADD_DEL_REPLY, ip_neighbor_add_del_reply) \
_(CREATE_VLAN_SUBIF_REPLY, create_vlan_subif_reply) \
_(CREATE_SUBIF_REPLY, create_subif_reply) \
-_(RESET_FIB_REPLY, reset_fib_reply) \
_(SET_IP_FLOW_HASH_REPLY, set_ip_flow_hash_reply) \
_(SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY, \
sw_interface_ip6_enable_disable_reply) \
@@ -9210,19 +9214,18 @@ api_create_subif (vat_main_t * vam)
}
static int
-api_reset_fib (vat_main_t * vam)
+api_ip_table_replace_begin (vat_main_t * vam)
{
unformat_input_t *i = vam->input;
- vl_api_reset_fib_t *mp;
- u32 vrf_id = 0;
+ vl_api_ip_table_replace_begin_t *mp;
+ u32 table_id = 0;
u8 is_ipv6 = 0;
- u8 vrf_id_set = 0;
int ret;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (i, "vrf %d", &vrf_id))
- vrf_id_set = 1;
+ if (unformat (i, "table %d", &table_id))
+ ;
else if (unformat (i, "ipv6"))
is_ipv6 = 1;
else
@@ -9232,16 +9235,74 @@ api_reset_fib (vat_main_t * vam)
}
}
- if (vrf_id_set == 0)
+ M (IP_TABLE_REPLACE_BEGIN, mp);
+
+ mp->table.table_id = ntohl (table_id);
+ mp->table.is_ip6 = is_ipv6;
+
+ S (mp);
+ W (ret);
+ return ret;
+}
+
+static int
+api_ip_table_flush (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_ip_table_flush_t *mp;
+ u32 table_id = 0;
+ u8 is_ipv6 = 0;
+
+ int ret;
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
{
- errmsg ("missing vrf id");
- return -99;
+ if (unformat (i, "table %d", &table_id))
+ ;
+ else if (unformat (i, "ipv6"))
+ is_ipv6 = 1;
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
}
- M (RESET_FIB, mp);
+ M (IP_TABLE_FLUSH, mp);
- mp->vrf_id = ntohl (vrf_id);
- mp->is_ipv6 = is_ipv6;
+ mp->table.table_id = ntohl (table_id);
+ mp->table.is_ip6 = is_ipv6;
+
+ S (mp);
+ W (ret);
+ return ret;
+}
+
+static int
+api_ip_table_replace_end (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_ip_table_replace_end_t *mp;
+ u32 table_id = 0;
+ u8 is_ipv6 = 0;
+
+ int ret;
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "table %d", &table_id))
+ ;
+ else if (unformat (i, "ipv6"))
+ is_ipv6 = 1;
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
+ }
+
+ M (IP_TABLE_REPLACE_END, mp);
+
+ mp->table.table_id = ntohl (table_id);
+ mp->table.is_ip6 = is_ipv6;
S (mp);
W (ret);
@@ -21546,7 +21607,9 @@ _(create_subif, "<intfc> | sw_if_index <id> sub_id <n>\n" \
"[outer_vlan_id <n>][inner_vlan_id <n>]\n" \
"[no_tags][one_tag][two_tags][dot1ad][exact_match][default_sub]\n" \
"[outer_vlan_id_any][inner_vlan_id_any]") \
-_(reset_fib, "vrf <n> [ipv6]") \
+_(ip_table_replace_begin, "table <n> [ipv6]") \
+_(ip_table_flush, "table <n> [ipv6]") \
+_(ip_table_replace_end, "table <n> [ipv6]") \
_(set_ip_flow_hash, \
"vrf <n> [src] [dst] [sport] [dport] [proto] [reverse] [ipv6]") \
_(sw_interface_ip6_enable_disable, \