ip-neighbor: Send API event when neighbor is removed
[vpp.git] / src / vnet / ip-neighbor / ip_neighbor.api
index b820360..62730e7 100644 (file)
@@ -41,7 +41,7 @@ enum ip_neighbor_flags: u8
 
 /** \brief IP neighbor
     @param sw_if_index - interface used to reach neighbor
-    @param flags - flags for the nieghbor
+    @param flags - flags for the neighbor
     @param mac_address - l2 address of the neighbor
     @param ip_address - ip4 or ip6 address of the neighbor
 */
@@ -56,7 +56,7 @@ typedef ip_neighbor {
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
     @param is_add - 1 to add neighbor, 0 to delete
-    @param neighbor - the neighor to add/remove
+    @param neighbor - the neighbor to add/remove
 */
 define ip_neighbor_add_del
 {
@@ -70,7 +70,7 @@ define ip_neighbor_add_del
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
     @param retval - return value
-    @param stats_index - the index to use for this neighbor in the stats segement
+    @param stats_index - the index to use for this neighbor in the stats segment
 */
 define ip_neighbor_add_del_reply
 {
@@ -79,10 +79,10 @@ define ip_neighbor_add_del_reply
   u32 stats_index;
 };
 
-/** \brief Dump IP neighboors
+/** \brief Dump IP neighbors
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
-    @param sw_if_index - the interface to dump neighboors, ~0 == all
+    @param sw_if_index - the interface to dump neighbors, ~0 == all
     @param af - address family is ipv[6|4]
 */
 define ip_neighbor_dump
@@ -93,7 +93,7 @@ define ip_neighbor_dump
   vl_api_address_family_t af;
 };
 
-/** \brief IP neighboors dump response
+/** \brief IP neighbors dump response
     @param context - sender context which was passed in the request
     @param age - time between last update and sending this message, in seconds
     @param neighbour - the neighbor
@@ -126,8 +126,60 @@ autoreply define ip_neighbor_config
   bool recycle;
 };
 
-/** \brief Register for IP4 ARP resolution event on receing ARP reply or
-           MAC/IP info from ARP requests in L2 BDs
+/** \brief IP neighbour replace begin
+
+    The use-case is that, for some unspecified reason, the control plane
+    has a different set of neighbours it than VPP
+    currently has. The CP would thus like to 'replace' VPP's set
+    only by specifying what the new set shall be, i.e. it is not
+    going to delete anything that already exists, rather, it wants any
+    unspecified neighbors deleted implicitly.
+    The CP declares the start of this procedure with this replace_begin
+    API Call, and when it has populated all neighbours it wants, it calls
+    the below replace_end API. From this point on it is of course free
+    to add and delete neighbours as usual.
+    The underlying mechanism by which VPP implements this replace is
+    intentionally left unspecified.
+
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+autoreply define ip_neighbor_replace_begin
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief IP neighbour replace end
+
+    see ip_neighbor_replace_begin description.
+
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+autoreply define ip_neighbor_replace_end
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief IP neighbor flush request - removes *all* neighbours.
+     dynamic and static from API/CLI and dynamic from data-plane.
+
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param af - Flush neighbours of this address family
+    @param sw_if_index - Flush on this interface (~0 => all interfaces)
+*/
+autoreply define ip_neighbor_flush
+{
+  u32 client_index;
+  u32 context;
+  vl_api_address_family_t af;
+  vl_api_interface_index_t sw_if_index [default=0xffffffff];
+};
+
+/** \brief Register for IP neighbour events creation
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
     @param enable - 1 => register for events, 0 => cancel registration
@@ -137,6 +189,7 @@ autoreply define ip_neighbor_config
 */
 autoreply define want_ip_neighbor_events
 {
+  option deprecated;
   u32 client_index;
   u32 context;
   bool enable;
@@ -153,6 +206,7 @@ autoreply define want_ip_neighbor_events
 */
 define ip_neighbor_event
 {
+  option deprecated;
   u32 client_index;
   u32 pid;
   vl_api_ip_neighbor_t neighbor;
@@ -163,6 +217,53 @@ service {
     events ip_neighbor_event;
 };
 
+
+/** \brief Register for IP neighbour events (creation or deletion)
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param enable - 1 => register for events, 0 => cancel registration
+    @param pid - sender's pid
+    @param ip - exact IP address of interested neighbor resolution event
+    @param sw_if_index - interface on which the IP address is present.
+*/
+autoreply define want_ip_neighbor_events_v2
+{
+  u32 client_index;
+  u32 context;
+  bool enable;
+  u32 pid;
+  vl_api_address_t ip;
+  vl_api_interface_index_t sw_if_index [default=0xffffffff];
+};
+
+enum ip_neighbor_event_flags
+{
+ /* The neighbor has been added/learned */
+ IP_NEIGHBOR_API_EVENT_FLAG_ADDED = 0x1,
+ /* The neighbor has been removed/expired */
+ IP_NEIGHBOR_API_EVENT_FLAG_REMOVED = 0x2,
+};
+
+/** \brief Tell client about an IP4 ARP resolution event or
+           MAC/IP info from ARP requests in L2 BDs
+    @param client_index - opaque cookie to identify the sender
+    @param pid - client pid registered to receive notification
+    @param flags - Flags
+    @param neighbor -  neighbor
+*/
+define ip_neighbor_event_v2
+{
+  u32 client_index;
+  u32 pid;
+  vl_api_ip_neighbor_event_flags_t flags;
+  vl_api_ip_neighbor_t neighbor;
+};
+
+service {
+  rpc want_ip_neighbor_events_v2 returns want_ip_neighbor_events_v2_reply
+    events ip_neighbor_event_v2;
+};
+
 /*
  * Local Variables:
  * eval: (c-set-style "gnu")