summaryrefslogtreecommitdiffstats
path: root/src/plugins/vrrp/vrrp_test.c
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2020-10-08 11:11:27 -0500
committerDamjan Marion <dmarion@me.com>2020-10-24 09:28:56 +0000
commit78f487e113fb0fbd1a06b90f3681d237f7edc495 (patch)
treea159c81a61fc16cd5a590bd6149f10e57abb3995 /src/plugins/vrrp/vrrp_test.c
parent4df9f737a24be94c2988f18337a4ad845b1b0186 (diff)
vrrp: asynchronous events on VR state change
Type: feature Add API message for an API client to subscribe/unsubscribe to receive an event when a VRRP VR changes state. Add code to build and send the events. Change-Id: Ie92cadd4850d4352c1aaa79c4b0a7daa0f3b04e7 Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'src/plugins/vrrp/vrrp_test.c')
-rw-r--r--src/plugins/vrrp/vrrp_test.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/plugins/vrrp/vrrp_test.c b/src/plugins/vrrp/vrrp_test.c
index eaa0c40ecd0..199f5417f1a 100644
--- a/src/plugins/vrrp/vrrp_test.c
+++ b/src/plugins/vrrp/vrrp_test.c
@@ -690,6 +690,38 @@ vl_api_vrrp_vr_peer_details_t_handler (vl_api_vrrp_vr_peer_details_t * mp)
fformat (vam->ofp, "\n");
}
+static int
+api_want_vrrp_vr_events (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_want_vrrp_vr_events_t *mp;
+ int enable = -1;
+ int ret;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "enable"))
+ enable = 1;
+ else if (unformat (i, "disable"))
+ enable = 0;
+ else
+ break;
+ }
+
+ if (enable == -1)
+ {
+ errmsg ("missing enable|disable");
+ return -99;
+ }
+
+ M (WANT_VRRP_VR_EVENTS, mp);
+ mp->enable_disable = enable;
+ S (mp);
+ W (ret);
+
+ return ret;
+}
+
#include <vrrp/vrrp.api_test.c>
/*
* fd.io coding-style-patch-verification: ON