summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vat/api_format.c17
-rw-r--r--src/vnet/devices/virtio/vhost_user_api.c6
-rw-r--r--src/vnet/interface.api19
-rw-r--r--src/vnet/interface_api.c8
-rw-r--r--src/vnet/unix/tap_api.c6
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java2
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java18
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java2
-rw-r--r--src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java5
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/util.py3
-rw-r--r--src/vpp/api/custom_dump.c20
-rw-r--r--test/vpp_papi_provider.py9
12 files changed, 65 insertions, 50 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 009cf173064..ddcd5621808 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -972,8 +972,8 @@ static void vl_api_sw_interface_details_t_handler_json
}
#if VPP_API_TEST_BUILTIN == 0
-static void vl_api_sw_interface_set_flags_t_handler
- (vl_api_sw_interface_set_flags_t * mp)
+static void vl_api_sw_interface_event_t_handler
+ (vl_api_sw_interface_event_t * mp)
{
vat_main_t *vam = &vat_main;
if (vam->interface_event_display)
@@ -984,8 +984,8 @@ static void vl_api_sw_interface_set_flags_t_handler
}
#endif
-static void vl_api_sw_interface_set_flags_t_handler_json
- (vl_api_sw_interface_set_flags_t * mp)
+static void vl_api_sw_interface_event_t_handler_json
+ (vl_api_sw_interface_event_t * mp)
{
/* JSON output not supported */
}
@@ -5026,7 +5026,7 @@ _(LLDP_CONFIG_REPLY, lldp_config_reply) \
_(SW_INTERFACE_SET_LLDP_REPLY, sw_interface_set_lldp_reply)
#define foreach_standalone_reply_msg \
-_(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
+_(SW_INTERFACE_EVENT, sw_interface_event) \
_(VNET_INTERFACE_SIMPLE_COUNTERS, vnet_interface_simple_counters) \
_(VNET_INTERFACE_COMBINED_COUNTERS, vnet_interface_combined_counters) \
_(VNET_IP4_FIB_COUNTERS, vnet_ip4_fib_counters) \
@@ -5772,7 +5772,7 @@ api_sw_interface_set_flags (vat_main_t * vam)
vl_api_sw_interface_set_flags_t *mp;
u32 sw_if_index;
u8 sw_if_index_set = 0;
- u8 admin_up = 0, link_up = 0;
+ u8 admin_up = 0;
int ret;
/* Parse args required to build the message */
@@ -5782,10 +5782,6 @@ api_sw_interface_set_flags (vat_main_t * vam)
admin_up = 1;
else if (unformat (i, "admin-down"))
admin_up = 0;
- else if (unformat (i, "link-up"))
- link_up = 1;
- else if (unformat (i, "link-down"))
- link_up = 0;
else
if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
sw_if_index_set = 1;
@@ -5805,7 +5801,6 @@ api_sw_interface_set_flags (vat_main_t * vam)
M (SW_INTERFACE_SET_FLAGS, mp);
mp->sw_if_index = ntohl (sw_if_index);
mp->admin_up_down = admin_up;
- mp->link_up_down = link_up;
/* send it... */
S (mp);
diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c
index 8dbd032b117..3f0aac9eebf 100644
--- a/src/vnet/devices/virtio/vhost_user_api.c
+++ b/src/vnet/devices/virtio/vhost_user_api.c
@@ -52,11 +52,11 @@ _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump)
* WARNING: replicated pending api refactor completion
*/
static void
-send_sw_interface_flags_deleted (vpe_api_main_t * am,
+send_sw_interface_event_deleted (vpe_api_main_t * am,
unix_shared_memory_queue_t * q,
u32 sw_if_index)
{
- vl_api_sw_interface_set_flags_t *mp;
+ vl_api_sw_interface_event_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
memset (mp, 0, sizeof (*mp));
@@ -143,7 +143,7 @@ vl_api_delete_vhost_user_if_t_handler (vl_api_delete_vhost_user_if_t * mp)
return;
vnet_clear_sw_interface_tag (vnm, sw_if_index);
- send_sw_interface_flags_deleted (vam, q, sw_if_index);
+ send_sw_interface_event_deleted (vam, q, sw_if_index);
}
}
diff --git a/src/vnet/interface.api b/src/vnet/interface.api
index 14ff6d5a522..a18907065a5 100644
--- a/src/vnet/interface.api
+++ b/src/vnet/interface.api
@@ -4,7 +4,6 @@
@param sw_if_index - index of the interface to set flags on
@param admin_up_down - set the admin state, 1 = up, 0 = down
@param link_up_down - Oper state sent on change event, not used in config.
- @param deleted - interface was deleted
*/
autoreply define sw_interface_set_flags
{
@@ -13,8 +12,6 @@ autoreply define sw_interface_set_flags
u32 sw_if_index;
/* 1 = up, 0 = down */
u8 admin_up_down;
- u8 link_up_down;
- u8 deleted;
};
/** \brief Set interface MTU
@@ -31,6 +28,22 @@ autoreply define sw_interface_set_mtu
u16 mtu;
};
+/** \brief Interface Event generated by want_interface_events
+ @param context - sender context, to match reply w/ request
+ @param sw_if_index - index of the interface of the event
+ @param admin_up_down - The administrative state; 1 = up, 0 = down
+ @param link_up_down - The operational state; 1 = up, 0 = down
+ @param deleted - interface was deleted
+*/
+define sw_interface_event
+{
+ u32 context;
+ u32 sw_if_index;
+ u8 admin_up_down;
+ u8 link_up_down;
+ u8 deleted;
+};
+
/** \brief Register for interface events
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index ab0b255ab5a..c56fef688e7 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -571,18 +571,18 @@ event_data_cmp (void *a1, void *a2)
}
static void
-send_sw_interface_flags (vpe_api_main_t * am,
+send_sw_interface_event (vpe_api_main_t * am,
unix_shared_memory_queue_t * q,
vnet_sw_interface_t * swif)
{
- vl_api_sw_interface_set_flags_t *mp;
+ vl_api_sw_interface_event_t *mp;
vnet_main_t *vnm = am->vnet_main;
vnet_hw_interface_t *hi = vnet_get_sup_hw_interface (vnm,
swif->sw_if_index);
mp = vl_msg_api_alloc (sizeof (*mp));
memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_FLAGS);
+ mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_EVENT);
mp->sw_if_index = ntohl (swif->sw_if_index);
mp->admin_up_down = (swif->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? 1 : 0;
@@ -638,7 +638,7 @@ link_state_process (vlib_main_t * vm,
event_data[i]))
{
swif = vnet_get_sw_interface (vnm, event_data[i]);
- send_sw_interface_flags (vam, q, swif);
+ send_sw_interface_event (vam, q, swif);
}
}
}));
diff --git a/src/vnet/unix/tap_api.c b/src/vnet/unix/tap_api.c
index 9b8d52a621e..7e812c4fa17 100644
--- a/src/vnet/unix/tap_api.c
+++ b/src/vnet/unix/tap_api.c
@@ -59,11 +59,11 @@ _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump)
* WARNING: replicated pending api refactor completion
*/
static void
-send_sw_interface_flags_deleted (vpe_api_main_t * am,
+send_sw_interface_event_deleted (vpe_api_main_t * am,
unix_shared_memory_queue_t * q,
u32 sw_if_index)
{
- vl_api_sw_interface_set_flags_t *mp;
+ vl_api_sw_interface_event_t *mp;
mp = vl_msg_api_alloc (sizeof (*mp));
memset (mp, 0, sizeof (*mp));
@@ -196,7 +196,7 @@ vl_api_tap_delete_t_handler (vl_api_tap_delete_t * mp)
vl_msg_api_send_shmem (q, (u8 *) & rmp);
if (!rv)
- send_sw_interface_flags_deleted (vam, q, sw_if_index);
+ send_sw_interface_event_deleted (vam, q, sw_if_index);
}
static void
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java
index b8b108b602e..308dad9faa6 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackJVppFacadeNotificationExample.java
@@ -36,7 +36,7 @@ public class CallbackJVppFacadeNotificationExample {
System.out.println("Successfully connected to VPP");
final AutoCloseable notificationListenerReg =
- jvppCallbackFacade.getNotificationRegistry().registerSwInterfaceSetFlagsNotificationCallback(
+ jvppCallbackFacade.getNotificationRegistry().registerSwInterfaceEventNotificationCallback(
NotificationUtils::printNotification
);
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java
index 6ee2de31bc8..7d56b7ea292 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/CallbackNotificationApiExample.java
@@ -26,10 +26,9 @@ import io.fd.vpp.jvpp.JVppRegistry;
import io.fd.vpp.jvpp.JVppRegistryImpl;
import io.fd.vpp.jvpp.VppCallbackException;
import io.fd.vpp.jvpp.core.JVppCoreImpl;
-import io.fd.vpp.jvpp.core.callback.SwInterfaceSetFlagsCallback;
-import io.fd.vpp.jvpp.core.callback.SwInterfaceSetFlagsNotificationCallback;
+import io.fd.vpp.jvpp.core.callback.SwInterfaceEventNotificationCallback;
import io.fd.vpp.jvpp.core.callback.WantInterfaceEventsCallback;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsNotification;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceEventNotification;
import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsReply;
import io.fd.vpp.jvpp.core.dto.WantInterfaceEventsReply;
@@ -65,12 +64,12 @@ public class CallbackNotificationApiExample {
testCallbackApi();
}
- private static class TestCallback implements SwInterfaceSetFlagsNotificationCallback,
- WantInterfaceEventsCallback, SwInterfaceSetFlagsCallback {
+ private static class TestCallback implements SwInterfaceEventNotificationCallback,
+ WantInterfaceEventsCallback {
@Override
- public void onSwInterfaceSetFlagsNotification(
- final SwInterfaceSetFlagsNotification msg) {
+ public void onSwInterfaceEventNotification(
+ final SwInterfaceEventNotification msg) {
printNotification(msg);
}
@@ -80,11 +79,6 @@ public class CallbackNotificationApiExample {
}
@Override
- public void onSwInterfaceSetFlagsReply(final SwInterfaceSetFlagsReply swInterfaceSetFlagsReply) {
- System.out.println("Interface flags set successfully");
- }
-
- @Override
public void onError(VppCallbackException ex) {
System.out.printf("Received onError exception in getNodeIndexCallback: call=%s, reply=%d, context=%d%n",
ex.getMethodName(), ex.getErrorCode(), ex.getCtxId());
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java
index f445dcc87e4..7460401e36e 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/FutureApiNotificationExample.java
@@ -33,7 +33,7 @@ public class FutureApiNotificationExample {
final FutureJVppCoreFacade jvppFacade = new FutureJVppCoreFacade(registry, new JVppCoreImpl());
final AutoCloseable notificationListenerReg =
jvppFacade.getNotificationRegistry()
- .registerSwInterfaceSetFlagsNotificationCallback(NotificationUtils::printNotification)) {
+ .registerSwInterfaceEventNotificationCallback(NotificationUtils::printNotification)) {
System.out.println("Successfully connected to VPP");
jvppFacade.wantInterfaceEvents(getEnableInterfaceNotificationsReq()).toCompletableFuture().get();
System.out.println("Interface events started");
diff --git a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java
index 7791cafe2a7..d3f9dd2c732 100644
--- a/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java
+++ b/src/vpp-api/java/jvpp-core/io/fd/vpp/jvpp/core/examples/NotificationUtils.java
@@ -18,14 +18,14 @@ package io.fd.vpp.jvpp.core.examples;
import java.io.PrintStream;
import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlags;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceSetFlagsNotification;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceEventNotification;
import io.fd.vpp.jvpp.core.dto.WantInterfaceEvents;
final class NotificationUtils {
private NotificationUtils() {}
- static PrintStream printNotification(final SwInterfaceSetFlagsNotification msg) {
+ static PrintStream printNotification(final SwInterfaceEventNotification msg) {
return System.out.printf("Received interface notification: ifc: %s%n", msg);
}
@@ -33,7 +33,6 @@ final class NotificationUtils {
final SwInterfaceSetFlags swInterfaceSetFlags = new SwInterfaceSetFlags();
swInterfaceSetFlags.swIfIndex = 0;
swInterfaceSetFlags.adminUpDown = 1;
- swInterfaceSetFlags.deleted = 0;
return swInterfaceSetFlags;
}
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/util.py b/src/vpp-api/java/jvpp/gen/jvppgen/util.py
index 947fc31d48a..42394419737 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/util.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/util.py
@@ -161,7 +161,6 @@ unconventional_naming_rep_req = {
#
# FIXME no convention in the naming of events (notifications) in vpe.api
notifications_message_suffixes = ("event", "counters")
-notification_messages_reused = ["sw_interface_set_flags"]
# messages that must be ignored. These messages are INSUFFICIENTLY marked as disabled in vpe.api
# FIXME
@@ -170,7 +169,7 @@ ignored_messages = []
def is_notification(name):
""" Returns true if the structure is a notification regardless of its no other use """
- return is_just_notification(name) or name.lower() in notification_messages_reused
+ return is_just_notification(name)
def is_just_notification(name):
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index a57799cb2c4..0342476a445 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -108,11 +108,30 @@ static void *vl_api_sw_interface_set_flags_t_print
else
s = format (s, "admin-down ");
+ FINISH;
+}
+
+static void *vl_api_sw_interface_event_t_print
+ (vl_api_sw_interface_event_t * mp, void *handle)
+{
+ u8 *s;
+ s = format (0, "SCRIPT: sw_interface_event ");
+
+ s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
+
+ if (mp->admin_up_down)
+ s = format (s, "admin-up ");
+ else
+ s = format (s, "admin-down ");
+
if (mp->link_up_down)
s = format (s, "link-up");
else
s = format (s, "link-down");
+ if (mp->deleted)
+ s = format (s, " deleted");
+
FINISH;
}
@@ -3010,6 +3029,7 @@ foreach_custom_print_no_arg_function
_(CREATE_LOOPBACK, create_loopback) \
_(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \
_(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
+_(SW_INTERFACE_EVENT, sw_interface_event) \
_(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \
_(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \
_(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 4d017c1fd4f..c99d4583334 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -550,21 +550,16 @@ class VppPapiProvider(object):
'tag1': tag1,
'tag2': tag2})
- def sw_interface_set_flags(self, sw_if_index, admin_up_down,
- link_up_down=0, deleted=0):
+ def sw_interface_set_flags(self, sw_if_index, admin_up_down):
"""
:param admin_up_down:
:param sw_if_index:
- :param link_up_down: (Default value = 0)
- :param deleted: (Default value = 0)
"""
return self.api(self.papi.sw_interface_set_flags,
{'sw_if_index': sw_if_index,
- 'admin_up_down': admin_up_down,
- 'link_up_down': link_up_down,
- 'deleted': deleted})
+ 'admin_up_down': admin_up_down})
def create_subif(self, sw_if_index, sub_id, outer_vlan, inner_vlan,
no_tags=0, one_tag=0, two_tags=0, dot1ad=0, exact_match=0,