aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/acl/acl_test.c
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2019-08-15 12:26:17 +0000
committerDave Barach <openvpp@barachs.net>2019-08-16 19:54:39 +0000
commitc02924ec6ebe0aa8e4903c6ca2cc0bf6c36da8cb (patch)
tree250105b8cbd9759ddffbdd08c65b51c5b2383946 /src/plugins/acl/acl_test.c
parent5cd987dda679fe50b9cd7a834bb9162db39ade78 (diff)
acl: fix stats-segment counters validation on acl update
The stats-segment validation/clear logic for acl counters was wrong, fix it. Also add the code to the unittests to cover that case, add a vat command to enable/disable counters, clean up the unnecessary endian conversion and remove the stray clib_warning() Change-Id: I421297a92e4aeb885c468c72a97cec25981df615 Type: fix Ticket: VPP-1744 Fixes: f995c7122ba0d024b17bc3232e8edd18d5e25088 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com> (cherry picked from commit 4c945dacb9ff9da731301feb26b1edb4ac00e8bd)
Diffstat (limited to 'src/plugins/acl/acl_test.c')
-rw-r--r--src/plugins/acl/acl_test.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/plugins/acl/acl_test.c b/src/plugins/acl/acl_test.c
index 9185cc12329..ec951ad7057 100644
--- a/src/plugins/acl/acl_test.c
+++ b/src/plugins/acl/acl_test.c
@@ -68,7 +68,8 @@ _(acl_interface_add_del_reply) \
_(macip_acl_interface_add_del_reply) \
_(acl_interface_set_acl_list_reply) \
_(acl_interface_set_etype_whitelist_reply) \
-_(macip_acl_del_reply)
+_(macip_acl_del_reply) \
+_(acl_stats_intf_counters_enable_reply)
#define foreach_reply_retval_aclindex_handler \
_(acl_add_replace_reply) \
@@ -310,7 +311,8 @@ _(MACIP_ACL_INTERFACE_ADD_DEL_REPLY, macip_acl_interface_add_del_reply) \
_(MACIP_ACL_INTERFACE_GET_REPLY, macip_acl_interface_get_reply) \
_(ACL_PLUGIN_CONTROL_PING_REPLY, acl_plugin_control_ping_reply) \
_(ACL_PLUGIN_GET_VERSION_REPLY, acl_plugin_get_version_reply) \
-_(ACL_PLUGIN_GET_CONN_TABLE_MAX_ENTRIES_REPLY,acl_plugin_get_conn_table_max_entries_reply)
+_(ACL_PLUGIN_GET_CONN_TABLE_MAX_ENTRIES_REPLY,acl_plugin_get_conn_table_max_entries_reply) \
+_(ACL_STATS_INTF_COUNTERS_ENABLE_REPLY, acl_stats_intf_counters_enable_reply)
static int api_acl_plugin_get_version (vat_main_t * vam)
{
@@ -574,6 +576,36 @@ static int api_acl_plugin_get_conn_table_max_entries (vat_main_t * vam)
return ret;
}
+static int api_acl_stats_intf_counters_enable (vat_main_t * vam)
+{
+ acl_test_main_t * sm = &acl_test_main;
+ unformat_input_t * i = vam->input;
+ vl_api_acl_stats_intf_counters_enable_t * mp;
+ u32 msg_size = sizeof(*mp);
+ int ret;
+
+ vam->result_ready = 0;
+ mp = vl_msg_api_alloc_as_if_client(msg_size);
+ memset (mp, 0, msg_size);
+ mp->_vl_msg_id = ntohs (VL_API_ACL_STATS_INTF_COUNTERS_ENABLE + sm->msg_id_base);
+ mp->client_index = vam->my_client_index;
+ mp->enable = 1;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
+ if (unformat (i, "disable"))
+ mp->enable = 0;
+ else
+ break;
+ }
+
+ /* send it... */
+ S(mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
/*
* Read the series of ACL entries from file in the following format:
@@ -1485,7 +1517,8 @@ _(macip_acl_del, "<acl-idx>")\
_(macip_acl_dump, "[<acl-idx>]") \
_(macip_acl_interface_add_del, "<intfc> | sw_if_index <if-idx> [add|del] acl <acl-idx>") \
_(macip_acl_interface_get, "") \
-_(acl_plugin_get_conn_table_max_entries, "")
+_(acl_plugin_get_conn_table_max_entries, "") \
+_(acl_stats_intf_counters_enable, "[disable]")
static