From 78f487e113fb0fbd1a06b90f3681d237f7edc495 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Thu, 8 Oct 2020 11:11:27 -0500 Subject: 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 --- src/plugins/vrrp/vrrp_test.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/plugins/vrrp/vrrp_test.c') 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 /* * fd.io coding-style-patch-verification: ON -- cgit 1.2.3-korg