sr: api cleanup
[vpp.git] / src / vat / api_format.c
index 077a4ca..8df56ae 100644 (file)
@@ -426,34 +426,6 @@ api_unformat_sw_if_index (unformat_input_t * input, va_list * args)
 
 #endif /* VPP_API_TEST_BUILTIN */
 
-uword
-unformat_ipsec_api_crypto_alg (unformat_input_t * input, va_list * args)
-{
-  u32 *r = va_arg (*args, u32 *);
-
-  if (0);
-#define _(v,f,s) else if (unformat (input, s)) *r = IPSEC_API_CRYPTO_ALG_##f;
-  foreach_ipsec_crypto_alg
-#undef _
-    else
-    return 0;
-  return 1;
-}
-
-uword
-unformat_ipsec_api_integ_alg (unformat_input_t * input, va_list * args)
-{
-  u32 *r = va_arg (*args, u32 *);
-
-  if (0);
-#define _(v,f,s) else if (unformat (input, s)) *r = IPSEC_API_INTEG_ALG_##f;
-  foreach_ipsec_integ_alg
-#undef _
-    else
-    return 0;
-  return 1;
-}
-
 #if (VPP_API_TEST_BUILTIN==0)
 
 static const char *mfib_flag_names[] = MFIB_ENTRY_NAMES_SHORT;
@@ -1707,12 +1679,11 @@ static void vl_api_virtio_pci_delete_reply_t_handler_json
   vam->result_ready = 1;
 }
 
-static void
-vl_api_bond_create_reply_t_handler (vl_api_bond_create_reply_t * mp)
+static void vl_api_mpls_tunnel_add_del_reply_t_handler
+  (vl_api_mpls_tunnel_add_del_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
-
   if (vam->async_mode)
     {
       vam->async_errors += (retval < 0);
@@ -1723,17 +1694,19 @@ vl_api_bond_create_reply_t_handler (vl_api_bond_create_reply_t * mp)
       vam->sw_if_index = ntohl (mp->sw_if_index);
       vam->result_ready = 1;
     }
+  vam->regenerate_interface_table = 1;
 }
 
-static void vl_api_bond_create_reply_t_handler_json
-  (vl_api_bond_create_reply_t * mp)
+static void vl_api_mpls_tunnel_add_del_reply_t_handler_json
+  (vl_api_mpls_tunnel_add_del_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
 
   vat_json_init_object (&node);
   vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
-  vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index));
+  vat_json_object_add_uint (&node, "tunnel_sw_if_index",
+                           ntohl (mp->sw_if_index));
 
   vat_json_print (vam->ofp, &node);
   vat_json_free (&node);
@@ -1742,12 +1715,11 @@ static void vl_api_bond_create_reply_t_handler_json
   vam->result_ready = 1;
 }
 
-static void
-vl_api_bond_create2_reply_t_handler (vl_api_bond_create2_reply_t * mp)
+static void vl_api_create_vhost_user_if_reply_t_handler
+  (vl_api_create_vhost_user_if_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
-
   if (vam->async_mode)
     {
       vam->async_errors += (retval < 0);
@@ -1758,10 +1730,11 @@ vl_api_bond_create2_reply_t_handler (vl_api_bond_create2_reply_t * mp)
       vam->sw_if_index = ntohl (mp->sw_if_index);
       vam->result_ready = 1;
     }
+  vam->regenerate_interface_table = 1;
 }
 
-static void vl_api_bond_create2_reply_t_handler_json
-  (vl_api_bond_create2_reply_t * mp)
+static void vl_api_create_vhost_user_if_reply_t_handler_json
+  (vl_api_create_vhost_user_if_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
@@ -1777,12 +1750,11 @@ static void vl_api_bond_create2_reply_t_handler_json
   vam->result_ready = 1;
 }
 
-static void
-vl_api_bond_delete_reply_t_handler (vl_api_bond_delete_reply_t * mp)
+static void vl_api_create_vhost_user_if_v2_reply_t_handler
+  (vl_api_create_vhost_user_if_v2_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
-
   if (vam->async_mode)
     {
       vam->async_errors += (retval < 0);
@@ -1790,18 +1762,21 @@ vl_api_bond_delete_reply_t_handler (vl_api_bond_delete_reply_t * mp)
   else
     {
       vam->retval = retval;
+      vam->sw_if_index = ntohl (mp->sw_if_index);
       vam->result_ready = 1;
     }
+  vam->regenerate_interface_table = 1;
 }
 
-static void vl_api_bond_delete_reply_t_handler_json
-  (vl_api_bond_delete_reply_t * mp)
+static void vl_api_create_vhost_user_if_v2_reply_t_handler_json
+  (vl_api_create_vhost_user_if_v2_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
 
   vat_json_init_object (&node);
   vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
+  vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index));
 
   vat_json_print (vam->ofp, &node);
   vat_json_free (&node);
@@ -1810,42 +1785,91 @@ static void vl_api_bond_delete_reply_t_handler_json
   vam->result_ready = 1;
 }
 
-static void
-vl_api_bond_add_member_reply_t_handler (vl_api_bond_add_member_reply_t * mp)
+static void vl_api_ip_address_details_t_handler
+  (vl_api_ip_address_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
-  i32 retval = ntohl (mp->retval);
+  static ip_address_details_t empty_ip_address_details = { {0} };
+  ip_address_details_t *address = NULL;
+  ip_details_t *current_ip_details = NULL;
+  ip_details_t *details = NULL;
 
-  if (vam->async_mode)
+  details = vam->ip_details_by_sw_if_index[vam->is_ipv6];
+
+  if (!details || vam->current_sw_if_index >= vec_len (details)
+      || !details[vam->current_sw_if_index].present)
     {
-      vam->async_errors += (retval < 0);
+      errmsg ("ip address details arrived but not stored");
+      errmsg ("ip_dump should be called first");
+      return;
     }
-  else
+
+  current_ip_details = vec_elt_at_index (details, vam->current_sw_if_index);
+
+#define addresses (current_ip_details->addr)
+
+  vec_validate_init_empty (addresses, vec_len (addresses),
+                          empty_ip_address_details);
+
+  address = vec_elt_at_index (addresses, vec_len (addresses) - 1);
+
+  clib_memcpy (&address->ip, &mp->prefix.address.un, sizeof (address->ip));
+  address->prefix_length = mp->prefix.len;
+#undef addresses
+}
+
+static void vl_api_ip_address_details_t_handler_json
+  (vl_api_ip_address_details_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+  vat_json_node_t *node = NULL;
+
+  if (VAT_JSON_ARRAY != vam->json_tree.type)
     {
-      vam->retval = retval;
-      vam->result_ready = 1;
+      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
+      vat_json_init_array (&vam->json_tree);
     }
+  node = vat_json_array_add (&vam->json_tree);
+
+  vat_json_init_object (node);
+  vat_json_object_add_prefix (node, &mp->prefix);
 }
 
-static void vl_api_bond_add_member_reply_t_handler_json
-  (vl_api_bond_add_member_reply_t * mp)
+static void
+vl_api_ip_details_t_handler (vl_api_ip_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
-  vat_json_node_t node;
+  static ip_details_t empty_ip_details = { 0 };
+  ip_details_t *ip = NULL;
+  u32 sw_if_index = ~0;
 
-  vat_json_init_object (&node);
-  vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
+  sw_if_index = ntohl (mp->sw_if_index);
 
-  vat_json_print (vam->ofp, &node);
-  vat_json_free (&node);
+  vec_validate_init_empty (vam->ip_details_by_sw_if_index[vam->is_ipv6],
+                          sw_if_index, empty_ip_details);
 
-  vam->retval = ntohl (mp->retval);
-  vam->result_ready = 1;
+  ip = vec_elt_at_index (vam->ip_details_by_sw_if_index[vam->is_ipv6],
+                        sw_if_index);
+
+  ip->present = 1;
 }
 
 static void
-vl_api_bond_detach_member_reply_t_handler (vl_api_bond_detach_member_reply_t *
-                                          mp)
+vl_api_ip_details_t_handler_json (vl_api_ip_details_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+
+  if (VAT_JSON_ARRAY != vam->json_tree.type)
+    {
+      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
+      vat_json_init_array (&vam->json_tree);
+    }
+  vat_json_array_add_uint (&vam->json_tree,
+                          clib_net_to_host_u32 (mp->sw_if_index));
+}
+
+static void vl_api_get_first_msg_id_reply_t_handler
+  (vl_api_get_first_msg_id_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
@@ -1859,16 +1883,22 @@ vl_api_bond_detach_member_reply_t_handler (vl_api_bond_detach_member_reply_t *
       vam->retval = retval;
       vam->result_ready = 1;
     }
+  if (retval >= 0)
+    {
+      errmsg ("first message id %d", ntohs (mp->first_msg_id));
+    }
 }
 
-static void vl_api_bond_detach_member_reply_t_handler_json
-  (vl_api_bond_detach_member_reply_t * mp)
+static void vl_api_get_first_msg_id_reply_t_handler_json
+  (vl_api_get_first_msg_id_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
 
   vat_json_init_object (&node);
   vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
+  vat_json_object_add_uint (&node, "first_msg_id",
+                           (uint) ntohs (mp->first_msg_id));
 
   vat_json_print (vam->ofp, &node);
   vat_json_free (&node);
@@ -1877,229 +1907,87 @@ static void vl_api_bond_detach_member_reply_t_handler_json
   vam->result_ready = 1;
 }
 
-static int
-api_sw_interface_set_bond_weight (vat_main_t * vam)
+static void vl_api_get_node_graph_reply_t_handler
+  (vl_api_get_node_graph_reply_t * mp)
 {
-  unformat_input_t *i = vam->input;
-  vl_api_sw_interface_set_bond_weight_t *mp;
-  u32 sw_if_index = ~0;
-  u32 weight = 0;
-  u8 weight_enter = 0;
-  int ret;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       ;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       ;
-      else if (unformat (i, "weight %u", &weight))
-       weight_enter = 1;
-      else
-       break;
-    }
+  vat_main_t *vam = &vat_main;
+  i32 retval = ntohl (mp->retval);
+  u8 *pvt_copy, *reply;
+  void *oldheap;
+  vlib_node_t *node;
+  int i;
 
-  if (sw_if_index == ~0)
+  if (vam->async_mode)
     {
-      errmsg ("missing interface name or sw_if_index");
-      return -99;
+      vam->async_errors += (retval < 0);
     }
-  if (weight_enter == 0)
+  else
     {
-      errmsg ("missing valid weight");
-      return -99;
+      vam->retval = retval;
+      vam->result_ready = 1;
     }
 
-  /* Construct the API message */
-  M (SW_INTERFACE_SET_BOND_WEIGHT, mp);
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->weight = ntohl (weight);
+  /* "Should never happen..." */
+  if (retval != 0)
+    return;
 
-  S (mp);
-  W (ret);
-  return ret;
-}
+  reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
+  pvt_copy = vec_dup (reply);
 
-static void vl_api_sw_bond_interface_details_t_handler
-  (vl_api_sw_bond_interface_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
+  /* Toss the shared-memory original... */
+  oldheap = vl_msg_push_heap ();
 
-  print (vam->ofp,
-        "%-16s %-12d %-12U %-13U %-14u %-14u",
-        mp->interface_name, ntohl (mp->sw_if_index),
-        format_bond_mode, ntohl (mp->mode), format_bond_load_balance,
-        ntohl (mp->lb), ntohl (mp->active_members), ntohl (mp->members));
-}
+  vec_free (reply);
 
-static void vl_api_sw_bond_interface_details_t_handler_json
-  (vl_api_sw_bond_interface_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t *node = NULL;
+  vl_msg_pop_heap (oldheap);
 
-  if (VAT_JSON_ARRAY != vam->json_tree.type)
+  if (vam->graph_nodes)
     {
-      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
-      vat_json_init_array (&vam->json_tree);
-    }
-  node = vat_json_array_add (&vam->json_tree);
+      hash_free (vam->graph_node_index_by_name);
 
-  vat_json_init_object (node);
-  vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
-  vat_json_object_add_string_copy (node, "interface_name",
-                                  mp->interface_name);
-  vat_json_object_add_uint (node, "mode", ntohl (mp->mode));
-  vat_json_object_add_uint (node, "load_balance", ntohl (mp->lb));
-  vat_json_object_add_uint (node, "active_members",
-                           ntohl (mp->active_members));
-  vat_json_object_add_uint (node, "members", ntohl (mp->members));
-}
+      for (i = 0; i < vec_len (vam->graph_nodes[0]); i++)
+       {
+         node = vam->graph_nodes[0][i];
+         vec_free (node->name);
+         vec_free (node->next_nodes);
+         vec_free (node);
+       }
+      vec_free (vam->graph_nodes[0]);
+      vec_free (vam->graph_nodes);
+    }
 
-static int
-api_sw_bond_interface_dump (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_sw_bond_interface_dump_t *mp;
-  vl_api_control_ping_t *mp_ping;
-  int ret;
-  u32 sw_if_index = ~0;
+  vam->graph_node_index_by_name = hash_create_string (0, sizeof (uword));
+  vam->graph_nodes = vlib_node_unserialize (pvt_copy);
+  vec_free (pvt_copy);
 
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+  for (i = 0; i < vec_len (vam->graph_nodes[0]); i++)
     {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       ;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       ;
-      else
-       break;
+      node = vam->graph_nodes[0][i];
+      hash_set_mem (vam->graph_node_index_by_name, node->name, i);
     }
-
-  print (vam->ofp,
-        "\n%-16s %-12s %-12s %-13s %-14s %-14s",
-        "interface name", "sw_if_index", "mode", "load balance",
-        "active members", "members");
-
-  /* Get list of bond interfaces */
-  M (SW_BOND_INTERFACE_DUMP, mp);
-  mp->sw_if_index = ntohl (sw_if_index);
-  S (mp);
-
-  /* Use a control ping for synchronization */
-  MPING (CONTROL_PING, mp_ping);
-  S (mp_ping);
-
-  W (ret);
-  return ret;
 }
 
-static void vl_api_sw_member_interface_details_t_handler
-  (vl_api_sw_member_interface_details_t * mp)
+static void vl_api_get_node_graph_reply_t_handler_json
+  (vl_api_get_node_graph_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
+  void *oldheap;
+  vat_json_node_t node;
+  u8 *reply;
 
-  print (vam->ofp,
-        "%-25s %-12d %-7d %-12d %-10d %-10d", mp->interface_name,
-        ntohl (mp->sw_if_index), mp->is_passive, mp->is_long_timeout,
-        ntohl (mp->weight), mp->is_local_numa);
-}
+  /* $$$$ make this real? */
+  vat_json_init_object (&node);
+  vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
+  vat_json_object_add_uint (&node, "reply_in_shmem", mp->reply_in_shmem);
 
-static void vl_api_sw_member_interface_details_t_handler_json
-  (vl_api_sw_member_interface_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t *node = NULL;
-
-  if (VAT_JSON_ARRAY != vam->json_tree.type)
-    {
-      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
-      vat_json_init_array (&vam->json_tree);
-    }
-  node = vat_json_array_add (&vam->json_tree);
-
-  vat_json_init_object (node);
-  vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
-  vat_json_object_add_string_copy (node, "interface_name",
-                                  mp->interface_name);
-  vat_json_object_add_uint (node, "passive", mp->is_passive);
-  vat_json_object_add_uint (node, "long_timeout", mp->is_long_timeout);
-  vat_json_object_add_uint (node, "weight", ntohl (mp->weight));
-  vat_json_object_add_uint (node, "is_local_numa", mp->is_local_numa);
-}
-
-static int
-api_sw_member_interface_dump (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_sw_member_interface_dump_t *mp;
-  vl_api_control_ping_t *mp_ping;
-  u32 sw_if_index = ~0;
-  u8 sw_if_index_set = 0;
-  int ret;
-
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else
-       break;
-    }
-
-  if (sw_if_index_set == 0)
-    {
-      errmsg ("missing vpp interface name. ");
-      return -99;
-    }
-
-  print (vam->ofp,
-        "\n%-25s %-12s %-7s %-12s %-10s %-10s",
-        "member interface name", "sw_if_index", "passive", "long_timeout",
-        "weight", "local numa");
-
-  /* Get list of bond interfaces */
-  M (SW_MEMBER_INTERFACE_DUMP, mp);
-  mp->sw_if_index = ntohl (sw_if_index);
-  S (mp);
-
-  /* Use a control ping for synchronization */
-  MPING (CONTROL_PING, mp_ping);
-  S (mp_ping);
-
-  W (ret);
-  return ret;
-}
+  reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
 
-static void vl_api_mpls_tunnel_add_del_reply_t_handler
-  (vl_api_mpls_tunnel_add_del_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  i32 retval = ntohl (mp->retval);
-  if (vam->async_mode)
-    {
-      vam->async_errors += (retval < 0);
-    }
-  else
-    {
-      vam->retval = retval;
-      vam->sw_if_index = ntohl (mp->sw_if_index);
-      vam->result_ready = 1;
-    }
-  vam->regenerate_interface_table = 1;
-}
+  /* Toss the shared-memory original... */
+  oldheap = vl_msg_push_heap ();
 
-static void vl_api_mpls_tunnel_add_del_reply_t_handler_json
-  (vl_api_mpls_tunnel_add_del_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t node;
+  vec_free (reply);
 
-  vat_json_init_object (&node);
-  vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
-  vat_json_object_add_uint (&node, "tunnel_sw_if_index",
-                           ntohl (mp->sw_if_index));
+  vl_msg_pop_heap (oldheap);
 
   vat_json_print (vam->ofp, &node);
   vat_json_free (&node);
@@ -2108,426 +1996,132 @@ static void vl_api_mpls_tunnel_add_del_reply_t_handler_json
   vam->result_ready = 1;
 }
 
-static void vl_api_create_vhost_user_if_reply_t_handler
-  (vl_api_create_vhost_user_if_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  i32 retval = ntohl (mp->retval);
-  if (vam->async_mode)
-    {
-      vam->async_errors += (retval < 0);
-    }
-  else
-    {
-      vam->retval = retval;
-      vam->sw_if_index = ntohl (mp->sw_if_index);
-      vam->result_ready = 1;
-    }
-  vam->regenerate_interface_table = 1;
-}
-
-static void vl_api_create_vhost_user_if_reply_t_handler_json
-  (vl_api_create_vhost_user_if_reply_t * mp)
+/* Format hex dump. */
+u8 *
+format_hex_bytes (u8 * s, va_list * va)
 {
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t node;
-
-  vat_json_init_object (&node);
-  vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
-  vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index));
+  u8 *bytes = va_arg (*va, u8 *);
+  int n_bytes = va_arg (*va, int);
+  uword i;
 
-  vat_json_print (vam->ofp, &node);
-  vat_json_free (&node);
+  /* Print short or long form depending on byte count. */
+  uword short_form = n_bytes <= 32;
+  u32 indent = format_get_indent (s);
 
-  vam->retval = ntohl (mp->retval);
-  vam->result_ready = 1;
-}
+  if (n_bytes == 0)
+    return s;
 
-static void vl_api_create_vhost_user_if_v2_reply_t_handler
-  (vl_api_create_vhost_user_if_v2_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  i32 retval = ntohl (mp->retval);
-  if (vam->async_mode)
-    {
-      vam->async_errors += (retval < 0);
-    }
-  else
+  for (i = 0; i < n_bytes; i++)
     {
-      vam->retval = retval;
-      vam->sw_if_index = ntohl (mp->sw_if_index);
-      vam->result_ready = 1;
+      if (!short_form && (i % 32) == 0)
+       s = format (s, "%08x: ", i);
+      s = format (s, "%02x", bytes[i]);
+      if (!short_form && ((i + 1) % 32) == 0 && (i + 1) < n_bytes)
+       s = format (s, "\n%U", format_white_space, indent);
     }
-  vam->regenerate_interface_table = 1;
-}
-
-static void vl_api_create_vhost_user_if_v2_reply_t_handler_json
-  (vl_api_create_vhost_user_if_v2_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t node;
-
-  vat_json_init_object (&node);
-  vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
-  vat_json_object_add_uint (&node, "sw_if_index", ntohl (mp->sw_if_index));
-
-  vat_json_print (vam->ofp, &node);
-  vat_json_free (&node);
 
-  vam->retval = ntohl (mp->retval);
-  vam->result_ready = 1;
+  return s;
 }
 
-static void vl_api_ip_address_details_t_handler
-  (vl_api_ip_address_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  static ip_address_details_t empty_ip_address_details = { {0} };
-  ip_address_details_t *address = NULL;
-  ip_details_t *current_ip_details = NULL;
-  ip_details_t *details = NULL;
+/*
+ * Generate boilerplate reply handlers, which
+ * dig the return value out of the xxx_reply_t API message,
+ * stick it into vam->retval, and set vam->result_ready
+ *
+ * Could also do this by pointing N message decode slots at
+ * a single function, but that could break in subtle ways.
+ */
 
-  details = vam->ip_details_by_sw_if_index[vam->is_ipv6];
+#define foreach_standard_reply_retval_handler           \
+_(sw_interface_set_flags_reply)                         \
+_(sw_interface_add_del_address_reply)                   \
+_(sw_interface_set_rx_mode_reply)                       \
+_(sw_interface_set_rx_placement_reply)                  \
+_(sw_interface_set_table_reply)                         \
+_(sw_interface_set_mpls_enable_reply)                   \
+_(sw_interface_set_vpath_reply)                         \
+_(sw_interface_set_l2_bridge_reply)                     \
+_(bridge_domain_add_del_reply)                          \
+_(sw_interface_set_l2_xconnect_reply)                   \
+_(l2fib_add_del_reply)                                  \
+_(l2fib_flush_int_reply)                                \
+_(l2fib_flush_bd_reply)                                 \
+_(ip_route_add_del_reply)                               \
+_(ip_table_add_del_reply)                               \
+_(ip_table_replace_begin_reply)                         \
+_(ip_table_flush_reply)                                 \
+_(ip_table_replace_end_reply)                           \
+_(ip_mroute_add_del_reply)                              \
+_(mpls_route_add_del_reply)                             \
+_(mpls_table_add_del_reply)                             \
+_(mpls_ip_bind_unbind_reply)                            \
+_(sw_interface_set_unnumbered_reply)                    \
+_(set_ip_flow_hash_reply)                               \
+_(sw_interface_ip6_enable_disable_reply)                \
+_(l2_patch_add_del_reply)                               \
+_(l2_fib_clear_table_reply)                             \
+_(l2_interface_efp_filter_reply)                        \
+_(l2_interface_vlan_tag_rewrite_reply)                  \
+_(modify_vhost_user_if_reply)                           \
+_(modify_vhost_user_if_v2_reply)                        \
+_(delete_vhost_user_if_reply)                           \
+_(want_l2_macs_events_reply)                            \
+_(delete_loopback_reply)                                \
+_(bd_ip_mac_add_del_reply)                              \
+_(bd_ip_mac_flush_reply)                                \
+_(want_interface_events_reply)                          \
+_(sw_interface_clear_stats_reply)                       \
+_(ioam_enable_reply)                                    \
+_(ioam_disable_reply)                                   \
+_(af_packet_delete_reply)                               \
+_(sw_interface_span_enable_disable_reply)               \
+_(ip_source_and_port_range_check_add_del_reply)         \
+_(ip_source_and_port_range_check_interface_add_del_reply)\
+_(delete_subif_reply)                                   \
+_(l2_interface_pbb_tag_rewrite_reply)                   \
+_(set_punt_reply)                                       \
+_(sw_interface_tag_add_del_reply)                      \
+_(sw_interface_add_del_mac_address_reply)              \
+_(hw_interface_set_mtu_reply)                           \
+_(tcp_configure_src_addresses_reply)                   \
+_(session_rule_add_del_reply)                          \
+_(ip_container_proxy_add_del_reply)                     \
+_(qos_record_enable_disable_reply)                     \
 
-  if (!details || vam->current_sw_if_index >= vec_len (details)
-      || !details[vam->current_sw_if_index].present)
-    {
-      errmsg ("ip address details arrived but not stored");
-      errmsg ("ip_dump should be called first");
-      return;
+#define _(n)                                    \
+    static void vl_api_##n##_t_handler          \
+    (vl_api_##n##_t * mp)                       \
+    {                                           \
+        vat_main_t * vam = &vat_main;           \
+        i32 retval = ntohl(mp->retval);         \
+        if (vam->async_mode) {                  \
+            vam->async_errors += (retval < 0);  \
+        } else {                                \
+            vam->retval = retval;               \
+            vam->result_ready = 1;              \
+        }                                       \
     }
+foreach_standard_reply_retval_handler;
+#undef _
 
-  current_ip_details = vec_elt_at_index (details, vam->current_sw_if_index);
-
-#define addresses (current_ip_details->addr)
-
-  vec_validate_init_empty (addresses, vec_len (addresses),
-                          empty_ip_address_details);
-
-  address = vec_elt_at_index (addresses, vec_len (addresses) - 1);
-
-  clib_memcpy (&address->ip, &mp->prefix.address.un, sizeof (address->ip));
-  address->prefix_length = mp->prefix.len;
-#undef addresses
-}
-
-static void vl_api_ip_address_details_t_handler_json
-  (vl_api_ip_address_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t *node = NULL;
-
-  if (VAT_JSON_ARRAY != vam->json_tree.type)
-    {
-      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
-      vat_json_init_array (&vam->json_tree);
-    }
-  node = vat_json_array_add (&vam->json_tree);
-
-  vat_json_init_object (node);
-  vat_json_object_add_prefix (node, &mp->prefix);
-}
-
-static void
-vl_api_ip_details_t_handler (vl_api_ip_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  static ip_details_t empty_ip_details = { 0 };
-  ip_details_t *ip = NULL;
-  u32 sw_if_index = ~0;
-
-  sw_if_index = ntohl (mp->sw_if_index);
-
-  vec_validate_init_empty (vam->ip_details_by_sw_if_index[vam->is_ipv6],
-                          sw_if_index, empty_ip_details);
-
-  ip = vec_elt_at_index (vam->ip_details_by_sw_if_index[vam->is_ipv6],
-                        sw_if_index);
-
-  ip->present = 1;
-}
-
-static void
-vl_api_ip_details_t_handler_json (vl_api_ip_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-
-  if (VAT_JSON_ARRAY != vam->json_tree.type)
-    {
-      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
-      vat_json_init_array (&vam->json_tree);
-    }
-  vat_json_array_add_uint (&vam->json_tree,
-                          clib_net_to_host_u32 (mp->sw_if_index));
-}
-
-static void vl_api_get_first_msg_id_reply_t_handler
-  (vl_api_get_first_msg_id_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  i32 retval = ntohl (mp->retval);
-
-  if (vam->async_mode)
-    {
-      vam->async_errors += (retval < 0);
-    }
-  else
-    {
-      vam->retval = retval;
-      vam->result_ready = 1;
-    }
-  if (retval >= 0)
-    {
-      errmsg ("first message id %d", ntohs (mp->first_msg_id));
-    }
-}
-
-static void vl_api_get_first_msg_id_reply_t_handler_json
-  (vl_api_get_first_msg_id_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t node;
-
-  vat_json_init_object (&node);
-  vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
-  vat_json_object_add_uint (&node, "first_msg_id",
-                           (uint) ntohs (mp->first_msg_id));
-
-  vat_json_print (vam->ofp, &node);
-  vat_json_free (&node);
-
-  vam->retval = ntohl (mp->retval);
-  vam->result_ready = 1;
-}
-
-static void vl_api_get_node_graph_reply_t_handler
-  (vl_api_get_node_graph_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  i32 retval = ntohl (mp->retval);
-  u8 *pvt_copy, *reply;
-  void *oldheap;
-  vlib_node_t *node;
-  int i;
-
-  if (vam->async_mode)
-    {
-      vam->async_errors += (retval < 0);
-    }
-  else
-    {
-      vam->retval = retval;
-      vam->result_ready = 1;
-    }
-
-  /* "Should never happen..." */
-  if (retval != 0)
-    return;
-
-  reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
-  pvt_copy = vec_dup (reply);
-
-  /* Toss the shared-memory original... */
-  oldheap = vl_msg_push_heap ();
-
-  vec_free (reply);
-
-  vl_msg_pop_heap (oldheap);
-
-  if (vam->graph_nodes)
-    {
-      hash_free (vam->graph_node_index_by_name);
-
-      for (i = 0; i < vec_len (vam->graph_nodes[0]); i++)
-       {
-         node = vam->graph_nodes[0][i];
-         vec_free (node->name);
-         vec_free (node->next_nodes);
-         vec_free (node);
-       }
-      vec_free (vam->graph_nodes[0]);
-      vec_free (vam->graph_nodes);
-    }
-
-  vam->graph_node_index_by_name = hash_create_string (0, sizeof (uword));
-  vam->graph_nodes = vlib_node_unserialize (pvt_copy);
-  vec_free (pvt_copy);
-
-  for (i = 0; i < vec_len (vam->graph_nodes[0]); i++)
-    {
-      node = vam->graph_nodes[0][i];
-      hash_set_mem (vam->graph_node_index_by_name, node->name, i);
-    }
-}
-
-static void vl_api_get_node_graph_reply_t_handler_json
-  (vl_api_get_node_graph_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  void *oldheap;
-  vat_json_node_t node;
-  u8 *reply;
-
-  /* $$$$ make this real? */
-  vat_json_init_object (&node);
-  vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
-  vat_json_object_add_uint (&node, "reply_in_shmem", mp->reply_in_shmem);
-
-  reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
-
-  /* Toss the shared-memory original... */
-  oldheap = vl_msg_push_heap ();
-
-  vec_free (reply);
-
-  vl_msg_pop_heap (oldheap);
-
-  vat_json_print (vam->ofp, &node);
-  vat_json_free (&node);
-
-  vam->retval = ntohl (mp->retval);
-  vam->result_ready = 1;
-}
-
-/* Format hex dump. */
-u8 *
-format_hex_bytes (u8 * s, va_list * va)
-{
-  u8 *bytes = va_arg (*va, u8 *);
-  int n_bytes = va_arg (*va, int);
-  uword i;
-
-  /* Print short or long form depending on byte count. */
-  uword short_form = n_bytes <= 32;
-  u32 indent = format_get_indent (s);
-
-  if (n_bytes == 0)
-    return s;
-
-  for (i = 0; i < n_bytes; i++)
-    {
-      if (!short_form && (i % 32) == 0)
-       s = format (s, "%08x: ", i);
-      s = format (s, "%02x", bytes[i]);
-      if (!short_form && ((i + 1) % 32) == 0 && (i + 1) < n_bytes)
-       s = format (s, "\n%U", format_white_space, indent);
+#define _(n)                                    \
+    static void vl_api_##n##_t_handler_json     \
+    (vl_api_##n##_t * mp)                       \
+    {                                           \
+        vat_main_t * vam = &vat_main;           \
+        vat_json_node_t node;                   \
+        vat_json_init_object(&node);            \
+        vat_json_object_add_int(&node, "retval", ntohl(mp->retval));    \
+        vat_json_print(vam->ofp, &node);        \
+        vam->retval = ntohl(mp->retval);        \
+        vam->result_ready = 1;                  \
     }
-
-  return s;
-}
+foreach_standard_reply_retval_handler;
+#undef _
 
 /*
- * Generate boilerplate reply handlers, which
- * dig the return value out of the xxx_reply_t API message,
- * stick it into vam->retval, and set vam->result_ready
- *
- * Could also do this by pointing N message decode slots at
- * a single function, but that could break in subtle ways.
- */
-
-#define foreach_standard_reply_retval_handler           \
-_(sw_interface_set_flags_reply)                         \
-_(sw_interface_add_del_address_reply)                   \
-_(sw_interface_set_rx_mode_reply)                       \
-_(sw_interface_set_rx_placement_reply)                  \
-_(sw_interface_set_table_reply)                         \
-_(sw_interface_set_mpls_enable_reply)                   \
-_(sw_interface_set_vpath_reply)                         \
-_(sw_interface_set_l2_bridge_reply)                     \
-_(sw_interface_set_bond_weight_reply)                   \
-_(bridge_domain_add_del_reply)                          \
-_(sw_interface_set_l2_xconnect_reply)                   \
-_(l2fib_add_del_reply)                                  \
-_(l2fib_flush_int_reply)                                \
-_(l2fib_flush_bd_reply)                                 \
-_(ip_route_add_del_reply)                               \
-_(ip_table_add_del_reply)                               \
-_(ip_table_replace_begin_reply)                         \
-_(ip_table_flush_reply)                                 \
-_(ip_table_replace_end_reply)                           \
-_(ip_mroute_add_del_reply)                              \
-_(mpls_route_add_del_reply)                             \
-_(mpls_table_add_del_reply)                             \
-_(mpls_ip_bind_unbind_reply)                            \
-_(sw_interface_set_unnumbered_reply)                    \
-_(set_ip_flow_hash_reply)                               \
-_(sw_interface_ip6_enable_disable_reply)                \
-_(l2_patch_add_del_reply)                               \
-_(sr_mpls_policy_add_reply)                             \
-_(sr_mpls_policy_mod_reply)                             \
-_(sr_mpls_policy_del_reply)                             \
-_(sr_policy_add_reply)                                  \
-_(sr_policy_mod_reply)                                  \
-_(sr_policy_del_reply)                                  \
-_(sr_localsid_add_del_reply)                            \
-_(sr_steering_add_del_reply)                            \
-_(l2_fib_clear_table_reply)                             \
-_(l2_interface_efp_filter_reply)                        \
-_(l2_interface_vlan_tag_rewrite_reply)                  \
-_(modify_vhost_user_if_reply)                           \
-_(modify_vhost_user_if_v2_reply)                        \
-_(delete_vhost_user_if_reply)                           \
-_(want_l2_macs_events_reply)                            \
-_(ipsec_spd_add_del_reply)                              \
-_(ipsec_interface_add_del_spd_reply)                    \
-_(ipsec_spd_entry_add_del_reply)                        \
-_(ipsec_sad_entry_add_del_reply)                        \
-_(delete_loopback_reply)                                \
-_(bd_ip_mac_add_del_reply)                              \
-_(bd_ip_mac_flush_reply)                                \
-_(want_interface_events_reply)                          \
-_(sw_interface_clear_stats_reply)                       \
-_(ioam_enable_reply)                                    \
-_(ioam_disable_reply)                                   \
-_(af_packet_delete_reply)                               \
-_(sw_interface_span_enable_disable_reply)               \
-_(ip_source_and_port_range_check_add_del_reply)         \
-_(ip_source_and_port_range_check_interface_add_del_reply)\
-_(delete_subif_reply)                                   \
-_(l2_interface_pbb_tag_rewrite_reply)                   \
-_(set_punt_reply)                                       \
-_(sw_interface_tag_add_del_reply)                      \
-_(sw_interface_add_del_mac_address_reply)              \
-_(hw_interface_set_mtu_reply)                           \
-_(tcp_configure_src_addresses_reply)                   \
-_(session_rule_add_del_reply)                          \
-_(ip_container_proxy_add_del_reply)                     \
-_(qos_record_enable_disable_reply)                     \
-
-#define _(n)                                    \
-    static void vl_api_##n##_t_handler          \
-    (vl_api_##n##_t * mp)                       \
-    {                                           \
-        vat_main_t * vam = &vat_main;           \
-        i32 retval = ntohl(mp->retval);         \
-        if (vam->async_mode) {                  \
-            vam->async_errors += (retval < 0);  \
-        } else {                                \
-            vam->retval = retval;               \
-            vam->result_ready = 1;              \
-        }                                       \
-    }
-foreach_standard_reply_retval_handler;
-#undef _
-
-#define _(n)                                    \
-    static void vl_api_##n##_t_handler_json     \
-    (vl_api_##n##_t * mp)                       \
-    {                                           \
-        vat_main_t * vam = &vat_main;           \
-        vat_json_node_t node;                   \
-        vat_json_init_object(&node);            \
-        vat_json_object_add_int(&node, "retval", ntohl(mp->retval));    \
-        vat_json_print(vam->ofp, &node);        \
-        vam->retval = ntohl(mp->retval);        \
-        vam->result_ready = 1;                  \
-    }
-foreach_standard_reply_retval_handler;
-#undef _
-
-/*
- * Table of message reply handlers, must include boilerplate handlers
- * we just generated
+ * Table of message reply handlers, must include boilerplate handlers
+ * we just generated
  */
 
 #define foreach_vpe_api_reply_msg                                       \
@@ -2565,14 +2159,6 @@ _(VIRTIO_PCI_CREATE_REPLY, virtio_pci_create_reply)                      \
 _(VIRTIO_PCI_CREATE_V2_REPLY, virtio_pci_create_v2_reply)              \
 _(VIRTIO_PCI_DELETE_REPLY, virtio_pci_delete_reply)                    \
 _(SW_INTERFACE_VIRTIO_PCI_DETAILS, sw_interface_virtio_pci_details)     \
-_(BOND_CREATE_REPLY, bond_create_reply)                                        \
-_(BOND_CREATE2_REPLY, bond_create2_reply)                              \
-_(BOND_DELETE_REPLY, bond_delete_reply)                                        \
-_(BOND_ADD_MEMBER_REPLY, bond_add_member_reply)                                \
-_(BOND_DETACH_MEMBER_REPLY, bond_detach_member_reply)                  \
-_(SW_INTERFACE_SET_BOND_WEIGHT_REPLY, sw_interface_set_bond_weight_reply) \
-_(SW_BOND_INTERFACE_DETAILS, sw_bond_interface_details)                 \
-_(SW_MEMBER_INTERFACE_DETAILS, sw_member_interface_details)               \
 _(IP_ROUTE_ADD_DEL_REPLY, ip_route_add_del_reply)                      \
 _(IP_TABLE_ADD_DEL_REPLY, ip_table_add_del_reply)                      \
 _(IP_TABLE_REPLACE_BEGIN_REPLY, ip_table_replace_begin_reply)           \
@@ -2591,14 +2177,6 @@ _(SET_IP_FLOW_HASH_REPLY, set_ip_flow_hash_reply)                       \
 _(SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY,                                \
   sw_interface_ip6_enable_disable_reply)                                \
 _(L2_PATCH_ADD_DEL_REPLY, l2_patch_add_del_reply)                       \
-_(SR_MPLS_POLICY_ADD_REPLY, sr_mpls_policy_add_reply)                   \
-_(SR_MPLS_POLICY_MOD_REPLY, sr_mpls_policy_mod_reply)                   \
-_(SR_MPLS_POLICY_DEL_REPLY, sr_mpls_policy_del_reply)                   \
-_(SR_POLICY_ADD_REPLY, sr_policy_add_reply)                             \
-_(SR_POLICY_MOD_REPLY, sr_policy_mod_reply)                             \
-_(SR_POLICY_DEL_REPLY, sr_policy_del_reply)                             \
-_(SR_LOCALSID_ADD_DEL_REPLY, sr_localsid_add_del_reply)                 \
-_(SR_STEERING_ADD_DEL_REPLY, sr_steering_add_del_reply)                 \
 _(GET_NODE_INDEX_REPLY, get_node_index_reply)                           \
 _(ADD_NODE_NEXT_REPLY, add_node_next_reply)                             \
 _(L2_FIB_CLEAR_TABLE_REPLY, l2_fib_clear_table_reply)                   \
@@ -2618,11 +2196,6 @@ _(WANT_L2_MACS_EVENTS_REPLY, want_l2_macs_events_reply)                  \
 _(L2_MACS_EVENT, l2_macs_event)                                                \
 _(IP_ADDRESS_DETAILS, ip_address_details)                               \
 _(IP_DETAILS, ip_details)                                               \
-_(IPSEC_SPD_ADD_DEL_REPLY, ipsec_spd_add_del_reply)                     \
-_(IPSEC_INTERFACE_ADD_DEL_SPD_REPLY, ipsec_interface_add_del_spd_reply) \
-_(IPSEC_SPD_ENTRY_ADD_DEL_REPLY, ipsec_spd_entry_add_del_reply)         \
-_(IPSEC_SAD_ENTRY_ADD_DEL_REPLY, ipsec_sad_entry_add_del_reply)         \
-_(IPSEC_SA_DETAILS, ipsec_sa_details)                                   \
 _(DELETE_LOOPBACK_REPLY, delete_loopback_reply)                         \
 _(BD_IP_MAC_ADD_DEL_REPLY, bd_ip_mac_add_del_reply)                     \
 _(BD_IP_MAC_FLUSH_REPLY, bd_ip_mac_flush_reply)                         \
@@ -2663,916 +2236,415 @@ _(SESSION_RULES_DETAILS, session_rules_details)                               \
 _(IP_CONTAINER_PROXY_ADD_DEL_REPLY, ip_container_proxy_add_del_reply)  \
 _(QOS_RECORD_ENABLE_DISABLE_REPLY, qos_record_enable_disable_reply)            \
 
-#define foreach_standalone_reply_msg                                   \
-_(SW_INTERFACE_EVENT, sw_interface_event)
-
-typedef struct
-{
-  u8 *name;
-  u32 value;
-} name_sort_t;
-
-#define STR_VTR_OP_CASE(op)     \
-    case L2_VTR_ ## op:         \
-        return "" # op;
-
-static const char *
-str_vtr_op (u32 vtr_op)
-{
-  switch (vtr_op)
-    {
-      STR_VTR_OP_CASE (DISABLED);
-      STR_VTR_OP_CASE (PUSH_1);
-      STR_VTR_OP_CASE (PUSH_2);
-      STR_VTR_OP_CASE (POP_1);
-      STR_VTR_OP_CASE (POP_2);
-      STR_VTR_OP_CASE (TRANSLATE_1_1);
-      STR_VTR_OP_CASE (TRANSLATE_1_2);
-      STR_VTR_OP_CASE (TRANSLATE_2_1);
-      STR_VTR_OP_CASE (TRANSLATE_2_2);
-    }
-
-  return "UNKNOWN";
-}
-
-static int
-dump_sub_interface_table (vat_main_t * vam)
-{
-  const sw_interface_subif_t *sub = NULL;
-
-  if (vam->json_output)
-    {
-      clib_warning
-       ("JSON output supported only for VPE API calls and dump_stats_table");
-      return -99;
-    }
-
-  print (vam->ofp,
-        "%-30s%-12s%-11s%-7s%-5s%-9s%-9s%-6s%-8s%-10s%-10s",
-        "Interface", "sw_if_index",
-        "sub id", "dot1ad", "tags", "outer id",
-        "inner id", "exact", "default", "outer any", "inner any");
-
-  vec_foreach (sub, vam->sw_if_subif_table)
-  {
-    print (vam->ofp,
-          "%-30s%-12d%-11d%-7s%-5d%-9d%-9d%-6d%-8d%-10d%-10d",
-          sub->interface_name,
-          sub->sw_if_index,
-          sub->sub_id, sub->sub_dot1ad ? "dot1ad" : "dot1q",
-          sub->sub_number_of_tags, sub->sub_outer_vlan_id,
-          sub->sub_inner_vlan_id, sub->sub_exact_match, sub->sub_default,
-          sub->sub_outer_vlan_id_any, sub->sub_inner_vlan_id_any);
-    if (sub->vtr_op != L2_VTR_DISABLED)
-      {
-       print (vam->ofp,
-              "  vlan-tag-rewrite - op: %-14s [ dot1q: %d "
-              "tag1: %d tag2: %d ]",
-              str_vtr_op (sub->vtr_op), sub->vtr_push_dot1q,
-              sub->vtr_tag1, sub->vtr_tag2);
-      }
-  }
-
-  return 0;
-}
-
-static int
-name_sort_cmp (void *a1, void *a2)
-{
-  name_sort_t *n1 = a1;
-  name_sort_t *n2 = a2;
-
-  return strcmp ((char *) n1->name, (char *) n2->name);
-}
-
-static int
-dump_interface_table (vat_main_t * vam)
-{
-  hash_pair_t *p;
-  name_sort_t *nses = 0, *ns;
-
-  if (vam->json_output)
-    {
-      clib_warning
-       ("JSON output supported only for VPE API calls and dump_stats_table");
-      return -99;
-    }
-
-  /* *INDENT-OFF* */
-  hash_foreach_pair (p, vam->sw_if_index_by_interface_name,
-  ({
-    vec_add2 (nses, ns, 1);
-    ns->name = (u8 *)(p->key);
-    ns->value = (u32) p->value[0];
-  }));
-  /* *INDENT-ON* */
-
-  vec_sort_with_function (nses, name_sort_cmp);
-
-  print (vam->ofp, "%-25s%-15s", "Interface", "sw_if_index");
-  vec_foreach (ns, nses)
-  {
-    print (vam->ofp, "%-25s%-15d", ns->name, ns->value);
-  }
-  vec_free (nses);
-  return 0;
-}
-
-static int
-dump_ip_table (vat_main_t * vam, int is_ipv6)
-{
-  const ip_details_t *det = NULL;
-  const ip_address_details_t *address = NULL;
-  u32 i = ~0;
-
-  print (vam->ofp, "%-12s", "sw_if_index");
-
-  vec_foreach (det, vam->ip_details_by_sw_if_index[is_ipv6])
-  {
-    i++;
-    if (!det->present)
-      {
-       continue;
-      }
-    print (vam->ofp, "%-12d", i);
-    print (vam->ofp, "            %-30s%-13s", "Address", "Prefix length");
-    if (!det->addr)
-      {
-       continue;
-      }
-    vec_foreach (address, det->addr)
-    {
-      print (vam->ofp,
-            "            %-30U%-13d",
-            is_ipv6 ? format_ip6_address : format_ip4_address,
-            address->ip, address->prefix_length);
-    }
-  }
-
-  return 0;
-}
-
-static int
-dump_ipv4_table (vat_main_t * vam)
-{
-  if (vam->json_output)
-    {
-      clib_warning
-       ("JSON output supported only for VPE API calls and dump_stats_table");
-      return -99;
-    }
-
-  return dump_ip_table (vam, 0);
-}
-
-static int
-dump_ipv6_table (vat_main_t * vam)
-{
-  if (vam->json_output)
-    {
-      clib_warning
-       ("JSON output supported only for VPE API calls and dump_stats_table");
-      return -99;
-    }
-
-  return dump_ip_table (vam, 1);
-}
-
-/*
- * Pass CLI buffers directly in the CLI_INBAND API message,
- * instead of an additional shared memory area.
- */
-static int
-exec_inband (vat_main_t * vam)
-{
-  vl_api_cli_inband_t *mp;
-  unformat_input_t *i = vam->input;
-  int ret;
-
-  if (vec_len (i->buffer) == 0)
-    return -1;
-
-  if (vam->exec_mode == 0 && unformat (i, "mode"))
-    {
-      vam->exec_mode = 1;
-      return 0;
-    }
-  if (vam->exec_mode == 1 && (unformat (i, "exit") || unformat (i, "quit")))
-    {
-      vam->exec_mode = 0;
-      return 0;
-    }
-
-  /*
-   * In order for the CLI command to work, it
-   * must be a vector ending in \n, not a C-string ending
-   * in \n\0.
-   */
-  M2 (CLI_INBAND, mp, vec_len (vam->input->buffer));
-  vl_api_vec_to_api_string (vam->input->buffer, &mp->cmd);
-
-  S (mp);
-  W (ret);
-  /* json responses may or may not include a useful reply... */
-  if (vec_len (vam->cmd_reply))
-    print (vam->ofp, "%v", (char *) (vam->cmd_reply));
-  return ret;
-}
-
-int
-exec (vat_main_t * vam)
-{
-  return exec_inband (vam);
-}
-
-static int
-api_create_loopback (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_create_loopback_t *mp;
-  vl_api_create_loopback_instance_t *mp_lbi;
-  u8 mac_address[6];
-  u8 mac_set = 0;
-  u8 is_specified = 0;
-  u32 user_instance = 0;
-  int ret;
-
-  clib_memset (mac_address, 0, sizeof (mac_address));
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "mac %U", unformat_ethernet_address, mac_address))
-       mac_set = 1;
-      if (unformat (i, "instance %d", &user_instance))
-       is_specified = 1;
-      else
-       break;
-    }
-
-  if (is_specified)
-    {
-      M (CREATE_LOOPBACK_INSTANCE, mp_lbi);
-      mp_lbi->is_specified = is_specified;
-      if (is_specified)
-       mp_lbi->user_instance = htonl (user_instance);
-      if (mac_set)
-       clib_memcpy (mp_lbi->mac_address, mac_address, sizeof (mac_address));
-      S (mp_lbi);
-    }
-  else
-    {
-      /* Construct the API message */
-      M (CREATE_LOOPBACK, mp);
-      if (mac_set)
-       clib_memcpy (mp->mac_address, mac_address, sizeof (mac_address));
-      S (mp);
-    }
-
-  W (ret);
-  return ret;
-}
-
-static int
-api_delete_loopback (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_delete_loopback_t *mp;
-  u32 sw_if_index = ~0;
-  int ret;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "sw_if_index %d", &sw_if_index))
-       ;
-      else
-       break;
-    }
-
-  if (sw_if_index == ~0)
-    {
-      errmsg ("missing sw_if_index");
-      return -99;
-    }
-
-  /* Construct the API message */
-  M (DELETE_LOOPBACK, mp);
-  mp->sw_if_index = ntohl (sw_if_index);
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_want_interface_events (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_want_interface_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_INTERFACE_EVENTS, mp);
-  mp->enable_disable = enable;
-
-  vam->interface_event_display = enable;
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-
-/* Note: non-static, called once to set up the initial intfc table */
-int
-api_sw_interface_dump (vat_main_t * vam)
-{
-  vl_api_sw_interface_dump_t *mp;
-  vl_api_control_ping_t *mp_ping;
-  hash_pair_t *p;
-  name_sort_t *nses = 0, *ns;
-  sw_interface_subif_t *sub = NULL;
-  int ret;
-
-  /* Toss the old name table */
-  /* *INDENT-OFF* */
-  hash_foreach_pair (p, vam->sw_if_index_by_interface_name,
-  ({
-    vec_add2 (nses, ns, 1);
-    ns->name = (u8 *)(p->key);
-    ns->value = (u32) p->value[0];
-  }));
-  /* *INDENT-ON* */
-
-  hash_free (vam->sw_if_index_by_interface_name);
-
-  vec_foreach (ns, nses) vec_free (ns->name);
-
-  vec_free (nses);
-
-  vec_foreach (sub, vam->sw_if_subif_table)
-  {
-    vec_free (sub->interface_name);
-  }
-  vec_free (vam->sw_if_subif_table);
-
-  /* recreate the interface name hash table */
-  vam->sw_if_index_by_interface_name = hash_create_string (0, sizeof (uword));
-
-  /*
-   * Ask for all interface names. Otherwise, the epic catalog of
-   * name filters becomes ridiculously long, and vat ends up needing
-   * to be taught about new interface types.
-   */
-  M (SW_INTERFACE_DUMP, mp);
-  S (mp);
-
-  /* Use a control ping for synchronization */
-  MPING (CONTROL_PING, mp_ping);
-  S (mp_ping);
-
-  W (ret);
-  return ret;
-}
-
-static int
-api_sw_interface_set_flags (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_sw_interface_set_flags_t *mp;
-  u32 sw_if_index;
-  u8 sw_if_index_set = 0;
-  u8 admin_up = 0;
-  int ret;
-
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "admin-up"))
-       admin_up = 1;
-      else if (unformat (i, "admin-down"))
-       admin_up = 0;
-      else
-       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else
-       break;
-    }
-
-  if (sw_if_index_set == 0)
-    {
-      errmsg ("missing interface name or sw_if_index");
-      return -99;
-    }
-
-  /* Construct the API message */
-  M (SW_INTERFACE_SET_FLAGS, mp);
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->flags = ntohl ((admin_up) ? IF_STATUS_API_FLAG_ADMIN_UP : 0);
-
-  /* send it... */
-  S (mp);
-
-  /* Wait for a reply, return the good/bad news... */
-  W (ret);
-  return ret;
-}
+#define foreach_standalone_reply_msg                                   \
+_(SW_INTERFACE_EVENT, sw_interface_event)
 
-static int
-api_sw_interface_set_rx_mode (vat_main_t * vam)
+typedef struct
 {
-  unformat_input_t *i = vam->input;
-  vl_api_sw_interface_set_rx_mode_t *mp;
-  u32 sw_if_index;
-  u8 sw_if_index_set = 0;
-  int ret;
-  u8 queue_id_valid = 0;
-  u32 queue_id;
-  vnet_hw_if_rx_mode mode = VNET_HW_IF_RX_MODE_UNKNOWN;
+  u8 *name;
+  u32 value;
+} name_sort_t;
 
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "queue %d", &queue_id))
-       queue_id_valid = 1;
-      else if (unformat (i, "polling"))
-       mode = VNET_HW_IF_RX_MODE_POLLING;
-      else if (unformat (i, "interrupt"))
-       mode = VNET_HW_IF_RX_MODE_INTERRUPT;
-      else if (unformat (i, "adaptive"))
-       mode = VNET_HW_IF_RX_MODE_ADAPTIVE;
-      else
-       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else
-       break;
-    }
+#define STR_VTR_OP_CASE(op)     \
+    case L2_VTR_ ## op:         \
+        return "" # op;
 
-  if (sw_if_index_set == 0)
-    {
-      errmsg ("missing interface name or sw_if_index");
-      return -99;
-    }
-  if (mode == VNET_HW_IF_RX_MODE_UNKNOWN)
+static const char *
+str_vtr_op (u32 vtr_op)
+{
+  switch (vtr_op)
     {
-      errmsg ("missing rx-mode");
-      return -99;
+      STR_VTR_OP_CASE (DISABLED);
+      STR_VTR_OP_CASE (PUSH_1);
+      STR_VTR_OP_CASE (PUSH_2);
+      STR_VTR_OP_CASE (POP_1);
+      STR_VTR_OP_CASE (POP_2);
+      STR_VTR_OP_CASE (TRANSLATE_1_1);
+      STR_VTR_OP_CASE (TRANSLATE_1_2);
+      STR_VTR_OP_CASE (TRANSLATE_2_1);
+      STR_VTR_OP_CASE (TRANSLATE_2_2);
     }
 
-  /* Construct the API message */
-  M (SW_INTERFACE_SET_RX_MODE, mp);
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->mode = (vl_api_rx_mode_t) mode;
-  mp->queue_id_valid = queue_id_valid;
-  mp->queue_id = queue_id_valid ? ntohl (queue_id) : ~0;
-
-  /* send it... */
-  S (mp);
-
-  /* Wait for a reply, return the good/bad news... */
-  W (ret);
-  return ret;
+  return "UNKNOWN";
 }
 
 static int
-api_sw_interface_set_rx_placement (vat_main_t * vam)
+dump_sub_interface_table (vat_main_t * vam)
 {
-  unformat_input_t *i = vam->input;
-  vl_api_sw_interface_set_rx_placement_t *mp;
-  u32 sw_if_index;
-  u8 sw_if_index_set = 0;
-  int ret;
-  u8 is_main = 0;
-  u32 queue_id, thread_index;
-
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "queue %d", &queue_id))
-       ;
-      else if (unformat (i, "main"))
-       is_main = 1;
-      else if (unformat (i, "worker %d", &thread_index))
-       ;
-      else
-       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else
-       break;
-    }
+  const sw_interface_subif_t *sub = NULL;
 
-  if (sw_if_index_set == 0)
+  if (vam->json_output)
     {
-      errmsg ("missing interface name or sw_if_index");
+      clib_warning
+       ("JSON output supported only for VPE API calls and dump_stats_table");
       return -99;
     }
 
-  if (is_main)
-    thread_index = 0;
-  /* Construct the API message */
-  M (SW_INTERFACE_SET_RX_PLACEMENT, mp);
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->worker_id = ntohl (thread_index);
-  mp->queue_id = ntohl (queue_id);
-  mp->is_main = is_main;
+  print (vam->ofp,
+        "%-30s%-12s%-11s%-7s%-5s%-9s%-9s%-6s%-8s%-10s%-10s",
+        "Interface", "sw_if_index",
+        "sub id", "dot1ad", "tags", "outer id",
+        "inner id", "exact", "default", "outer any", "inner any");
 
-  /* send it... */
-  S (mp);
-  /* Wait for a reply, return the good/bad news... */
-  W (ret);
-  return ret;
+  vec_foreach (sub, vam->sw_if_subif_table)
+  {
+    print (vam->ofp,
+          "%-30s%-12d%-11d%-7s%-5d%-9d%-9d%-6d%-8d%-10d%-10d",
+          sub->interface_name,
+          sub->sw_if_index,
+          sub->sub_id, sub->sub_dot1ad ? "dot1ad" : "dot1q",
+          sub->sub_number_of_tags, sub->sub_outer_vlan_id,
+          sub->sub_inner_vlan_id, sub->sub_exact_match, sub->sub_default,
+          sub->sub_outer_vlan_id_any, sub->sub_inner_vlan_id_any);
+    if (sub->vtr_op != L2_VTR_DISABLED)
+      {
+       print (vam->ofp,
+              "  vlan-tag-rewrite - op: %-14s [ dot1q: %d "
+              "tag1: %d tag2: %d ]",
+              str_vtr_op (sub->vtr_op), sub->vtr_push_dot1q,
+              sub->vtr_tag1, sub->vtr_tag2);
+      }
+  }
+
+  return 0;
 }
 
-static void vl_api_sw_interface_rx_placement_details_t_handler
-  (vl_api_sw_interface_rx_placement_details_t * mp)
+static int
+name_sort_cmp (void *a1, void *a2)
 {
-  vat_main_t *vam = &vat_main;
-  u32 worker_id = ntohl (mp->worker_id);
+  name_sort_t *n1 = a1;
+  name_sort_t *n2 = a2;
 
-  print (vam->ofp,
-        "\n%-11d %-11s %-6d %-5d %-9s",
-        ntohl (mp->sw_if_index), (worker_id == 0) ? "main" : "worker",
-        worker_id, ntohl (mp->queue_id),
-        (mp->mode ==
-         1) ? "polling" : ((mp->mode == 2) ? "interrupt" : "adaptive"));
+  return strcmp ((char *) n1->name, (char *) n2->name);
 }
 
-static void vl_api_sw_interface_rx_placement_details_t_handler_json
-  (vl_api_sw_interface_rx_placement_details_t * mp)
+static int
+dump_interface_table (vat_main_t * vam)
 {
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t *node = NULL;
+  hash_pair_t *p;
+  name_sort_t *nses = 0, *ns;
 
-  if (VAT_JSON_ARRAY != vam->json_tree.type)
+  if (vam->json_output)
     {
-      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
-      vat_json_init_array (&vam->json_tree);
+      clib_warning
+       ("JSON output supported only for VPE API calls and dump_stats_table");
+      return -99;
     }
-  node = vat_json_array_add (&vam->json_tree);
 
-  vat_json_init_object (node);
-  vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
-  vat_json_object_add_uint (node, "worker_id", ntohl (mp->worker_id));
-  vat_json_object_add_uint (node, "queue_id", ntohl (mp->queue_id));
-  vat_json_object_add_uint (node, "mode", mp->mode);
+  /* *INDENT-OFF* */
+  hash_foreach_pair (p, vam->sw_if_index_by_interface_name,
+  ({
+    vec_add2 (nses, ns, 1);
+    ns->name = (u8 *)(p->key);
+    ns->value = (u32) p->value[0];
+  }));
+  /* *INDENT-ON* */
+
+  vec_sort_with_function (nses, name_sort_cmp);
+
+  print (vam->ofp, "%-25s%-15s", "Interface", "sw_if_index");
+  vec_foreach (ns, nses)
+  {
+    print (vam->ofp, "%-25s%-15d", ns->name, ns->value);
+  }
+  vec_free (nses);
+  return 0;
 }
 
 static int
-api_sw_interface_rx_placement_dump (vat_main_t * vam)
+dump_ip_table (vat_main_t * vam, int is_ipv6)
 {
-  unformat_input_t *i = vam->input;
-  vl_api_sw_interface_rx_placement_dump_t *mp;
-  vl_api_control_ping_t *mp_ping;
-  int ret;
-  u32 sw_if_index;
-  u8 sw_if_index_set = 0;
+  const ip_details_t *det = NULL;
+  const ip_address_details_t *address = NULL;
+  u32 i = ~0;
 
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+  print (vam->ofp, "%-12s", "sw_if_index");
+
+  vec_foreach (det, vam->ip_details_by_sw_if_index[is_ipv6])
+  {
+    i++;
+    if (!det->present)
+      {
+       continue;
+      }
+    print (vam->ofp, "%-12d", i);
+    print (vam->ofp, "            %-30s%-13s", "Address", "Prefix length");
+    if (!det->addr)
+      {
+       continue;
+      }
+    vec_foreach (address, det->addr)
     {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set++;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set++;
-      else
-       break;
+      print (vam->ofp,
+            "            %-30U%-13d",
+            is_ipv6 ? format_ip6_address : format_ip4_address,
+            address->ip, address->prefix_length);
     }
+  }
 
-  print (vam->ofp,
-        "\n%-11s %-11s %-6s %-5s %-4s",
-        "sw_if_index", "main/worker", "thread", "queue", "mode");
-
-  /* Dump Interface rx placement */
-  M (SW_INTERFACE_RX_PLACEMENT_DUMP, mp);
-
-  if (sw_if_index_set)
-    mp->sw_if_index = htonl (sw_if_index);
-  else
-    mp->sw_if_index = ~0;
-
-  S (mp);
-
-  /* Use a control ping for synchronization */
-  MPING (CONTROL_PING, mp_ping);
-  S (mp_ping);
-
-  W (ret);
-  return ret;
+  return 0;
 }
 
 static int
-api_sw_interface_clear_stats (vat_main_t * vam)
+dump_ipv4_table (vat_main_t * vam)
 {
-  unformat_input_t *i = vam->input;
-  vl_api_sw_interface_clear_stats_t *mp;
-  u32 sw_if_index;
-  u8 sw_if_index_set = 0;
-  int ret;
-
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+  if (vam->json_output)
     {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else
-       break;
+      clib_warning
+       ("JSON output supported only for VPE API calls and dump_stats_table");
+      return -99;
     }
 
-  /* Construct the API message */
-  M (SW_INTERFACE_CLEAR_STATS, mp);
-
-  if (sw_if_index_set == 1)
-    mp->sw_if_index = ntohl (sw_if_index);
-  else
-    mp->sw_if_index = ~0;
+  return dump_ip_table (vam, 0);
+}
 
-  /* send it... */
-  S (mp);
+static int
+dump_ipv6_table (vat_main_t * vam)
+{
+  if (vam->json_output)
+    {
+      clib_warning
+       ("JSON output supported only for VPE API calls and dump_stats_table");
+      return -99;
+    }
 
-  /* Wait for a reply, return the good/bad news... */
-  W (ret);
-  return ret;
+  return dump_ip_table (vam, 1);
 }
 
+/*
+ * Pass CLI buffers directly in the CLI_INBAND API message,
+ * instead of an additional shared memory area.
+ */
 static int
-api_sw_interface_add_del_address (vat_main_t * vam)
+exec_inband (vat_main_t * vam)
 {
+  vl_api_cli_inband_t *mp;
   unformat_input_t *i = vam->input;
-  vl_api_sw_interface_add_del_address_t *mp;
-  u32 sw_if_index;
-  u8 sw_if_index_set = 0;
-  u8 is_add = 1, del_all = 0;
-  u32 address_length = 0;
-  u8 v4_address_set = 0;
-  u8 v6_address_set = 0;
-  ip4_address_t v4address;
-  ip6_address_t v6address;
   int ret;
 
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "del-all"))
-       del_all = 1;
-      else if (unformat (i, "del"))
-       is_add = 0;
-      else
-       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "%U/%d",
-                        unformat_ip4_address, &v4address, &address_length))
-       v4_address_set = 1;
-      else if (unformat (i, "%U/%d",
-                        unformat_ip6_address, &v6address, &address_length))
-       v6_address_set = 1;
-      else
-       break;
-    }
+  if (vec_len (i->buffer) == 0)
+    return -1;
 
-  if (sw_if_index_set == 0)
-    {
-      errmsg ("missing interface name or sw_if_index");
-      return -99;
-    }
-  if (v4_address_set && v6_address_set)
+  if (vam->exec_mode == 0 && unformat (i, "mode"))
     {
-      errmsg ("both v4 and v6 addresses set");
-      return -99;
+      vam->exec_mode = 1;
+      return 0;
     }
-  if (!v4_address_set && !v6_address_set && !del_all)
+  if (vam->exec_mode == 1 && (unformat (i, "exit") || unformat (i, "quit")))
     {
-      errmsg ("no addresses set");
-      return -99;
+      vam->exec_mode = 0;
+      return 0;
     }
 
-  /* Construct the API message */
-  M (SW_INTERFACE_ADD_DEL_ADDRESS, mp);
-
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->is_add = is_add;
-  mp->del_all = del_all;
-  if (v6_address_set)
-    {
-      mp->prefix.address.af = ADDRESS_IP6;
-      clib_memcpy (mp->prefix.address.un.ip6, &v6address, sizeof (v6address));
-    }
-  else
-    {
-      mp->prefix.address.af = ADDRESS_IP4;
-      clib_memcpy (mp->prefix.address.un.ip4, &v4address, sizeof (v4address));
-    }
-  mp->prefix.len = address_length;
+  /*
+   * In order for the CLI command to work, it
+   * must be a vector ending in \n, not a C-string ending
+   * in \n\0.
+   */
+  M2 (CLI_INBAND, mp, vec_len (vam->input->buffer));
+  vl_api_vec_to_api_string (vam->input->buffer, &mp->cmd);
 
-  /* send it... */
   S (mp);
-
-  /* Wait for a reply, return good/bad news  */
   W (ret);
+  /* json responses may or may not include a useful reply... */
+  if (vec_len (vam->cmd_reply))
+    print (vam->ofp, "%v", (char *) (vam->cmd_reply));
   return ret;
 }
 
+int
+exec (vat_main_t * vam)
+{
+  return exec_inband (vam);
+}
+
 static int
-api_sw_interface_set_mpls_enable (vat_main_t * vam)
+api_create_loopback (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_sw_interface_set_mpls_enable_t *mp;
-  u32 sw_if_index;
-  u8 sw_if_index_set = 0;
-  u8 enable = 1;
+  vl_api_create_loopback_t *mp;
+  vl_api_create_loopback_instance_t *mp_lbi;
+  u8 mac_address[6];
+  u8 mac_set = 0;
+  u8 is_specified = 0;
+  u32 user_instance = 0;
   int ret;
 
-  /* Parse args required to build the message */
+  clib_memset (mac_address, 0, sizeof (mac_address));
+
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "disable"))
-       enable = 0;
-      else if (unformat (i, "dis"))
-       enable = 0;
+      if (unformat (i, "mac %U", unformat_ethernet_address, mac_address))
+       mac_set = 1;
+      if (unformat (i, "instance %d", &user_instance))
+       is_specified = 1;
       else
        break;
     }
 
-  if (sw_if_index_set == 0)
+  if (is_specified)
     {
-      errmsg ("missing interface name or sw_if_index");
-      return -99;
+      M (CREATE_LOOPBACK_INSTANCE, mp_lbi);
+      mp_lbi->is_specified = is_specified;
+      if (is_specified)
+       mp_lbi->user_instance = htonl (user_instance);
+      if (mac_set)
+       clib_memcpy (mp_lbi->mac_address, mac_address, sizeof (mac_address));
+      S (mp_lbi);
+    }
+  else
+    {
+      /* Construct the API message */
+      M (CREATE_LOOPBACK, mp);
+      if (mac_set)
+       clib_memcpy (mp->mac_address, mac_address, sizeof (mac_address));
+      S (mp);
     }
 
-  /* Construct the API message */
-  M (SW_INTERFACE_SET_MPLS_ENABLE, mp);
-
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->enable = enable;
-
-  /* send it... */
-  S (mp);
-
-  /* Wait for a reply... */
   W (ret);
   return ret;
 }
 
 static int
-api_sw_interface_set_table (vat_main_t * vam)
+api_delete_loopback (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_sw_interface_set_table_t *mp;
-  u32 sw_if_index, vrf_id = 0;
-  u8 sw_if_index_set = 0;
-  u8 is_ipv6 = 0;
+  vl_api_delete_loopback_t *mp;
+  u32 sw_if_index = ~0;
   int ret;
 
-  /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "vrf %d", &vrf_id))
+      if (unformat (i, "sw_if_index %d", &sw_if_index))
        ;
-      else if (unformat (i, "ipv6"))
-       is_ipv6 = 1;
       else
        break;
-    }
-
-  if (sw_if_index_set == 0)
-    {
-      errmsg ("missing interface name or sw_if_index");
-      return -99;
-    }
-
-  /* Construct the API message */
-  M (SW_INTERFACE_SET_TABLE, mp);
-
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->is_ipv6 = is_ipv6;
-  mp->vrf_id = ntohl (vrf_id);
-
-  /* send it... */
-  S (mp);
-
-  /* Wait for a reply... */
-  W (ret);
-  return ret;
-}
-
-static void vl_api_sw_interface_get_table_reply_t_handler
-  (vl_api_sw_interface_get_table_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-
-  print (vam->ofp, "%d", ntohl (mp->vrf_id));
-
-  vam->retval = ntohl (mp->retval);
-  vam->result_ready = 1;
-
-}
-
-static void vl_api_sw_interface_get_table_reply_t_handler_json
-  (vl_api_sw_interface_get_table_reply_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t node;
-
-  vat_json_init_object (&node);
-  vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
-  vat_json_object_add_int (&node, "vrf_id", ntohl (mp->vrf_id));
+    }
 
-  vat_json_print (vam->ofp, &node);
-  vat_json_free (&node);
+  if (sw_if_index == ~0)
+    {
+      errmsg ("missing sw_if_index");
+      return -99;
+    }
 
-  vam->retval = ntohl (mp->retval);
-  vam->result_ready = 1;
+  /* Construct the API message */
+  M (DELETE_LOOPBACK, mp);
+  mp->sw_if_index = ntohl (sw_if_index);
+
+  S (mp);
+  W (ret);
+  return ret;
 }
 
 static int
-api_sw_interface_get_table (vat_main_t * vam)
+api_want_interface_events (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_sw_interface_get_table_t *mp;
-  u32 sw_if_index;
-  u8 sw_if_index_set = 0;
-  u8 is_ipv6 = 0;
+  vl_api_want_interface_events_t *mp;
+  int enable = -1;
   int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "ipv6"))
-       is_ipv6 = 1;
+      if (unformat (i, "enable"))
+       enable = 1;
+      else if (unformat (i, "disable"))
+       enable = 0;
       else
        break;
     }
 
-  if (sw_if_index_set == 0)
+  if (enable == -1)
     {
-      errmsg ("missing interface name or sw_if_index");
+      errmsg ("missing enable|disable");
       return -99;
     }
 
-  M (SW_INTERFACE_GET_TABLE, mp);
-  mp->sw_if_index = htonl (sw_if_index);
-  mp->is_ipv6 = is_ipv6;
+  M (WANT_INTERFACE_EVENTS, mp);
+  mp->enable_disable = enable;
+
+  vam->interface_event_display = enable;
+
+  S (mp);
+  W (ret);
+  return ret;
+}
+
+
+/* Note: non-static, called once to set up the initial intfc table */
+int
+api_sw_interface_dump (vat_main_t * vam)
+{
+  vl_api_sw_interface_dump_t *mp;
+  vl_api_control_ping_t *mp_ping;
+  hash_pair_t *p;
+  name_sort_t *nses = 0, *ns;
+  sw_interface_subif_t *sub = NULL;
+  int ret;
+
+  /* Toss the old name table */
+  /* *INDENT-OFF* */
+  hash_foreach_pair (p, vam->sw_if_index_by_interface_name,
+  ({
+    vec_add2 (nses, ns, 1);
+    ns->name = (u8 *)(p->key);
+    ns->value = (u32) p->value[0];
+  }));
+  /* *INDENT-ON* */
+
+  hash_free (vam->sw_if_index_by_interface_name);
+
+  vec_foreach (ns, nses) vec_free (ns->name);
+
+  vec_free (nses);
+
+  vec_foreach (sub, vam->sw_if_subif_table)
+  {
+    vec_free (sub->interface_name);
+  }
+  vec_free (vam->sw_if_subif_table);
+
+  /* recreate the interface name hash table */
+  vam->sw_if_index_by_interface_name = hash_create_string (0, sizeof (uword));
 
+  /*
+   * Ask for all interface names. Otherwise, the epic catalog of
+   * name filters becomes ridiculously long, and vat ends up needing
+   * to be taught about new interface types.
+   */
+  M (SW_INTERFACE_DUMP, mp);
   S (mp);
+
+  /* Use a control ping for synchronization */
+  MPING (CONTROL_PING, mp_ping);
+  S (mp_ping);
+
   W (ret);
   return ret;
 }
 
 static int
-api_sw_interface_set_vpath (vat_main_t * vam)
+api_sw_interface_set_flags (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_sw_interface_set_vpath_t *mp;
-  u32 sw_if_index = 0;
+  vl_api_sw_interface_set_flags_t *mp;
+  u32 sw_if_index;
   u8 sw_if_index_set = 0;
-  u8 is_enable = 0;
+  u8 admin_up = 0;
   int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+      if (unformat (i, "admin-up"))
+       admin_up = 1;
+      else if (unformat (i, "admin-down"))
+       admin_up = 0;
+      else
+       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
        sw_if_index_set = 1;
       else if (unformat (i, "sw_if_index %d", &sw_if_index))
        sw_if_index_set = 1;
-      else if (unformat (i, "enable"))
-       is_enable = 1;
-      else if (unformat (i, "disable"))
-       is_enable = 0;
       else
        break;
     }
@@ -3584,177 +2656,193 @@ api_sw_interface_set_vpath (vat_main_t * vam)
     }
 
   /* Construct the API message */
-  M (SW_INTERFACE_SET_VPATH, mp);
-
+  M (SW_INTERFACE_SET_FLAGS, mp);
   mp->sw_if_index = ntohl (sw_if_index);
-  mp->enable = is_enable;
+  mp->flags = ntohl ((admin_up) ? IF_STATUS_API_FLAG_ADMIN_UP : 0);
 
   /* send it... */
   S (mp);
 
-  /* Wait for a reply... */
+  /* Wait for a reply, return the good/bad news... */
   W (ret);
   return ret;
 }
 
 static int
-api_sw_interface_set_l2_xconnect (vat_main_t * vam)
+api_sw_interface_set_rx_mode (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_sw_interface_set_l2_xconnect_t *mp;
-  u32 rx_sw_if_index;
-  u8 rx_sw_if_index_set = 0;
-  u32 tx_sw_if_index;
-  u8 tx_sw_if_index_set = 0;
-  u8 enable = 1;
+  vl_api_sw_interface_set_rx_mode_t *mp;
+  u32 sw_if_index;
+  u8 sw_if_index_set = 0;
   int ret;
+  u8 queue_id_valid = 0;
+  u32 queue_id;
+  vnet_hw_if_rx_mode mode = VNET_HW_IF_RX_MODE_UNKNOWN;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "rx_sw_if_index %d", &rx_sw_if_index))
-       rx_sw_if_index_set = 1;
-      else if (unformat (i, "tx_sw_if_index %d", &tx_sw_if_index))
-       tx_sw_if_index_set = 1;
-      else if (unformat (i, "rx"))
-       {
-         if (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-           {
-             if (unformat (i, "%U", api_unformat_sw_if_index, vam,
-                           &rx_sw_if_index))
-               rx_sw_if_index_set = 1;
-           }
-         else
-           break;
-       }
-      else if (unformat (i, "tx"))
-       {
-         if (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-           {
-             if (unformat (i, "%U", api_unformat_sw_if_index, vam,
-                           &tx_sw_if_index))
-               tx_sw_if_index_set = 1;
-           }
-         else
-           break;
-       }
-      else if (unformat (i, "enable"))
-       enable = 1;
-      else if (unformat (i, "disable"))
-       enable = 0;
+      if (unformat (i, "queue %d", &queue_id))
+       queue_id_valid = 1;
+      else if (unformat (i, "polling"))
+       mode = VNET_HW_IF_RX_MODE_POLLING;
+      else if (unformat (i, "interrupt"))
+       mode = VNET_HW_IF_RX_MODE_INTERRUPT;
+      else if (unformat (i, "adaptive"))
+       mode = VNET_HW_IF_RX_MODE_ADAPTIVE;
+      else
+       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       sw_if_index_set = 1;
       else
        break;
     }
 
-  if (rx_sw_if_index_set == 0)
+  if (sw_if_index_set == 0)
     {
-      errmsg ("missing rx interface name or rx_sw_if_index");
+      errmsg ("missing interface name or sw_if_index");
       return -99;
     }
-
-  if (enable && (tx_sw_if_index_set == 0))
+  if (mode == VNET_HW_IF_RX_MODE_UNKNOWN)
     {
-      errmsg ("missing tx interface name or tx_sw_if_index");
+      errmsg ("missing rx-mode");
       return -99;
     }
 
-  M (SW_INTERFACE_SET_L2_XCONNECT, mp);
-
-  mp->rx_sw_if_index = ntohl (rx_sw_if_index);
-  mp->tx_sw_if_index = ntohl (tx_sw_if_index);
-  mp->enable = enable;
+  /* Construct the API message */
+  M (SW_INTERFACE_SET_RX_MODE, mp);
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->mode = (vl_api_rx_mode_t) mode;
+  mp->queue_id_valid = queue_id_valid;
+  mp->queue_id = queue_id_valid ? ntohl (queue_id) : ~0;
 
+  /* send it... */
   S (mp);
+
+  /* Wait for a reply, return the good/bad news... */
   W (ret);
   return ret;
 }
 
 static int
-api_sw_interface_set_l2_bridge (vat_main_t * vam)
+api_sw_interface_set_rx_placement (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_sw_interface_set_l2_bridge_t *mp;
-  vl_api_l2_port_type_t port_type;
-  u32 rx_sw_if_index;
-  u8 rx_sw_if_index_set = 0;
-  u32 bd_id;
-  u8 bd_id_set = 0;
-  u32 shg = 0;
-  u8 enable = 1;
+  vl_api_sw_interface_set_rx_placement_t *mp;
+  u32 sw_if_index;
+  u8 sw_if_index_set = 0;
   int ret;
-
-  port_type = L2_API_PORT_TYPE_NORMAL;
+  u8 is_main = 0;
+  u32 queue_id, thread_index;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "sw_if_index %d", &rx_sw_if_index))
-       rx_sw_if_index_set = 1;
-      else if (unformat (i, "bd_id %d", &bd_id))
-       bd_id_set = 1;
-      else
-       if (unformat
-           (i, "%U", api_unformat_sw_if_index, vam, &rx_sw_if_index))
-       rx_sw_if_index_set = 1;
-      else if (unformat (i, "shg %d", &shg))
+      if (unformat (i, "queue %d", &queue_id))
+       ;
+      else if (unformat (i, "main"))
+       is_main = 1;
+      else if (unformat (i, "worker %d", &thread_index))
        ;
-      else if (unformat (i, "bvi"))
-       port_type = L2_API_PORT_TYPE_BVI;
-      else if (unformat (i, "uu-fwd"))
-       port_type = L2_API_PORT_TYPE_UU_FWD;
-      else if (unformat (i, "enable"))
-       enable = 1;
-      else if (unformat (i, "disable"))
-       enable = 0;
       else
-       break;
-    }
-
-  if (rx_sw_if_index_set == 0)
-    {
-      errmsg ("missing rx interface name or sw_if_index");
-      return -99;
+       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       sw_if_index_set = 1;
+      else
+       break;
     }
 
-  if (enable && (bd_id_set == 0))
+  if (sw_if_index_set == 0)
     {
-      errmsg ("missing bridge domain");
+      errmsg ("missing interface name or sw_if_index");
       return -99;
     }
 
-  M (SW_INTERFACE_SET_L2_BRIDGE, mp);
-
-  mp->rx_sw_if_index = ntohl (rx_sw_if_index);
-  mp->bd_id = ntohl (bd_id);
-  mp->shg = (u8) shg;
-  mp->port_type = ntohl (port_type);
-  mp->enable = enable;
+  if (is_main)
+    thread_index = 0;
+  /* Construct the API message */
+  M (SW_INTERFACE_SET_RX_PLACEMENT, mp);
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->worker_id = ntohl (thread_index);
+  mp->queue_id = ntohl (queue_id);
+  mp->is_main = is_main;
 
+  /* send it... */
   S (mp);
+  /* Wait for a reply, return the good/bad news... */
   W (ret);
   return ret;
 }
 
+static void vl_api_sw_interface_rx_placement_details_t_handler
+  (vl_api_sw_interface_rx_placement_details_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+  u32 worker_id = ntohl (mp->worker_id);
+
+  print (vam->ofp,
+        "\n%-11d %-11s %-6d %-5d %-9s",
+        ntohl (mp->sw_if_index), (worker_id == 0) ? "main" : "worker",
+        worker_id, ntohl (mp->queue_id),
+        (mp->mode ==
+         1) ? "polling" : ((mp->mode == 2) ? "interrupt" : "adaptive"));
+}
+
+static void vl_api_sw_interface_rx_placement_details_t_handler_json
+  (vl_api_sw_interface_rx_placement_details_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+  vat_json_node_t *node = NULL;
+
+  if (VAT_JSON_ARRAY != vam->json_tree.type)
+    {
+      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
+      vat_json_init_array (&vam->json_tree);
+    }
+  node = vat_json_array_add (&vam->json_tree);
+
+  vat_json_init_object (node);
+  vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
+  vat_json_object_add_uint (node, "worker_id", ntohl (mp->worker_id));
+  vat_json_object_add_uint (node, "queue_id", ntohl (mp->queue_id));
+  vat_json_object_add_uint (node, "mode", mp->mode);
+}
+
 static int
-api_bridge_domain_dump (vat_main_t * vam)
+api_sw_interface_rx_placement_dump (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_bridge_domain_dump_t *mp;
+  vl_api_sw_interface_rx_placement_dump_t *mp;
   vl_api_control_ping_t *mp_ping;
-  u32 bd_id = ~0;
   int ret;
+  u32 sw_if_index;
+  u8 sw_if_index_set = 0;
 
-  /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "bd_id %d", &bd_id))
-       ;
+      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set++;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       sw_if_index_set++;
       else
        break;
     }
 
-  M (BRIDGE_DOMAIN_DUMP, mp);
-  mp->bd_id = ntohl (bd_id);
+  print (vam->ofp,
+        "\n%-11s %-11s %-6s %-5s %-4s",
+        "sw_if_index", "main/worker", "thread", "queue", "mode");
+
+  /* Dump Interface rx placement */
+  M (SW_INTERFACE_RX_PLACEMENT_DUMP, mp);
+
+  if (sw_if_index_set)
+    mp->sw_if_index = htonl (sw_if_index);
+  else
+    mp->sw_if_index = ~0;
+
   S (mp);
 
   /* Use a control ping for synchronization */
@@ -3766,399 +2854,388 @@ api_bridge_domain_dump (vat_main_t * vam)
 }
 
 static int
-api_bridge_domain_add_del (vat_main_t * vam)
+api_sw_interface_clear_stats (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_bridge_domain_add_del_t *mp;
-  u32 bd_id = ~0;
-  u8 is_add = 1;
-  u32 flood = 1, forward = 1, learn = 1, uu_flood = 1, arp_term = 0;
-  u8 *bd_tag = NULL;
-  u32 mac_age = 0;
+  vl_api_sw_interface_clear_stats_t *mp;
+  u32 sw_if_index;
+  u8 sw_if_index_set = 0;
   int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "bd_id %d", &bd_id))
-       ;
-      else if (unformat (i, "flood %d", &flood))
-       ;
-      else if (unformat (i, "uu-flood %d", &uu_flood))
-       ;
-      else if (unformat (i, "forward %d", &forward))
-       ;
-      else if (unformat (i, "learn %d", &learn))
-       ;
-      else if (unformat (i, "arp-term %d", &arp_term))
-       ;
-      else if (unformat (i, "mac-age %d", &mac_age))
-       ;
-      else if (unformat (i, "bd-tag %s", &bd_tag))
-       ;
-      else if (unformat (i, "del"))
-       {
-         is_add = 0;
-         flood = uu_flood = forward = learn = 0;
-       }
+      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       sw_if_index_set = 1;
       else
        break;
     }
 
-  if (bd_id == ~0)
-    {
-      errmsg ("missing bridge domain");
-      ret = -99;
-      goto done;
-    }
-
-  if (mac_age > 255)
-    {
-      errmsg ("mac age must be less than 256 ");
-      ret = -99;
-      goto done;
-    }
-
-  if ((bd_tag) && (vec_len (bd_tag) > 63))
-    {
-      errmsg ("bd-tag cannot be longer than 63");
-      ret = -99;
-      goto done;
-    }
+  /* Construct the API message */
+  M (SW_INTERFACE_CLEAR_STATS, mp);
 
-  M (BRIDGE_DOMAIN_ADD_DEL, mp);
+  if (sw_if_index_set == 1)
+    mp->sw_if_index = ntohl (sw_if_index);
+  else
+    mp->sw_if_index = ~0;
 
-  mp->bd_id = ntohl (bd_id);
-  mp->flood = flood;
-  mp->uu_flood = uu_flood;
-  mp->forward = forward;
-  mp->learn = learn;
-  mp->arp_term = arp_term;
-  mp->is_add = is_add;
-  mp->mac_age = (u8) mac_age;
-  if (bd_tag)
-    {
-      clib_memcpy (mp->bd_tag, bd_tag, vec_len (bd_tag));
-      mp->bd_tag[vec_len (bd_tag)] = 0;
-    }
+  /* send it... */
   S (mp);
-  W (ret);
 
-done:
-  vec_free (bd_tag);
+  /* Wait for a reply, return the good/bad news... */
+  W (ret);
   return ret;
 }
 
 static int
-api_l2fib_flush_bd (vat_main_t * vam)
+api_sw_interface_add_del_address (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_l2fib_flush_bd_t *mp;
-  u32 bd_id = ~0;
+  vl_api_sw_interface_add_del_address_t *mp;
+  u32 sw_if_index;
+  u8 sw_if_index_set = 0;
+  u8 is_add = 1, del_all = 0;
+  u32 address_length = 0;
+  u8 v4_address_set = 0;
+  u8 v6_address_set = 0;
+  ip4_address_t v4address;
+  ip6_address_t v6address;
   int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "bd_id %d", &bd_id));
+      if (unformat (i, "del-all"))
+       del_all = 1;
+      else if (unformat (i, "del"))
+       is_add = 0;
+      else
+       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "%U/%d",
+                        unformat_ip4_address, &v4address, &address_length))
+       v4_address_set = 1;
+      else if (unformat (i, "%U/%d",
+                        unformat_ip6_address, &v6address, &address_length))
+       v6_address_set = 1;
       else
        break;
     }
 
-  if (bd_id == ~0)
+  if (sw_if_index_set == 0)
     {
-      errmsg ("missing bridge domain");
+      errmsg ("missing interface name or sw_if_index");
+      return -99;
+    }
+  if (v4_address_set && v6_address_set)
+    {
+      errmsg ("both v4 and v6 addresses set");
+      return -99;
+    }
+  if (!v4_address_set && !v6_address_set && !del_all)
+    {
+      errmsg ("no addresses set");
       return -99;
     }
 
-  M (L2FIB_FLUSH_BD, mp);
+  /* Construct the API message */
+  M (SW_INTERFACE_ADD_DEL_ADDRESS, mp);
 
-  mp->bd_id = htonl (bd_id);
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->is_add = is_add;
+  mp->del_all = del_all;
+  if (v6_address_set)
+    {
+      mp->prefix.address.af = ADDRESS_IP6;
+      clib_memcpy (mp->prefix.address.un.ip6, &v6address, sizeof (v6address));
+    }
+  else
+    {
+      mp->prefix.address.af = ADDRESS_IP4;
+      clib_memcpy (mp->prefix.address.un.ip4, &v4address, sizeof (v4address));
+    }
+  mp->prefix.len = address_length;
 
+  /* send it... */
   S (mp);
+
+  /* Wait for a reply, return good/bad news  */
   W (ret);
   return ret;
 }
 
 static int
-api_l2fib_flush_int (vat_main_t * vam)
+api_sw_interface_set_mpls_enable (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_l2fib_flush_int_t *mp;
-  u32 sw_if_index = ~0;
+  vl_api_sw_interface_set_mpls_enable_t *mp;
+  u32 sw_if_index;
+  u8 sw_if_index_set = 0;
+  u8 enable = 1;
   int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "sw_if_index %d", &sw_if_index));
-      else
-       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index));
+      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "disable"))
+       enable = 0;
+      else if (unformat (i, "dis"))
+       enable = 0;
       else
        break;
     }
 
-  if (sw_if_index == ~0)
+  if (sw_if_index_set == 0)
     {
       errmsg ("missing interface name or sw_if_index");
       return -99;
     }
 
-  M (L2FIB_FLUSH_INT, mp);
+  /* Construct the API message */
+  M (SW_INTERFACE_SET_MPLS_ENABLE, mp);
 
   mp->sw_if_index = ntohl (sw_if_index);
+  mp->enable = enable;
 
+  /* send it... */
   S (mp);
+
+  /* Wait for a reply... */
   W (ret);
   return ret;
 }
 
 static int
-api_l2fib_add_del (vat_main_t * vam)
+api_sw_interface_set_table (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_l2fib_add_del_t *mp;
-  f64 timeout;
-  u8 mac[6] = { 0 };
-  u8 mac_set = 0;
-  u32 bd_id;
-  u8 bd_id_set = 0;
-  u32 sw_if_index = 0;
+  vl_api_sw_interface_set_table_t *mp;
+  u32 sw_if_index, vrf_id = 0;
   u8 sw_if_index_set = 0;
-  u8 is_add = 1;
-  u8 static_mac = 0;
-  u8 filter_mac = 0;
-  u8 bvi_mac = 0;
-  int count = 1;
-  f64 before = 0;
-  int j;
+  u8 is_ipv6 = 0;
+  int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "mac %U", unformat_ethernet_address, mac))
-       mac_set = 1;
-      else if (unformat (i, "bd_id %d", &bd_id))
-       bd_id_set = 1;
+      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
       else if (unformat (i, "sw_if_index %d", &sw_if_index))
        sw_if_index_set = 1;
-      else if (unformat (i, "sw_if"))
-       {
-         if (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-           {
-             if (unformat
-                 (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-               sw_if_index_set = 1;
-           }
-         else
-           break;
-       }
-      else if (unformat (i, "static"))
-       static_mac = 1;
-      else if (unformat (i, "filter"))
-       {
-         filter_mac = 1;
-         static_mac = 1;
-       }
-      else if (unformat (i, "bvi"))
-       {
-         bvi_mac = 1;
-         static_mac = 1;
-       }
-      else if (unformat (i, "del"))
-       is_add = 0;
-      else if (unformat (i, "count %d", &count))
+      else if (unformat (i, "vrf %d", &vrf_id))
        ;
+      else if (unformat (i, "ipv6"))
+       is_ipv6 = 1;
       else
        break;
     }
 
-  if (mac_set == 0)
-    {
-      errmsg ("missing mac address");
-      return -99;
-    }
-
-  if (bd_id_set == 0)
-    {
-      errmsg ("missing bridge domain");
-      return -99;
-    }
-
-  if (is_add && sw_if_index_set == 0 && filter_mac == 0)
+  if (sw_if_index_set == 0)
     {
       errmsg ("missing interface name or sw_if_index");
       return -99;
     }
 
-  if (count > 1)
-    {
-      /* Turn on async mode */
-      vam->async_mode = 1;
-      vam->async_errors = 0;
-      before = vat_time_now (vam);
-    }
+  /* Construct the API message */
+  M (SW_INTERFACE_SET_TABLE, mp);
 
-  for (j = 0; j < count; j++)
-    {
-      M (L2FIB_ADD_DEL, mp);
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->is_ipv6 = is_ipv6;
+  mp->vrf_id = ntohl (vrf_id);
 
-      clib_memcpy (mp->mac, mac, 6);
-      mp->bd_id = ntohl (bd_id);
-      mp->is_add = is_add;
-      mp->sw_if_index = ntohl (sw_if_index);
+  /* send it... */
+  S (mp);
 
-      if (is_add)
-       {
-         mp->static_mac = static_mac;
-         mp->filter_mac = filter_mac;
-         mp->bvi_mac = bvi_mac;
-       }
-      increment_mac_address (mac);
-      /* send it... */
-      S (mp);
-    }
+  /* Wait for a reply... */
+  W (ret);
+  return ret;
+}
 
-  if (count > 1)
-    {
-      vl_api_control_ping_t *mp_ping;
-      f64 after;
+static void vl_api_sw_interface_get_table_reply_t_handler
+  (vl_api_sw_interface_get_table_reply_t * mp)
+{
+  vat_main_t *vam = &vat_main;
 
-      /* Shut off async mode */
-      vam->async_mode = 0;
+  print (vam->ofp, "%d", ntohl (mp->vrf_id));
 
-      MPING (CONTROL_PING, mp_ping);
-      S (mp_ping);
+  vam->retval = ntohl (mp->retval);
+  vam->result_ready = 1;
 
-      timeout = vat_time_now (vam) + 1.0;
-      while (vat_time_now (vam) < timeout)
-       if (vam->result_ready == 1)
-         goto out;
-      vam->retval = -99;
+}
 
-    out:
-      if (vam->retval == -99)
-       errmsg ("timeout");
+static void vl_api_sw_interface_get_table_reply_t_handler_json
+  (vl_api_sw_interface_get_table_reply_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+  vat_json_node_t node;
 
-      if (vam->async_errors > 0)
-       {
-         errmsg ("%d asynchronous errors", vam->async_errors);
-         vam->retval = -98;
-       }
-      vam->async_errors = 0;
-      after = vat_time_now (vam);
+  vat_json_init_object (&node);
+  vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
+  vat_json_object_add_int (&node, "vrf_id", ntohl (mp->vrf_id));
 
-      print (vam->ofp, "%d routes in %.6f secs, %.2f routes/sec",
-            count, after - before, count / (after - before));
-    }
-  else
-    {
-      int ret;
+  vat_json_print (vam->ofp, &node);
+  vat_json_free (&node);
 
-      /* Wait for a reply... */
-      W (ret);
-      return ret;
-    }
-  /* Return the good/bad news */
-  return (vam->retval);
+  vam->retval = ntohl (mp->retval);
+  vam->result_ready = 1;
 }
 
 static int
-api_bridge_domain_set_mac_age (vat_main_t * vam)
+api_sw_interface_get_table (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_bridge_domain_set_mac_age_t *mp;
-  u32 bd_id = ~0;
-  u32 mac_age = 0;
+  vl_api_sw_interface_get_table_t *mp;
+  u32 sw_if_index;
+  u8 sw_if_index_set = 0;
+  u8 is_ipv6 = 0;
   int ret;
 
-  /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "bd_id %d", &bd_id));
-      else if (unformat (i, "mac-age %d", &mac_age));
+      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "ipv6"))
+       is_ipv6 = 1;
       else
        break;
     }
 
-  if (bd_id == ~0)
+  if (sw_if_index_set == 0)
     {
-      errmsg ("missing bridge domain");
+      errmsg ("missing interface name or sw_if_index");
       return -99;
     }
 
-  if (mac_age > 255)
+  M (SW_INTERFACE_GET_TABLE, mp);
+  mp->sw_if_index = htonl (sw_if_index);
+  mp->is_ipv6 = is_ipv6;
+
+  S (mp);
+  W (ret);
+  return ret;
+}
+
+static int
+api_sw_interface_set_vpath (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_sw_interface_set_vpath_t *mp;
+  u32 sw_if_index = 0;
+  u8 sw_if_index_set = 0;
+  u8 is_enable = 0;
+  int ret;
+
+  /* Parse args required to build the message */
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      errmsg ("mac age must be less than 256 ");
+      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "enable"))
+       is_enable = 1;
+      else if (unformat (i, "disable"))
+       is_enable = 0;
+      else
+       break;
+    }
+
+  if (sw_if_index_set == 0)
+    {
+      errmsg ("missing interface name or sw_if_index");
       return -99;
     }
 
-  M (BRIDGE_DOMAIN_SET_MAC_AGE, mp);
+  /* Construct the API message */
+  M (SW_INTERFACE_SET_VPATH, mp);
 
-  mp->bd_id = htonl (bd_id);
-  mp->mac_age = (u8) mac_age;
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->enable = is_enable;
 
+  /* send it... */
   S (mp);
+
+  /* Wait for a reply... */
   W (ret);
   return ret;
 }
 
 static int
-api_l2_flags (vat_main_t * vam)
+api_sw_interface_set_l2_xconnect (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_l2_flags_t *mp;
-  u32 sw_if_index;
-  u32 flags = 0;
-  u8 sw_if_index_set = 0;
-  u8 is_set = 0;
+  vl_api_sw_interface_set_l2_xconnect_t *mp;
+  u32 rx_sw_if_index;
+  u8 rx_sw_if_index_set = 0;
+  u32 tx_sw_if_index;
+  u8 tx_sw_if_index_set = 0;
+  u8 enable = 1;
   int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if"))
+      if (unformat (i, "rx_sw_if_index %d", &rx_sw_if_index))
+       rx_sw_if_index_set = 1;
+      else if (unformat (i, "tx_sw_if_index %d", &tx_sw_if_index))
+       tx_sw_if_index_set = 1;
+      else if (unformat (i, "rx"))
+       {
+         if (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+           {
+             if (unformat (i, "%U", api_unformat_sw_if_index, vam,
+                           &rx_sw_if_index))
+               rx_sw_if_index_set = 1;
+           }
+         else
+           break;
+       }
+      else if (unformat (i, "tx"))
        {
          if (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
            {
-             if (unformat
-                 (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-               sw_if_index_set = 1;
+             if (unformat (i, "%U", api_unformat_sw_if_index, vam,
+                           &tx_sw_if_index))
+               tx_sw_if_index_set = 1;
            }
          else
            break;
        }
-      else if (unformat (i, "learn"))
-       flags |= L2_LEARN;
-      else if (unformat (i, "forward"))
-       flags |= L2_FWD;
-      else if (unformat (i, "flood"))
-       flags |= L2_FLOOD;
-      else if (unformat (i, "uu-flood"))
-       flags |= L2_UU_FLOOD;
-      else if (unformat (i, "arp-term"))
-       flags |= L2_ARP_TERM;
-      else if (unformat (i, "off"))
-       is_set = 0;
+      else if (unformat (i, "enable"))
+       enable = 1;
       else if (unformat (i, "disable"))
-       is_set = 0;
+       enable = 0;
       else
        break;
     }
 
-  if (sw_if_index_set == 0)
+  if (rx_sw_if_index_set == 0)
     {
-      errmsg ("missing interface name or sw_if_index");
+      errmsg ("missing rx interface name or rx_sw_if_index");
       return -99;
     }
 
-  M (L2_FLAGS, mp);
+  if (enable && (tx_sw_if_index_set == 0))
+    {
+      errmsg ("missing tx interface name or tx_sw_if_index");
+      return -99;
+    }
 
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->feature_bitmap = ntohl (flags);
-  mp->is_set = is_set;
+  M (SW_INTERFACE_SET_L2_XCONNECT, mp);
+
+  mp->rx_sw_if_index = ntohl (rx_sw_if_index);
+  mp->tx_sw_if_index = ntohl (tx_sw_if_index);
+  mp->enable = enable;
 
   S (mp);
   W (ret);
@@ -4166,50 +3243,65 @@ api_l2_flags (vat_main_t * vam)
 }
 
 static int
-api_bridge_flags (vat_main_t * vam)
+api_sw_interface_set_l2_bridge (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_bridge_flags_t *mp;
+  vl_api_sw_interface_set_l2_bridge_t *mp;
+  vl_api_l2_port_type_t port_type;
+  u32 rx_sw_if_index;
+  u8 rx_sw_if_index_set = 0;
   u32 bd_id;
   u8 bd_id_set = 0;
-  u8 is_set = 1;
-  bd_flags_t flags = 0;
+  u32 shg = 0;
+  u8 enable = 1;
   int ret;
 
+  port_type = L2_API_PORT_TYPE_NORMAL;
+
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "bd_id %d", &bd_id))
+      if (unformat (i, "sw_if_index %d", &rx_sw_if_index))
+       rx_sw_if_index_set = 1;
+      else if (unformat (i, "bd_id %d", &bd_id))
        bd_id_set = 1;
-      else if (unformat (i, "learn"))
-       flags |= BRIDGE_API_FLAG_LEARN;
-      else if (unformat (i, "forward"))
-       flags |= BRIDGE_API_FLAG_FWD;
-      else if (unformat (i, "flood"))
-       flags |= BRIDGE_API_FLAG_FLOOD;
-      else if (unformat (i, "uu-flood"))
-       flags |= BRIDGE_API_FLAG_UU_FLOOD;
-      else if (unformat (i, "arp-term"))
-       flags |= BRIDGE_API_FLAG_ARP_TERM;
-      else if (unformat (i, "off"))
-       is_set = 0;
+      else
+       if (unformat
+           (i, "%U", api_unformat_sw_if_index, vam, &rx_sw_if_index))
+       rx_sw_if_index_set = 1;
+      else if (unformat (i, "shg %d", &shg))
+       ;
+      else if (unformat (i, "bvi"))
+       port_type = L2_API_PORT_TYPE_BVI;
+      else if (unformat (i, "uu-fwd"))
+       port_type = L2_API_PORT_TYPE_UU_FWD;
+      else if (unformat (i, "enable"))
+       enable = 1;
       else if (unformat (i, "disable"))
-       is_set = 0;
+       enable = 0;
       else
        break;
     }
 
-  if (bd_id_set == 0)
+  if (rx_sw_if_index_set == 0)
+    {
+      errmsg ("missing rx interface name or sw_if_index");
+      return -99;
+    }
+
+  if (enable && (bd_id_set == 0))
     {
       errmsg ("missing bridge domain");
       return -99;
     }
 
-  M (BRIDGE_FLAGS, mp);
+  M (SW_INTERFACE_SET_L2_BRIDGE, mp);
 
+  mp->rx_sw_if_index = ntohl (rx_sw_if_index);
   mp->bd_id = ntohl (bd_id);
-  mp->flags = ntohl (flags);
-  mp->is_set = is_set;
+  mp->shg = (u8) shg;
+  mp->port_type = ntohl (port_type);
+  mp->enable = enable;
 
   S (mp);
   W (ret);
@@ -4217,673 +3309,858 @@ api_bridge_flags (vat_main_t * vam)
 }
 
 static int
-api_bd_ip_mac_add_del (vat_main_t * vam)
+api_bridge_domain_dump (vat_main_t * vam)
 {
-  vl_api_address_t ip = VL_API_ZERO_ADDRESS;
-  vl_api_mac_address_t mac = { 0 };
   unformat_input_t *i = vam->input;
-  vl_api_bd_ip_mac_add_del_t *mp;
-  u32 bd_id;
-  u8 is_add = 1;
-  u8 bd_id_set = 0;
-  u8 ip_set = 0;
-  u8 mac_set = 0;
+  vl_api_bridge_domain_dump_t *mp;
+  vl_api_control_ping_t *mp_ping;
+  u32 bd_id = ~0;
   int ret;
 
-
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (i, "bd_id %d", &bd_id))
-       {
-         bd_id_set++;
-       }
-      else if (unformat (i, "%U", unformat_vl_api_address, &ip))
-       {
-         ip_set++;
-       }
-      else if (unformat (i, "%U", unformat_vl_api_mac_address, &mac))
-       {
-         mac_set++;
-       }
-      else if (unformat (i, "del"))
-       is_add = 0;
+       ;
       else
        break;
     }
 
-  if (bd_id_set == 0)
-    {
-      errmsg ("missing bridge domain");
-      return -99;
-    }
-  else if (ip_set == 0)
-    {
-      errmsg ("missing IP address");
-      return -99;
-    }
-  else if (mac_set == 0)
-    {
-      errmsg ("missing MAC address");
-      return -99;
-    }
-
-  M (BD_IP_MAC_ADD_DEL, mp);
-
-  mp->entry.bd_id = ntohl (bd_id);
-  mp->is_add = is_add;
+  M (BRIDGE_DOMAIN_DUMP, mp);
+  mp->bd_id = ntohl (bd_id);
+  S (mp);
 
-  clib_memcpy (&mp->entry.ip, &ip, sizeof (ip));
-  clib_memcpy (&mp->entry.mac, &mac, sizeof (mac));
+  /* Use a control ping for synchronization */
+  MPING (CONTROL_PING, mp_ping);
+  S (mp_ping);
 
-  S (mp);
   W (ret);
   return ret;
 }
 
 static int
-api_bd_ip_mac_flush (vat_main_t * vam)
+api_bridge_domain_add_del (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_bd_ip_mac_flush_t *mp;
-  u32 bd_id;
-  u8 bd_id_set = 0;
+  vl_api_bridge_domain_add_del_t *mp;
+  u32 bd_id = ~0;
+  u8 is_add = 1;
+  u32 flood = 1, forward = 1, learn = 1, uu_flood = 1, arp_term = 0;
+  u8 *bd_tag = NULL;
+  u32 mac_age = 0;
   int ret;
 
+  /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (i, "bd_id %d", &bd_id))
+       ;
+      else if (unformat (i, "flood %d", &flood))
+       ;
+      else if (unformat (i, "uu-flood %d", &uu_flood))
+       ;
+      else if (unformat (i, "forward %d", &forward))
+       ;
+      else if (unformat (i, "learn %d", &learn))
+       ;
+      else if (unformat (i, "arp-term %d", &arp_term))
+       ;
+      else if (unformat (i, "mac-age %d", &mac_age))
+       ;
+      else if (unformat (i, "bd-tag %s", &bd_tag))
+       ;
+      else if (unformat (i, "del"))
        {
-         bd_id_set++;
+         is_add = 0;
+         flood = uu_flood = forward = learn = 0;
        }
       else
        break;
     }
 
-  if (bd_id_set == 0)
+  if (bd_id == ~0)
     {
       errmsg ("missing bridge domain");
-      return -99;
+      ret = -99;
+      goto done;
     }
 
-  M (BD_IP_MAC_FLUSH, mp);
+  if (mac_age > 255)
+    {
+      errmsg ("mac age must be less than 256 ");
+      ret = -99;
+      goto done;
+    }
 
-  mp->bd_id = ntohl (bd_id);
+  if ((bd_tag) && (vec_len (bd_tag) > 63))
+    {
+      errmsg ("bd-tag cannot be longer than 63");
+      ret = -99;
+      goto done;
+    }
+
+  M (BRIDGE_DOMAIN_ADD_DEL, mp);
 
+  mp->bd_id = ntohl (bd_id);
+  mp->flood = flood;
+  mp->uu_flood = uu_flood;
+  mp->forward = forward;
+  mp->learn = learn;
+  mp->arp_term = arp_term;
+  mp->is_add = is_add;
+  mp->mac_age = (u8) mac_age;
+  if (bd_tag)
+    {
+      clib_memcpy (mp->bd_tag, bd_tag, vec_len (bd_tag));
+      mp->bd_tag[vec_len (bd_tag)] = 0;
+    }
   S (mp);
   W (ret);
+
+done:
+  vec_free (bd_tag);
   return ret;
 }
 
-static void vl_api_bd_ip_mac_details_t_handler
-  (vl_api_bd_ip_mac_details_t * mp)
+static int
+api_l2fib_flush_bd (vat_main_t * vam)
 {
-  vat_main_t *vam = &vat_main;
-
-  print (vam->ofp,
-        "\n%-5d %U %U",
-        ntohl (mp->entry.bd_id),
-        format_vl_api_mac_address, mp->entry.mac,
-        format_vl_api_address, &mp->entry.ip);
-}
+  unformat_input_t *i = vam->input;
+  vl_api_l2fib_flush_bd_t *mp;
+  u32 bd_id = ~0;
+  int ret;
 
-static void vl_api_bd_ip_mac_details_t_handler_json
-  (vl_api_bd_ip_mac_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t *node = NULL;
+  /* Parse args required to build the message */
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "bd_id %d", &bd_id));
+      else
+       break;
+    }
 
-  if (VAT_JSON_ARRAY != vam->json_tree.type)
+  if (bd_id == ~0)
     {
-      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
-      vat_json_init_array (&vam->json_tree);
+      errmsg ("missing bridge domain");
+      return -99;
     }
-  node = vat_json_array_add (&vam->json_tree);
 
-  vat_json_init_object (node);
-  vat_json_object_add_uint (node, "bd_id", ntohl (mp->entry.bd_id));
-  vat_json_object_add_string_copy (node, "mac_address",
-                                  format (0, "%U", format_vl_api_mac_address,
-                                          &mp->entry.mac));
-  u8 *ip = 0;
+  M (L2FIB_FLUSH_BD, mp);
 
-  ip = format (0, "%U", format_vl_api_address, &mp->entry.ip);
-  vat_json_object_add_string_copy (node, "ip_address", ip);
-  vec_free (ip);
+  mp->bd_id = htonl (bd_id);
+
+  S (mp);
+  W (ret);
+  return ret;
 }
 
 static int
-api_bd_ip_mac_dump (vat_main_t * vam)
+api_l2fib_flush_int (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_bd_ip_mac_dump_t *mp;
-  vl_api_control_ping_t *mp_ping;
+  vl_api_l2fib_flush_int_t *mp;
+  u32 sw_if_index = ~0;
   int ret;
-  u32 bd_id;
-  u8 bd_id_set = 0;
 
+  /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "bd_id %d", &bd_id))
-       {
-         bd_id_set++;
-       }
+      if (unformat (i, "sw_if_index %d", &sw_if_index));
+      else
+       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index));
       else
        break;
     }
 
-  print (vam->ofp,
-        "\n%-5s %-7s %-20s %-30s",
-        "bd_id", "is_ipv6", "mac_address", "ip_address");
+  if (sw_if_index == ~0)
+    {
+      errmsg ("missing interface name or sw_if_index");
+      return -99;
+    }
 
-  /* Dump Bridge Domain Ip to Mac entries */
-  M (BD_IP_MAC_DUMP, mp);
+  M (L2FIB_FLUSH_INT, mp);
 
-  if (bd_id_set)
-    mp->bd_id = htonl (bd_id);
-  else
-    mp->bd_id = ~0;
+  mp->sw_if_index = ntohl (sw_if_index);
 
   S (mp);
-
-  /* Use a control ping for synchronization */
-  MPING (CONTROL_PING, mp_ping);
-  S (mp_ping);
-
   W (ret);
   return ret;
 }
 
 static int
-api_tap_create_v2 (vat_main_t * vam)
+api_l2fib_add_del (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_tap_create_v2_t *mp;
-  u8 mac_address[6];
-  u8 random_mac = 1;
-  u32 id = ~0;
-  u32 num_rx_queues = 0;
-  u8 *host_if_name = 0;
-  u8 host_if_name_set = 0;
-  u8 *host_ns = 0;
-  u8 host_ns_set = 0;
-  u8 host_mac_addr[6];
-  u8 host_mac_addr_set = 0;
-  u8 *host_bridge = 0;
-  u8 host_bridge_set = 0;
-  u8 host_ip4_prefix_set = 0;
-  u8 host_ip6_prefix_set = 0;
-  ip4_address_t host_ip4_addr;
-  ip4_address_t host_ip4_gw;
-  u8 host_ip4_gw_set = 0;
-  u32 host_ip4_prefix_len = 0;
-  ip6_address_t host_ip6_addr;
-  ip6_address_t host_ip6_gw;
-  u8 host_ip6_gw_set = 0;
-  u32 host_ip6_prefix_len = 0;
-  u32 host_mtu_size = 0;
-  u8 host_mtu_set = 0;
-  u32 tap_flags = 0;
-  int ret;
-  u32 rx_ring_sz = 0, tx_ring_sz = 0;
-
-  clib_memset (mac_address, 0, sizeof (mac_address));
+  vl_api_l2fib_add_del_t *mp;
+  f64 timeout;
+  u8 mac[6] = { 0 };
+  u8 mac_set = 0;
+  u32 bd_id;
+  u8 bd_id_set = 0;
+  u32 sw_if_index = 0;
+  u8 sw_if_index_set = 0;
+  u8 is_add = 1;
+  u8 static_mac = 0;
+  u8 filter_mac = 0;
+  u8 bvi_mac = 0;
+  int count = 1;
+  f64 before = 0;
+  int j;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "id %u", &id))
-       ;
-      else
-       if (unformat
-           (i, "hw-addr %U", unformat_ethernet_address, mac_address))
-       random_mac = 0;
-      else if (unformat (i, "host-if-name %s", &host_if_name))
-       host_if_name_set = 1;
-      else if (unformat (i, "num-rx-queues %u", &num_rx_queues))
-       ;
-      else if (unformat (i, "host-ns %s", &host_ns))
-       host_ns_set = 1;
-      else if (unformat (i, "host-mac-addr %U", unformat_ethernet_address,
-                        host_mac_addr))
-       host_mac_addr_set = 1;
-      else if (unformat (i, "host-bridge %s", &host_bridge))
-       host_bridge_set = 1;
-      else if (unformat (i, "host-ip4-addr %U/%u", unformat_ip4_address,
-                        &host_ip4_addr, &host_ip4_prefix_len))
-       host_ip4_prefix_set = 1;
-      else if (unformat (i, "host-ip6-addr %U/%u", unformat_ip6_address,
-                        &host_ip6_addr, &host_ip6_prefix_len))
-       host_ip6_prefix_set = 1;
-      else if (unformat (i, "host-ip4-gw %U", unformat_ip4_address,
-                        &host_ip4_gw))
-       host_ip4_gw_set = 1;
-      else if (unformat (i, "host-ip6-gw %U", unformat_ip6_address,
-                        &host_ip6_gw))
-       host_ip6_gw_set = 1;
-      else if (unformat (i, "rx-ring-size %u", &rx_ring_sz))
-       ;
-      else if (unformat (i, "tx-ring-size %u", &tx_ring_sz))
+      if (unformat (i, "mac %U", unformat_ethernet_address, mac))
+       mac_set = 1;
+      else if (unformat (i, "bd_id %d", &bd_id))
+       bd_id_set = 1;
+      else if (unformat (i, "sw_if_index %d", &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if"))
+       {
+         if (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+           {
+             if (unformat
+                 (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+               sw_if_index_set = 1;
+           }
+         else
+           break;
+       }
+      else if (unformat (i, "static"))
+       static_mac = 1;
+      else if (unformat (i, "filter"))
+       {
+         filter_mac = 1;
+         static_mac = 1;
+       }
+      else if (unformat (i, "bvi"))
+       {
+         bvi_mac = 1;
+         static_mac = 1;
+       }
+      else if (unformat (i, "del"))
+       is_add = 0;
+      else if (unformat (i, "count %d", &count))
        ;
-      else if (unformat (i, "host-mtu-size %u", &host_mtu_size))
-       host_mtu_set = 1;
-      else if (unformat (i, "no-gso"))
-       tap_flags &= ~TAP_API_FLAG_GSO;
-      else if (unformat (i, "gso"))
-       tap_flags |= TAP_API_FLAG_GSO;
-      else if (unformat (i, "csum-offload"))
-       tap_flags |= TAP_API_FLAG_CSUM_OFFLOAD;
-      else if (unformat (i, "persist"))
-       tap_flags |= TAP_API_FLAG_PERSIST;
-      else if (unformat (i, "attach"))
-       tap_flags |= TAP_API_FLAG_ATTACH;
-      else if (unformat (i, "tun"))
-       tap_flags |= TAP_API_FLAG_TUN;
-      else if (unformat (i, "gro-coalesce"))
-       tap_flags |= TAP_API_FLAG_GRO_COALESCE;
-      else if (unformat (i, "packed"))
-       tap_flags |= TAP_API_FLAG_PACKED;
-      else if (unformat (i, "in-order"))
-       tap_flags |= TAP_API_FLAG_IN_ORDER;
       else
        break;
     }
 
-  if (vec_len (host_if_name) > 63)
+  if (mac_set == 0)
     {
-      errmsg ("tap name too long. ");
+      errmsg ("missing mac address");
       return -99;
     }
-  if (vec_len (host_ns) > 63)
+
+  if (bd_id_set == 0)
     {
-      errmsg ("host name space too long. ");
+      errmsg ("missing bridge domain");
       return -99;
     }
-  if (vec_len (host_bridge) > 63)
+
+  if (is_add && sw_if_index_set == 0 && filter_mac == 0)
     {
-      errmsg ("host bridge name too long. ");
+      errmsg ("missing interface name or sw_if_index");
       return -99;
     }
-  if (host_ip4_prefix_len > 32)
+
+  if (count > 1)
     {
-      errmsg ("host ip4 prefix length not valid. ");
-      return -99;
+      /* Turn on async mode */
+      vam->async_mode = 1;
+      vam->async_errors = 0;
+      before = vat_time_now (vam);
     }
-  if (host_ip6_prefix_len > 128)
+
+  for (j = 0; j < count; j++)
     {
-      errmsg ("host ip6 prefix length not valid. ");
-      return -99;
+      M (L2FIB_ADD_DEL, mp);
+
+      clib_memcpy (mp->mac, mac, 6);
+      mp->bd_id = ntohl (bd_id);
+      mp->is_add = is_add;
+      mp->sw_if_index = ntohl (sw_if_index);
+
+      if (is_add)
+       {
+         mp->static_mac = static_mac;
+         mp->filter_mac = filter_mac;
+         mp->bvi_mac = bvi_mac;
+       }
+      increment_mac_address (mac);
+      /* send it... */
+      S (mp);
     }
-  if (!is_pow2 (rx_ring_sz))
+
+  if (count > 1)
     {
-      errmsg ("rx ring size must be power of 2. ");
-      return -99;
+      vl_api_control_ping_t *mp_ping;
+      f64 after;
+
+      /* Shut off async mode */
+      vam->async_mode = 0;
+
+      MPING (CONTROL_PING, mp_ping);
+      S (mp_ping);
+
+      timeout = vat_time_now (vam) + 1.0;
+      while (vat_time_now (vam) < timeout)
+       if (vam->result_ready == 1)
+         goto out;
+      vam->retval = -99;
+
+    out:
+      if (vam->retval == -99)
+       errmsg ("timeout");
+
+      if (vam->async_errors > 0)
+       {
+         errmsg ("%d asynchronous errors", vam->async_errors);
+         vam->retval = -98;
+       }
+      vam->async_errors = 0;
+      after = vat_time_now (vam);
+
+      print (vam->ofp, "%d routes in %.6f secs, %.2f routes/sec",
+            count, after - before, count / (after - before));
     }
-  if (rx_ring_sz > 32768)
+  else
     {
-      errmsg ("rx ring size must be 32768 or lower. ");
-      return -99;
+      int ret;
+
+      /* Wait for a reply... */
+      W (ret);
+      return ret;
     }
-  if (!is_pow2 (tx_ring_sz))
+  /* Return the good/bad news */
+  return (vam->retval);
+}
+
+static int
+api_bridge_domain_set_mac_age (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_bridge_domain_set_mac_age_t *mp;
+  u32 bd_id = ~0;
+  u32 mac_age = 0;
+  int ret;
+
+  /* Parse args required to build the message */
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      errmsg ("tx ring size must be power of 2. ");
-      return -99;
+      if (unformat (i, "bd_id %d", &bd_id));
+      else if (unformat (i, "mac-age %d", &mac_age));
+      else
+       break;
     }
-  if (tx_ring_sz > 32768)
+
+  if (bd_id == ~0)
     {
-      errmsg ("tx ring size must be 32768 or lower. ");
+      errmsg ("missing bridge domain");
       return -99;
     }
-  if (host_mtu_set && (host_mtu_size < 64 || host_mtu_size > 65355))
+
+  if (mac_age > 255)
     {
-      errmsg ("host MTU size must be in between 64 and 65355. ");
+      errmsg ("mac age must be less than 256 ");
       return -99;
     }
 
-  /* Construct the API message */
-  M (TAP_CREATE_V2, mp);
+  M (BRIDGE_DOMAIN_SET_MAC_AGE, mp);
 
-  mp->id = ntohl (id);
-  mp->use_random_mac = random_mac;
-  mp->num_rx_queues = (u8) num_rx_queues;
-  mp->tx_ring_sz = ntohs (tx_ring_sz);
-  mp->rx_ring_sz = ntohs (rx_ring_sz);
-  mp->host_mtu_set = host_mtu_set;
-  mp->host_mtu_size = ntohl (host_mtu_size);
-  mp->host_mac_addr_set = host_mac_addr_set;
-  mp->host_ip4_prefix_set = host_ip4_prefix_set;
-  mp->host_ip6_prefix_set = host_ip6_prefix_set;
-  mp->host_ip4_gw_set = host_ip4_gw_set;
-  mp->host_ip6_gw_set = host_ip6_gw_set;
-  mp->tap_flags = ntohl (tap_flags);
-  mp->host_namespace_set = host_ns_set;
-  mp->host_if_name_set = host_if_name_set;
-  mp->host_bridge_set = host_bridge_set;
+  mp->bd_id = htonl (bd_id);
+  mp->mac_age = (u8) mac_age;
 
-  if (random_mac == 0)
-    clib_memcpy (mp->mac_address, mac_address, 6);
-  if (host_mac_addr_set)
-    clib_memcpy (mp->host_mac_addr, host_mac_addr, 6);
-  if (host_if_name_set)
-    clib_memcpy (mp->host_if_name, host_if_name, vec_len (host_if_name));
-  if (host_ns_set)
-    clib_memcpy (mp->host_namespace, host_ns, vec_len (host_ns));
-  if (host_bridge_set)
-    clib_memcpy (mp->host_bridge, host_bridge, vec_len (host_bridge));
-  if (host_ip4_prefix_set)
+  S (mp);
+  W (ret);
+  return ret;
+}
+
+static int
+api_l2_flags (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_l2_flags_t *mp;
+  u32 sw_if_index;
+  u32 flags = 0;
+  u8 sw_if_index_set = 0;
+  u8 is_set = 0;
+  int ret;
+
+  /* Parse args required to build the message */
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      clib_memcpy (mp->host_ip4_prefix.address, &host_ip4_addr, 4);
-      mp->host_ip4_prefix.len = (u8) host_ip4_prefix_len;
+      if (unformat (i, "sw_if_index %d", &sw_if_index))
+       sw_if_index_set = 1;
+      else if (unformat (i, "sw_if"))
+       {
+         if (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+           {
+             if (unformat
+                 (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
+               sw_if_index_set = 1;
+           }
+         else
+           break;
+       }
+      else if (unformat (i, "learn"))
+       flags |= L2_LEARN;
+      else if (unformat (i, "forward"))
+       flags |= L2_FWD;
+      else if (unformat (i, "flood"))
+       flags |= L2_FLOOD;
+      else if (unformat (i, "uu-flood"))
+       flags |= L2_UU_FLOOD;
+      else if (unformat (i, "arp-term"))
+       flags |= L2_ARP_TERM;
+      else if (unformat (i, "off"))
+       is_set = 0;
+      else if (unformat (i, "disable"))
+       is_set = 0;
+      else
+       break;
     }
-  if (host_ip6_prefix_set)
+
+  if (sw_if_index_set == 0)
     {
-      clib_memcpy (mp->host_ip6_prefix.address, &host_ip6_addr, 16);
-      mp->host_ip6_prefix.len = (u8) host_ip6_prefix_len;
+      errmsg ("missing interface name or sw_if_index");
+      return -99;
     }
-  if (host_ip4_gw_set)
-    clib_memcpy (mp->host_ip4_gw, &host_ip4_gw, 4);
-  if (host_ip6_gw_set)
-    clib_memcpy (mp->host_ip6_gw, &host_ip6_gw, 16);
 
-  vec_free (host_ns);
-  vec_free (host_if_name);
-  vec_free (host_bridge);
+  M (L2_FLAGS, mp);
 
-  /* send it... */
-  S (mp);
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->feature_bitmap = ntohl (flags);
+  mp->is_set = is_set;
 
-  /* Wait for a reply... */
+  S (mp);
   W (ret);
   return ret;
 }
 
 static int
-api_tap_delete_v2 (vat_main_t * vam)
+api_bridge_flags (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_tap_delete_v2_t *mp;
-  u32 sw_if_index = ~0;
-  u8 sw_if_index_set = 0;
+  vl_api_bridge_flags_t *mp;
+  u32 bd_id;
+  u8 bd_id_set = 0;
+  u8 is_set = 1;
+  bd_flags_t flags = 0;
   int ret;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
+      if (unformat (i, "bd_id %d", &bd_id))
+       bd_id_set = 1;
+      else if (unformat (i, "learn"))
+       flags |= BRIDGE_API_FLAG_LEARN;
+      else if (unformat (i, "forward"))
+       flags |= BRIDGE_API_FLAG_FWD;
+      else if (unformat (i, "flood"))
+       flags |= BRIDGE_API_FLAG_FLOOD;
+      else if (unformat (i, "uu-flood"))
+       flags |= BRIDGE_API_FLAG_UU_FLOOD;
+      else if (unformat (i, "arp-term"))
+       flags |= BRIDGE_API_FLAG_ARP_TERM;
+      else if (unformat (i, "off"))
+       is_set = 0;
+      else if (unformat (i, "disable"))
+       is_set = 0;
       else
        break;
     }
 
-  if (sw_if_index_set == 0)
+  if (bd_id_set == 0)
     {
-      errmsg ("missing vpp interface name. ");
+      errmsg ("missing bridge domain");
       return -99;
     }
 
-  /* Construct the API message */
-  M (TAP_DELETE_V2, mp);
+  M (BRIDGE_FLAGS, mp);
 
-  mp->sw_if_index = ntohl (sw_if_index);
+  mp->bd_id = ntohl (bd_id);
+  mp->flags = ntohl (flags);
+  mp->is_set = is_set;
 
-  /* send it... */
   S (mp);
-
-  /* Wait for a reply... */
   W (ret);
   return ret;
 }
 
-uword
-unformat_vlib_pci_addr (unformat_input_t * input, va_list * args)
+static int
+api_bd_ip_mac_add_del (vat_main_t * vam)
 {
-  vlib_pci_addr_t *addr = va_arg (*args, vlib_pci_addr_t *);
-  u32 x[4];
+  vl_api_address_t ip = VL_API_ZERO_ADDRESS;
+  vl_api_mac_address_t mac = { 0 };
+  unformat_input_t *i = vam->input;
+  vl_api_bd_ip_mac_add_del_t *mp;
+  u32 bd_id;
+  u8 is_add = 1;
+  u8 bd_id_set = 0;
+  u8 ip_set = 0;
+  u8 mac_set = 0;
+  int ret;
+
+
+  /* Parse args required to build the message */
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "bd_id %d", &bd_id))
+       {
+         bd_id_set++;
+       }
+      else if (unformat (i, "%U", unformat_vl_api_address, &ip))
+       {
+         ip_set++;
+       }
+      else if (unformat (i, "%U", unformat_vl_api_mac_address, &mac))
+       {
+         mac_set++;
+       }
+      else if (unformat (i, "del"))
+       is_add = 0;
+      else
+       break;
+    }
+
+  if (bd_id_set == 0)
+    {
+      errmsg ("missing bridge domain");
+      return -99;
+    }
+  else if (ip_set == 0)
+    {
+      errmsg ("missing IP address");
+      return -99;
+    }
+  else if (mac_set == 0)
+    {
+      errmsg ("missing MAC address");
+      return -99;
+    }
 
-  if (!unformat (input, "%x:%x:%x.%x", &x[0], &x[1], &x[2], &x[3]))
-    return 0;
+  M (BD_IP_MAC_ADD_DEL, mp);
 
-  addr->domain = x[0];
-  addr->bus = x[1];
-  addr->slot = x[2];
-  addr->function = x[3];
+  mp->entry.bd_id = ntohl (bd_id);
+  mp->is_add = is_add;
 
-  return 1;
+  clib_memcpy (&mp->entry.ip, &ip, sizeof (ip));
+  clib_memcpy (&mp->entry.mac, &mac, sizeof (mac));
+
+  S (mp);
+  W (ret);
+  return ret;
 }
 
 static int
-api_virtio_pci_create_v2 (vat_main_t * vam)
+api_bd_ip_mac_flush (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_virtio_pci_create_v2_t *mp;
-  u8 mac_address[6];
-  u8 random_mac = 1;
-  u32 pci_addr = 0;
-  u64 features = (u64) ~ (0ULL);
-  u32 virtio_flags = 0;
+  vl_api_bd_ip_mac_flush_t *mp;
+  u32 bd_id;
+  u8 bd_id_set = 0;
   int ret;
 
-  clib_memset (mac_address, 0, sizeof (mac_address));
-
-  /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "hw-addr %U", unformat_ethernet_address, mac_address))
+      if (unformat (i, "bd_id %d", &bd_id))
        {
-         random_mac = 0;
+         bd_id_set++;
        }
-      else if (unformat (i, "pci-addr %U", unformat_vlib_pci_addr, &pci_addr))
-       ;
-      else if (unformat (i, "features 0x%llx", &features))
-       ;
-      else if (unformat (i, "gso-enabled"))
-       virtio_flags |= VIRTIO_API_FLAG_GSO;
-      else if (unformat (i, "csum-offload-enabled"))
-       virtio_flags |= VIRTIO_API_FLAG_CSUM_OFFLOAD;
-      else if (unformat (i, "gro-coalesce"))
-       virtio_flags |= VIRTIO_API_FLAG_GRO_COALESCE;
-      else if (unformat (i, "packed"))
-       virtio_flags |= VIRTIO_API_FLAG_PACKED;
-      else if (unformat (i, "in-order"))
-       virtio_flags |= VIRTIO_API_FLAG_IN_ORDER;
-      else if (unformat (i, "buffering"))
-       virtio_flags |= VIRTIO_API_FLAG_BUFFERING;
       else
        break;
     }
 
-  if (pci_addr == 0)
+  if (bd_id_set == 0)
     {
-      errmsg ("pci address must be non zero. ");
+      errmsg ("missing bridge domain");
       return -99;
     }
 
-  /* Construct the API message */
-  M (VIRTIO_PCI_CREATE_V2, mp);
+  M (BD_IP_MAC_FLUSH, mp);
 
-  mp->use_random_mac = random_mac;
+  mp->bd_id = ntohl (bd_id);
 
-  mp->pci_addr.domain = htons (((vlib_pci_addr_t) pci_addr).domain);
-  mp->pci_addr.bus = ((vlib_pci_addr_t) pci_addr).bus;
-  mp->pci_addr.slot = ((vlib_pci_addr_t) pci_addr).slot;
-  mp->pci_addr.function = ((vlib_pci_addr_t) pci_addr).function;
+  S (mp);
+  W (ret);
+  return ret;
+}
 
-  mp->features = clib_host_to_net_u64 (features);
-  mp->virtio_flags = clib_host_to_net_u32 (virtio_flags);
+static void vl_api_bd_ip_mac_details_t_handler
+  (vl_api_bd_ip_mac_details_t * mp)
+{
+  vat_main_t *vam = &vat_main;
 
-  if (random_mac == 0)
-    clib_memcpy (mp->mac_address, mac_address, 6);
+  print (vam->ofp,
+        "\n%-5d %U %U",
+        ntohl (mp->entry.bd_id),
+        format_vl_api_mac_address, mp->entry.mac,
+        format_vl_api_address, &mp->entry.ip);
+}
 
-  /* send it... */
-  S (mp);
+static void vl_api_bd_ip_mac_details_t_handler_json
+  (vl_api_bd_ip_mac_details_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+  vat_json_node_t *node = NULL;
 
-  /* Wait for a reply... */
-  W (ret);
-  return ret;
+  if (VAT_JSON_ARRAY != vam->json_tree.type)
+    {
+      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
+      vat_json_init_array (&vam->json_tree);
+    }
+  node = vat_json_array_add (&vam->json_tree);
+
+  vat_json_init_object (node);
+  vat_json_object_add_uint (node, "bd_id", ntohl (mp->entry.bd_id));
+  vat_json_object_add_string_copy (node, "mac_address",
+                                  format (0, "%U", format_vl_api_mac_address,
+                                          &mp->entry.mac));
+  u8 *ip = 0;
+
+  ip = format (0, "%U", format_vl_api_address, &mp->entry.ip);
+  vat_json_object_add_string_copy (node, "ip_address", ip);
+  vec_free (ip);
 }
 
 static int
-api_virtio_pci_delete (vat_main_t * vam)
+api_bd_ip_mac_dump (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_virtio_pci_delete_t *mp;
-  u32 sw_if_index = ~0;
-  u8 sw_if_index_set = 0;
+  vl_api_bd_ip_mac_dump_t *mp;
+  vl_api_control_ping_t *mp_ping;
   int ret;
+  u32 bd_id;
+  u8 bd_id_set = 0;
 
-  /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
+      if (unformat (i, "bd_id %d", &bd_id))
+       {
+         bd_id_set++;
+       }
       else
        break;
     }
 
-  if (sw_if_index_set == 0)
-    {
-      errmsg ("missing vpp interface name. ");
-      return -99;
-    }
+  print (vam->ofp,
+        "\n%-5s %-7s %-20s %-30s",
+        "bd_id", "is_ipv6", "mac_address", "ip_address");
 
-  /* Construct the API message */
-  M (VIRTIO_PCI_DELETE, mp);
+  /* Dump Bridge Domain Ip to Mac entries */
+  M (BD_IP_MAC_DUMP, mp);
 
-  mp->sw_if_index = htonl (sw_if_index);
+  if (bd_id_set)
+    mp->bd_id = htonl (bd_id);
+  else
+    mp->bd_id = ~0;
 
-  /* send it... */
   S (mp);
 
-  /* Wait for a reply... */
+  /* Use a control ping for synchronization */
+  MPING (CONTROL_PING, mp_ping);
+  S (mp_ping);
+
   W (ret);
   return ret;
 }
 
 static int
-api_bond_create (vat_main_t * vam)
+api_tap_create_v2 (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_bond_create_t *mp;
+  vl_api_tap_create_v2_t *mp;
   u8 mac_address[6];
-  u8 custom_mac = 0;
-  int ret;
-  u8 mode;
-  u8 lb;
-  u8 mode_is_set = 0;
+  u8 random_mac = 1;
   u32 id = ~0;
-  u8 numa_only = 0;
+  u32 num_rx_queues = 0;
+  u8 *host_if_name = 0;
+  u8 host_if_name_set = 0;
+  u8 *host_ns = 0;
+  u8 host_ns_set = 0;
+  u8 host_mac_addr[6];
+  u8 host_mac_addr_set = 0;
+  u8 *host_bridge = 0;
+  u8 host_bridge_set = 0;
+  u8 host_ip4_prefix_set = 0;
+  u8 host_ip6_prefix_set = 0;
+  ip4_address_t host_ip4_addr;
+  ip4_address_t host_ip4_gw;
+  u8 host_ip4_gw_set = 0;
+  u32 host_ip4_prefix_len = 0;
+  ip6_address_t host_ip6_addr;
+  ip6_address_t host_ip6_gw;
+  u8 host_ip6_gw_set = 0;
+  u32 host_ip6_prefix_len = 0;
+  u32 host_mtu_size = 0;
+  u8 host_mtu_set = 0;
+  u32 tap_flags = 0;
+  int ret;
+  u32 rx_ring_sz = 0, tx_ring_sz = 0;
 
   clib_memset (mac_address, 0, sizeof (mac_address));
-  lb = BOND_LB_L2;
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "mode %U", unformat_bond_mode, &mode))
-       mode_is_set = 1;
-      else if (((mode == BOND_MODE_LACP) || (mode == BOND_MODE_XOR))
-              && unformat (i, "lb %U", unformat_bond_load_balance, &lb))
-       ;
-      else if (unformat (i, "hw-addr %U", unformat_ethernet_address,
-                        mac_address))
-       custom_mac = 1;
-      else if (unformat (i, "numa-only"))
-       numa_only = 1;
-      else if (unformat (i, "id %u", &id))
-       ;
-      else
-       break;
+      if (unformat (i, "id %u", &id))
+       ;
+      else
+       if (unformat
+           (i, "hw-addr %U", unformat_ethernet_address, mac_address))
+       random_mac = 0;
+      else if (unformat (i, "host-if-name %s", &host_if_name))
+       host_if_name_set = 1;
+      else if (unformat (i, "num-rx-queues %u", &num_rx_queues))
+       ;
+      else if (unformat (i, "host-ns %s", &host_ns))
+       host_ns_set = 1;
+      else if (unformat (i, "host-mac-addr %U", unformat_ethernet_address,
+                        host_mac_addr))
+       host_mac_addr_set = 1;
+      else if (unformat (i, "host-bridge %s", &host_bridge))
+       host_bridge_set = 1;
+      else if (unformat (i, "host-ip4-addr %U/%u", unformat_ip4_address,
+                        &host_ip4_addr, &host_ip4_prefix_len))
+       host_ip4_prefix_set = 1;
+      else if (unformat (i, "host-ip6-addr %U/%u", unformat_ip6_address,
+                        &host_ip6_addr, &host_ip6_prefix_len))
+       host_ip6_prefix_set = 1;
+      else if (unformat (i, "host-ip4-gw %U", unformat_ip4_address,
+                        &host_ip4_gw))
+       host_ip4_gw_set = 1;
+      else if (unformat (i, "host-ip6-gw %U", unformat_ip6_address,
+                        &host_ip6_gw))
+       host_ip6_gw_set = 1;
+      else if (unformat (i, "rx-ring-size %u", &rx_ring_sz))
+       ;
+      else if (unformat (i, "tx-ring-size %u", &tx_ring_sz))
+       ;
+      else if (unformat (i, "host-mtu-size %u", &host_mtu_size))
+       host_mtu_set = 1;
+      else if (unformat (i, "no-gso"))
+       tap_flags &= ~TAP_API_FLAG_GSO;
+      else if (unformat (i, "gso"))
+       tap_flags |= TAP_API_FLAG_GSO;
+      else if (unformat (i, "csum-offload"))
+       tap_flags |= TAP_API_FLAG_CSUM_OFFLOAD;
+      else if (unformat (i, "persist"))
+       tap_flags |= TAP_API_FLAG_PERSIST;
+      else if (unformat (i, "attach"))
+       tap_flags |= TAP_API_FLAG_ATTACH;
+      else if (unformat (i, "tun"))
+       tap_flags |= TAP_API_FLAG_TUN;
+      else if (unformat (i, "gro-coalesce"))
+       tap_flags |= TAP_API_FLAG_GRO_COALESCE;
+      else if (unformat (i, "packed"))
+       tap_flags |= TAP_API_FLAG_PACKED;
+      else if (unformat (i, "in-order"))
+       tap_flags |= TAP_API_FLAG_IN_ORDER;
+      else
+       break;
+    }
+
+  if (vec_len (host_if_name) > 63)
+    {
+      errmsg ("tap name too long. ");
+      return -99;
+    }
+  if (vec_len (host_ns) > 63)
+    {
+      errmsg ("host name space too long. ");
+      return -99;
+    }
+  if (vec_len (host_bridge) > 63)
+    {
+      errmsg ("host bridge name too long. ");
+      return -99;
+    }
+  if (host_ip4_prefix_len > 32)
+    {
+      errmsg ("host ip4 prefix length not valid. ");
+      return -99;
+    }
+  if (host_ip6_prefix_len > 128)
+    {
+      errmsg ("host ip6 prefix length not valid. ");
+      return -99;
     }
-
-  if (mode_is_set == 0)
+  if (!is_pow2 (rx_ring_sz))
     {
-      errmsg ("Missing bond mode. ");
+      errmsg ("rx ring size must be power of 2. ");
       return -99;
     }
-
-  /* Construct the API message */
-  M (BOND_CREATE, mp);
-
-  mp->use_custom_mac = custom_mac;
-
-  mp->mode = htonl (mode);
-  mp->lb = htonl (lb);
-  mp->id = htonl (id);
-  mp->numa_only = numa_only;
-
-  if (custom_mac)
-    clib_memcpy (mp->mac_address, mac_address, 6);
-
-  /* send it... */
-  S (mp);
-
-  /* Wait for a reply... */
-  W (ret);
-  return ret;
-}
-
-static int
-api_bond_create2 (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_bond_create2_t *mp;
-  u8 mac_address[6];
-  u8 custom_mac = 0;
-  int ret;
-  u8 mode;
-  u8 lb;
-  u8 mode_is_set = 0;
-  u32 id = ~0;
-  u8 numa_only = 0;
-  u8 gso = 0;
-
-  clib_memset (mac_address, 0, sizeof (mac_address));
-  lb = BOND_LB_L2;
-
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+  if (rx_ring_sz > 32768)
     {
-      if (unformat (i, "mode %U", unformat_bond_mode, &mode))
-       mode_is_set = 1;
-      else if (((mode == BOND_MODE_LACP) || (mode == BOND_MODE_XOR))
-              && unformat (i, "lb %U", unformat_bond_load_balance, &lb))
-       ;
-      else if (unformat (i, "hw-addr %U", unformat_ethernet_address,
-                        mac_address))
-       custom_mac = 1;
-      else if (unformat (i, "numa-only"))
-       numa_only = 1;
-      else if (unformat (i, "gso"))
-       gso = 1;
-      else if (unformat (i, "id %u", &id))
-       ;
-      else
-       break;
+      errmsg ("rx ring size must be 32768 or lower. ");
+      return -99;
     }
-
-  if (mode_is_set == 0)
+  if (!is_pow2 (tx_ring_sz))
+    {
+      errmsg ("tx ring size must be power of 2. ");
+      return -99;
+    }
+  if (tx_ring_sz > 32768)
+    {
+      errmsg ("tx ring size must be 32768 or lower. ");
+      return -99;
+    }
+  if (host_mtu_set && (host_mtu_size < 64 || host_mtu_size > 65355))
     {
-      errmsg ("Missing bond mode. ");
+      errmsg ("host MTU size must be in between 64 and 65355. ");
       return -99;
     }
 
   /* Construct the API message */
-  M (BOND_CREATE2, mp);
-
-  mp->use_custom_mac = custom_mac;
+  M (TAP_CREATE_V2, mp);
 
-  mp->mode = htonl (mode);
-  mp->lb = htonl (lb);
-  mp->id = htonl (id);
-  mp->numa_only = numa_only;
-  mp->enable_gso = gso;
+  mp->id = ntohl (id);
+  mp->use_random_mac = random_mac;
+  mp->num_rx_queues = (u8) num_rx_queues;
+  mp->tx_ring_sz = ntohs (tx_ring_sz);
+  mp->rx_ring_sz = ntohs (rx_ring_sz);
+  mp->host_mtu_set = host_mtu_set;
+  mp->host_mtu_size = ntohl (host_mtu_size);
+  mp->host_mac_addr_set = host_mac_addr_set;
+  mp->host_ip4_prefix_set = host_ip4_prefix_set;
+  mp->host_ip6_prefix_set = host_ip6_prefix_set;
+  mp->host_ip4_gw_set = host_ip4_gw_set;
+  mp->host_ip6_gw_set = host_ip6_gw_set;
+  mp->tap_flags = ntohl (tap_flags);
+  mp->host_namespace_set = host_ns_set;
+  mp->host_if_name_set = host_if_name_set;
+  mp->host_bridge_set = host_bridge_set;
 
-  if (custom_mac)
+  if (random_mac == 0)
     clib_memcpy (mp->mac_address, mac_address, 6);
+  if (host_mac_addr_set)
+    clib_memcpy (mp->host_mac_addr, host_mac_addr, 6);
+  if (host_if_name_set)
+    clib_memcpy (mp->host_if_name, host_if_name, vec_len (host_if_name));
+  if (host_ns_set)
+    clib_memcpy (mp->host_namespace, host_ns, vec_len (host_ns));
+  if (host_bridge_set)
+    clib_memcpy (mp->host_bridge, host_bridge, vec_len (host_bridge));
+  if (host_ip4_prefix_set)
+    {
+      clib_memcpy (mp->host_ip4_prefix.address, &host_ip4_addr, 4);
+      mp->host_ip4_prefix.len = (u8) host_ip4_prefix_len;
+    }
+  if (host_ip6_prefix_set)
+    {
+      clib_memcpy (mp->host_ip6_prefix.address, &host_ip6_addr, 16);
+      mp->host_ip6_prefix.len = (u8) host_ip6_prefix_len;
+    }
+  if (host_ip4_gw_set)
+    clib_memcpy (mp->host_ip4_gw, &host_ip4_gw, 4);
+  if (host_ip6_gw_set)
+    clib_memcpy (mp->host_ip6_gw, &host_ip6_gw, 16);
+
+  vec_free (host_ns);
+  vec_free (host_if_name);
+  vec_free (host_bridge);
 
   /* send it... */
   S (mp);
@@ -4894,10 +4171,10 @@ api_bond_create2 (vat_main_t * vam)
 }
 
 static int
-api_bond_delete (vat_main_t * vam)
+api_tap_delete_v2 (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_bond_delete_t *mp;
+  vl_api_tap_delete_v2_t *mp;
   u32 sw_if_index = ~0;
   u8 sw_if_index_set = 0;
   int ret;
@@ -4920,7 +4197,7 @@ api_bond_delete (vat_main_t * vam)
     }
 
   /* Construct the API message */
-  M (BOND_DELETE, mp);
+  M (TAP_DELETE_V2, mp);
 
   mp->sw_if_index = ntohl (sw_if_index);
 
@@ -4932,52 +4209,85 @@ api_bond_delete (vat_main_t * vam)
   return ret;
 }
 
+uword
+unformat_vlib_pci_addr (unformat_input_t * input, va_list * args)
+{
+  vlib_pci_addr_t *addr = va_arg (*args, vlib_pci_addr_t *);
+  u32 x[4];
+
+  if (!unformat (input, "%x:%x:%x.%x", &x[0], &x[1], &x[2], &x[3]))
+    return 0;
+
+  addr->domain = x[0];
+  addr->bus = x[1];
+  addr->slot = x[2];
+  addr->function = x[3];
+
+  return 1;
+}
+
 static int
-api_bond_add_member (vat_main_t * vam)
+api_virtio_pci_create_v2 (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_bond_add_member_t *mp;
-  u32 bond_sw_if_index;
+  vl_api_virtio_pci_create_v2_t *mp;
+  u8 mac_address[6];
+  u8 random_mac = 1;
+  u32 pci_addr = 0;
+  u64 features = (u64) ~ (0ULL);
+  u32 virtio_flags = 0;
   int ret;
-  u8 is_passive;
-  u8 is_long_timeout;
-  u32 bond_sw_if_index_is_set = 0;
-  u32 sw_if_index;
-  u8 sw_if_index_is_set = 0;
+
+  clib_memset (mac_address, 0, sizeof (mac_address));
 
   /* Parse args required to build the message */
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_is_set = 1;
-      else if (unformat (i, "bond %u", &bond_sw_if_index))
-       bond_sw_if_index_is_set = 1;
-      else if (unformat (i, "passive %d", &is_passive))
+      if (unformat (i, "hw-addr %U", unformat_ethernet_address, mac_address))
+       {
+         random_mac = 0;
+       }
+      else if (unformat (i, "pci-addr %U", unformat_vlib_pci_addr, &pci_addr))
        ;
-      else if (unformat (i, "long-timeout %d", &is_long_timeout))
+      else if (unformat (i, "features 0x%llx", &features))
        ;
+      else if (unformat (i, "gso-enabled"))
+       virtio_flags |= VIRTIO_API_FLAG_GSO;
+      else if (unformat (i, "csum-offload-enabled"))
+       virtio_flags |= VIRTIO_API_FLAG_CSUM_OFFLOAD;
+      else if (unformat (i, "gro-coalesce"))
+       virtio_flags |= VIRTIO_API_FLAG_GRO_COALESCE;
+      else if (unformat (i, "packed"))
+       virtio_flags |= VIRTIO_API_FLAG_PACKED;
+      else if (unformat (i, "in-order"))
+       virtio_flags |= VIRTIO_API_FLAG_IN_ORDER;
+      else if (unformat (i, "buffering"))
+       virtio_flags |= VIRTIO_API_FLAG_BUFFERING;
       else
        break;
     }
 
-  if (bond_sw_if_index_is_set == 0)
-    {
-      errmsg ("Missing bond sw_if_index. ");
-      return -99;
-    }
-  if (sw_if_index_is_set == 0)
+  if (pci_addr == 0)
     {
-      errmsg ("Missing member sw_if_index. ");
+      errmsg ("pci address must be non zero. ");
       return -99;
     }
 
   /* Construct the API message */
-  M (BOND_ADD_MEMBER, mp);
+  M (VIRTIO_PCI_CREATE_V2, mp);
 
-  mp->bond_sw_if_index = ntohl (bond_sw_if_index);
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->is_long_timeout = is_long_timeout;
-  mp->is_passive = is_passive;
+  mp->use_random_mac = random_mac;
+
+  mp->pci_addr.domain = htons (((vlib_pci_addr_t) pci_addr).domain);
+  mp->pci_addr.bus = ((vlib_pci_addr_t) pci_addr).bus;
+  mp->pci_addr.slot = ((vlib_pci_addr_t) pci_addr).slot;
+  mp->pci_addr.function = ((vlib_pci_addr_t) pci_addr).function;
+
+  mp->features = clib_host_to_net_u64 (features);
+  mp->virtio_flags = clib_host_to_net_u32 (virtio_flags);
+
+  if (random_mac == 0)
+    clib_memcpy (mp->mac_address, mac_address, 6);
 
   /* send it... */
   S (mp);
@@ -4988,10 +4298,10 @@ api_bond_add_member (vat_main_t * vam)
 }
 
 static int
-api_bond_detach_member (vat_main_t * vam)
+api_virtio_pci_delete (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_bond_detach_member_t *mp;
+  vl_api_virtio_pci_delete_t *mp;
   u32 sw_if_index = ~0;
   u8 sw_if_index_set = 0;
   int ret;
@@ -5014,9 +4324,9 @@ api_bond_detach_member (vat_main_t * vam)
     }
 
   /* Construct the API message */
-  M (BOND_DETACH_MEMBER, mp);
+  M (VIRTIO_PCI_DELETE, mp);
 
-  mp->sw_if_index = ntohl (sw_if_index);
+  mp->sw_if_index = htonl (sw_if_index);
 
   /* send it... */
   S (mp);
@@ -5685,129 +4995,25 @@ api_mpls_ip_bind_unbind (vat_main_t * vam)
     }
 
   if (!prefix_set)
-    {
-      errmsg ("IP prefix not set");
-      return -99;
-    }
-
-  if (MPLS_LABEL_INVALID == local_label)
-    {
-      errmsg ("missing label");
-      return -99;
-    }
-
-  /* Construct the API message */
-  M (MPLS_IP_BIND_UNBIND, mp);
-
-  mp->mb_is_bind = is_bind;
-  mp->mb_ip_table_id = ntohl (ip_table_id);
-  mp->mb_mpls_table_id = 0;
-  mp->mb_label = ntohl (local_label);
-  clib_memcpy (&mp->mb_prefix, &pfx, sizeof (pfx));
-
-  /* send it... */
-  S (mp);
-
-  /* Wait for a reply... */
-  W (ret);
-  return ret;
-  return (0);
-}
-
-static int
-api_sr_mpls_policy_add (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_sr_mpls_policy_add_t *mp;
-  u32 bsid = 0;
-  u32 weight = 1;
-  u8 type = 0;
-  u8 n_segments = 0;
-  u32 sid;
-  u32 *segments = NULL;
-  int ret;
-
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "bsid %d", &bsid))
-       ;
-      else if (unformat (i, "weight %d", &weight))
-       ;
-      else if (unformat (i, "spray"))
-       type = 1;
-      else if (unformat (i, "next %d", &sid))
-       {
-         n_segments += 1;
-         vec_add1 (segments, htonl (sid));
-       }
-      else
-       {
-         clib_warning ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  if (bsid == 0)
-    {
-      errmsg ("bsid not set");
-      return -99;
-    }
-
-  if (n_segments == 0)
-    {
-      errmsg ("no sid in segment stack");
-      return -99;
-    }
-
-  /* Construct the API message */
-  M2 (SR_MPLS_POLICY_ADD, mp, sizeof (u32) * n_segments);
-
-  mp->bsid = htonl (bsid);
-  mp->weight = htonl (weight);
-  mp->is_spray = type;
-  mp->n_segments = n_segments;
-  memcpy (mp->segments, segments, sizeof (u32) * n_segments);
-  vec_free (segments);
-
-  /* send it... */
-  S (mp);
-
-  /* Wait for a reply... */
-  W (ret);
-  return ret;
-}
-
-static int
-api_sr_mpls_policy_del (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_sr_mpls_policy_del_t *mp;
-  u32 bsid = 0;
-  int ret;
-
-  /* Parse args required to build the message */
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "bsid %d", &bsid))
-       ;
-      else
-       {
-         clib_warning ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
+    {
+      errmsg ("IP prefix not set");
+      return -99;
     }
 
-  if (bsid == 0)
+  if (MPLS_LABEL_INVALID == local_label)
     {
-      errmsg ("bsid not set");
+      errmsg ("missing label");
       return -99;
     }
 
   /* Construct the API message */
-  M (SR_MPLS_POLICY_DEL, mp);
+  M (MPLS_IP_BIND_UNBIND, mp);
 
-  mp->bsid = htonl (bsid);
+  mp->mb_is_bind = is_bind;
+  mp->mb_ip_table_id = ntohl (ip_table_id);
+  mp->mb_mpls_table_id = 0;
+  mp->mb_label = ntohl (local_label);
+  clib_memcpy (&mp->mb_prefix, &pfx, sizeof (pfx));
 
   /* send it... */
   S (mp);
@@ -5815,6 +5021,7 @@ api_sr_mpls_policy_del (vat_main_t * vam)
   /* Wait for a reply... */
   W (ret);
   return ret;
+  return (0);
 }
 
 static int
@@ -6346,59 +5553,6 @@ u32 vlan_index;
 u32 fib_table;
 u8 nh_addr[16];
 
-static int
-api_sr_localsid_add_del (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_sr_localsid_add_del_t *mp;
-
-  u8 is_del;
-  ip6_address_t localsid;
-  u8 end_psp = 0;
-  u8 behavior = ~0;
-  u32 sw_if_index;
-  u32 fib_table = ~(u32) 0;
-  ip46_address_t nh_addr;
-  clib_memset (&nh_addr, 0, sizeof (ip46_address_t));
-
-  bool nexthop_set = 0;
-
-  int ret;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "del"))
-       is_del = 1;
-      else if (unformat (i, "address %U", unformat_ip6_address, &localsid));
-      else if (unformat (i, "next-hop %U", unformat_ip46_address, &nh_addr))
-       nexthop_set = 1;
-      else if (unformat (i, "behavior %u", &behavior));
-      else if (unformat (i, "sw_if_index %u", &sw_if_index));
-      else if (unformat (i, "fib-table %u", &fib_table));
-      else if (unformat (i, "end.psp %u", &behavior));
-      else
-       break;
-    }
-
-  M (SR_LOCALSID_ADD_DEL, mp);
-
-  clib_memcpy (mp->localsid, &localsid, sizeof (mp->localsid));
-
-  if (nexthop_set)
-    {
-      clib_memcpy (&mp->nh_addr.un, &nh_addr, sizeof (mp->nh_addr.un));
-    }
-  mp->behavior = behavior;
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->fib_table = ntohl (fib_table);
-  mp->end_psp = end_psp;
-  mp->is_del = is_del;
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
 static int
 api_ioam_enable (vat_main_t * vam)
 {
@@ -8675,403 +7829,6 @@ api_ip_dump (vat_main_t * vam)
   return ret;
 }
 
-static int
-api_ipsec_spd_add_del (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ipsec_spd_add_del_t *mp;
-  u32 spd_id = ~0;
-  u8 is_add = 1;
-  int ret;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "spd_id %d", &spd_id))
-       ;
-      else if (unformat (i, "del"))
-       is_add = 0;
-      else
-       {
-         clib_warning ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-  if (spd_id == ~0)
-    {
-      errmsg ("spd_id must be set");
-      return -99;
-    }
-
-  M (IPSEC_SPD_ADD_DEL, mp);
-
-  mp->spd_id = ntohl (spd_id);
-  mp->is_add = is_add;
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ipsec_interface_add_del_spd (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ipsec_interface_add_del_spd_t *mp;
-  u32 sw_if_index;
-  u8 sw_if_index_set = 0;
-  u32 spd_id = (u32) ~ 0;
-  u8 is_add = 1;
-  int ret;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "del"))
-       is_add = 0;
-      else if (unformat (i, "spd_id %d", &spd_id))
-       ;
-      else
-       if (unformat (i, "%U", api_unformat_sw_if_index, vam, &sw_if_index))
-       sw_if_index_set = 1;
-      else if (unformat (i, "sw_if_index %d", &sw_if_index))
-       sw_if_index_set = 1;
-      else
-       {
-         clib_warning ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-
-    }
-
-  if (spd_id == (u32) ~ 0)
-    {
-      errmsg ("spd_id must be set");
-      return -99;
-    }
-
-  if (sw_if_index_set == 0)
-    {
-      errmsg ("missing interface name or sw_if_index");
-      return -99;
-    }
-
-  M (IPSEC_INTERFACE_ADD_DEL_SPD, mp);
-
-  mp->spd_id = ntohl (spd_id);
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->is_add = is_add;
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ipsec_spd_entry_add_del (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ipsec_spd_entry_add_del_t *mp;
-  u8 is_add = 1, is_outbound = 0;
-  u32 spd_id = 0, sa_id = 0, protocol = 0, policy = 0;
-  i32 priority = 0;
-  u32 rport_start = 0, rport_stop = (u32) ~ 0;
-  u32 lport_start = 0, lport_stop = (u32) ~ 0;
-  vl_api_address_t laddr_start = { }, laddr_stop =
-  {
-  }, raddr_start =
-  {
-  }, raddr_stop =
-  {
-  };
-  int ret;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "del"))
-       is_add = 0;
-      if (unformat (i, "outbound"))
-       is_outbound = 1;
-      if (unformat (i, "inbound"))
-       is_outbound = 0;
-      else if (unformat (i, "spd_id %d", &spd_id))
-       ;
-      else if (unformat (i, "sa_id %d", &sa_id))
-       ;
-      else if (unformat (i, "priority %d", &priority))
-       ;
-      else if (unformat (i, "protocol %d", &protocol))
-       ;
-      else if (unformat (i, "lport_start %d", &lport_start))
-       ;
-      else if (unformat (i, "lport_stop %d", &lport_stop))
-       ;
-      else if (unformat (i, "rport_start %d", &rport_start))
-       ;
-      else if (unformat (i, "rport_stop %d", &rport_stop))
-       ;
-      else if (unformat (i, "laddr_start %U",
-                        unformat_vl_api_address, &laddr_start))
-       ;
-      else if (unformat (i, "laddr_stop %U", unformat_vl_api_address,
-                        &laddr_stop))
-       ;
-      else if (unformat (i, "raddr_start %U", unformat_vl_api_address,
-                        &raddr_start))
-       ;
-      else if (unformat (i, "raddr_stop %U", unformat_vl_api_address,
-                        &raddr_stop))
-       ;
-      else
-       if (unformat (i, "action %U", unformat_ipsec_policy_action, &policy))
-       {
-         if (policy == IPSEC_POLICY_ACTION_RESOLVE)
-           {
-             clib_warning ("unsupported action: 'resolve'");
-             return -99;
-           }
-       }
-      else
-       {
-         clib_warning ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-
-    }
-
-  M (IPSEC_SPD_ENTRY_ADD_DEL, mp);
-
-  mp->is_add = is_add;
-
-  mp->entry.spd_id = ntohl (spd_id);
-  mp->entry.priority = ntohl (priority);
-  mp->entry.is_outbound = is_outbound;
-
-  clib_memcpy (&mp->entry.remote_address_start, &raddr_start,
-              sizeof (vl_api_address_t));
-  clib_memcpy (&mp->entry.remote_address_stop, &raddr_stop,
-              sizeof (vl_api_address_t));
-  clib_memcpy (&mp->entry.local_address_start, &laddr_start,
-              sizeof (vl_api_address_t));
-  clib_memcpy (&mp->entry.local_address_stop, &laddr_stop,
-              sizeof (vl_api_address_t));
-
-  mp->entry.protocol = (u8) protocol;
-  mp->entry.local_port_start = ntohs ((u16) lport_start);
-  mp->entry.local_port_stop = ntohs ((u16) lport_stop);
-  mp->entry.remote_port_start = ntohs ((u16) rport_start);
-  mp->entry.remote_port_stop = ntohs ((u16) rport_stop);
-  mp->entry.policy = (u8) policy;
-  mp->entry.sa_id = ntohl (sa_id);
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ipsec_sad_entry_add_del (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ipsec_sad_entry_add_del_t *mp;
-  u32 sad_id = 0, spi = 0;
-  u8 *ck = 0, *ik = 0;
-  u8 is_add = 1;
-
-  vl_api_ipsec_crypto_alg_t crypto_alg = IPSEC_API_CRYPTO_ALG_NONE;
-  vl_api_ipsec_integ_alg_t integ_alg = IPSEC_API_INTEG_ALG_NONE;
-  vl_api_ipsec_sad_flags_t flags = IPSEC_API_SAD_FLAG_NONE;
-  vl_api_ipsec_proto_t protocol = IPSEC_API_PROTO_AH;
-  vl_api_address_t tun_src, tun_dst;
-  int ret;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "del"))
-       is_add = 0;
-      else if (unformat (i, "sad_id %d", &sad_id))
-       ;
-      else if (unformat (i, "spi %d", &spi))
-       ;
-      else if (unformat (i, "esp"))
-       protocol = IPSEC_API_PROTO_ESP;
-      else
-       if (unformat (i, "tunnel_src %U", unformat_vl_api_address, &tun_src))
-       {
-         flags |= IPSEC_API_SAD_FLAG_IS_TUNNEL;
-         if (ADDRESS_IP6 == tun_src.af)
-           flags |= IPSEC_API_SAD_FLAG_IS_TUNNEL_V6;
-       }
-      else
-       if (unformat (i, "tunnel_dst %U", unformat_vl_api_address, &tun_dst))
-       {
-         flags |= IPSEC_API_SAD_FLAG_IS_TUNNEL;
-         if (ADDRESS_IP6 == tun_src.af)
-           flags |= IPSEC_API_SAD_FLAG_IS_TUNNEL_V6;
-       }
-      else
-       if (unformat (i, "crypto_alg %U",
-                     unformat_ipsec_api_crypto_alg, &crypto_alg))
-       ;
-      else if (unformat (i, "crypto_key %U", unformat_hex_string, &ck))
-       ;
-      else if (unformat (i, "integ_alg %U",
-                        unformat_ipsec_api_integ_alg, &integ_alg))
-       ;
-      else if (unformat (i, "integ_key %U", unformat_hex_string, &ik))
-       ;
-      else
-       {
-         clib_warning ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-
-    }
-
-  M (IPSEC_SAD_ENTRY_ADD_DEL, mp);
-
-  mp->is_add = is_add;
-  mp->entry.sad_id = ntohl (sad_id);
-  mp->entry.protocol = protocol;
-  mp->entry.spi = ntohl (spi);
-  mp->entry.flags = flags;
-
-  mp->entry.crypto_algorithm = crypto_alg;
-  mp->entry.integrity_algorithm = integ_alg;
-  mp->entry.crypto_key.length = vec_len (ck);
-  mp->entry.integrity_key.length = vec_len (ik);
-
-  if (mp->entry.crypto_key.length > sizeof (mp->entry.crypto_key.data))
-    mp->entry.crypto_key.length = sizeof (mp->entry.crypto_key.data);
-
-  if (mp->entry.integrity_key.length > sizeof (mp->entry.integrity_key.data))
-    mp->entry.integrity_key.length = sizeof (mp->entry.integrity_key.data);
-
-  if (ck)
-    clib_memcpy (mp->entry.crypto_key.data, ck, mp->entry.crypto_key.length);
-  if (ik)
-    clib_memcpy (mp->entry.integrity_key.data, ik,
-                mp->entry.integrity_key.length);
-
-  if (flags & IPSEC_API_SAD_FLAG_IS_TUNNEL)
-    {
-      clib_memcpy (&mp->entry.tunnel_src, &tun_src,
-                  sizeof (mp->entry.tunnel_src));
-      clib_memcpy (&mp->entry.tunnel_dst, &tun_dst,
-                  sizeof (mp->entry.tunnel_dst));
-    }
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static void
-vl_api_ipsec_sa_details_t_handler (vl_api_ipsec_sa_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-
-  print (vam->ofp, "sa_id %u sw_if_index %u spi %u proto %u crypto_alg %u "
-        "crypto_key %U integ_alg %u integ_key %U flags %x "
-        "tunnel_src_addr %U tunnel_dst_addr %U "
-        "salt %u seq_outbound %lu last_seq_inbound %lu "
-        "replay_window %lu stat_index %u\n",
-        ntohl (mp->entry.sad_id),
-        ntohl (mp->sw_if_index),
-        ntohl (mp->entry.spi),
-        ntohl (mp->entry.protocol),
-        ntohl (mp->entry.crypto_algorithm),
-        format_hex_bytes, mp->entry.crypto_key.data,
-        mp->entry.crypto_key.length, ntohl (mp->entry.integrity_algorithm),
-        format_hex_bytes, mp->entry.integrity_key.data,
-        mp->entry.integrity_key.length, ntohl (mp->entry.flags),
-        format_vl_api_address, &mp->entry.tunnel_src, format_vl_api_address,
-        &mp->entry.tunnel_dst, ntohl (mp->salt),
-        clib_net_to_host_u64 (mp->seq_outbound),
-        clib_net_to_host_u64 (mp->last_seq_inbound),
-        clib_net_to_host_u64 (mp->replay_window), ntohl (mp->stat_index));
-}
-
-#define vl_api_ipsec_sa_details_t_endian vl_noop_handler
-#define vl_api_ipsec_sa_details_t_print vl_noop_handler
-
-static void vl_api_ipsec_sa_details_t_handler_json
-  (vl_api_ipsec_sa_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t *node = NULL;
-  vl_api_ipsec_sad_flags_t flags;
-
-  if (VAT_JSON_ARRAY != vam->json_tree.type)
-    {
-      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
-      vat_json_init_array (&vam->json_tree);
-    }
-  node = vat_json_array_add (&vam->json_tree);
-
-  vat_json_init_object (node);
-  vat_json_object_add_uint (node, "sa_id", ntohl (mp->entry.sad_id));
-  vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
-  vat_json_object_add_uint (node, "spi", ntohl (mp->entry.spi));
-  vat_json_object_add_uint (node, "proto", ntohl (mp->entry.protocol));
-  vat_json_object_add_uint (node, "crypto_alg",
-                           ntohl (mp->entry.crypto_algorithm));
-  vat_json_object_add_uint (node, "integ_alg",
-                           ntohl (mp->entry.integrity_algorithm));
-  flags = ntohl (mp->entry.flags);
-  vat_json_object_add_uint (node, "use_esn",
-                           ! !(flags & IPSEC_API_SAD_FLAG_USE_ESN));
-  vat_json_object_add_uint (node, "use_anti_replay",
-                           ! !(flags & IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY));
-  vat_json_object_add_uint (node, "is_tunnel",
-                           ! !(flags & IPSEC_API_SAD_FLAG_IS_TUNNEL));
-  vat_json_object_add_uint (node, "is_tunnel_ip6",
-                           ! !(flags & IPSEC_API_SAD_FLAG_IS_TUNNEL_V6));
-  vat_json_object_add_uint (node, "udp_encap",
-                           ! !(flags & IPSEC_API_SAD_FLAG_UDP_ENCAP));
-  vat_json_object_add_bytes (node, "crypto_key", mp->entry.crypto_key.data,
-                            mp->entry.crypto_key.length);
-  vat_json_object_add_bytes (node, "integ_key", mp->entry.integrity_key.data,
-                            mp->entry.integrity_key.length);
-  vat_json_object_add_address (node, "src", &mp->entry.tunnel_src);
-  vat_json_object_add_address (node, "dst", &mp->entry.tunnel_dst);
-  vat_json_object_add_uint (node, "replay_window",
-                           clib_net_to_host_u64 (mp->replay_window));
-  vat_json_object_add_uint (node, "stat_index", ntohl (mp->stat_index));
-}
-
-static int
-api_ipsec_sa_dump (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ipsec_sa_dump_t *mp;
-  vl_api_control_ping_t *mp_ping;
-  u32 sa_id = ~0;
-  int ret;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "sa_id %d", &sa_id))
-       ;
-      else
-       {
-         clib_warning ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  M (IPSEC_SA_DUMP, mp);
-
-  mp->sa_id = ntohl (sa_id);
-
-  S (mp);
-
-  /* Use a control ping for synchronization */
-  M (CONTROL_PING, mp_ping);
-  S (mp_ping);
-
-  W (ret);
-  return ret;
-}
-
 static int
 api_get_first_msg_id (vat_main_t * vam)
 {
@@ -11576,24 +10333,6 @@ _(virtio_pci_create_v2,                                                    \
 _(virtio_pci_delete,                                                    \
   "<vpp-if-name> | sw_if_index <id>")                                   \
 _(sw_interface_virtio_pci_dump, "")                                     \
-_(bond_create,                                                          \
-  "[hw-addr <mac-addr>] {round-robin | active-backup | "                \
-  "broadcast | {lacp | xor} [load-balance { l2 | l23 | l34 }]} "        \
-  "[id <if-id>]")                                                      \
-_(bond_create2,                                                         \
-  "[hw-addr <mac-addr>] {mode round-robin | active-backup | "           \
-  "broadcast | {lacp | xor} [load-balance { l2 | l23 | l34 }]} "        \
-  "[id <if-id>] [gso]")                                                        \
-_(bond_delete,                                                          \
-  "<vpp-if-name> | sw_if_index <id>")                                   \
-_(bond_add_member,                                                      \
-  "sw_if_index <n> bond <sw_if_index> [is_passive] [is_long_timeout]")  \
-_(bond_detach_member,                                                   \
-  "sw_if_index <n>")                                                   \
- _(sw_interface_set_bond_weight, "<intfc> | sw_if_index <nn> weight <value>") \
- _(sw_bond_interface_dump, "<intfc> | sw_if_index <nn>")               \
- _(sw_member_interface_dump,                                           \
-  "<vpp-if-name> | sw_if_index <id>")                                   \
 _(ip_table_add_del,                                                     \
   "table <n> [ipv6] [add | del]\n")                                     \
 _(ip_route_add_del,                                                     \
@@ -11619,10 +10358,6 @@ _(mpls_tunnel_add_del,                                                  \
   "[add | del <intfc | sw_if_index <id>>] via <addr | via-label <n>>\n" \
   "[<intfc> | sw_if_index <id> | next-hop-table <id>]\n"                \
   "[l2-only]  [out-label <n>]")                                         \
-_(sr_mpls_policy_add,                                                   \
-  "bsid <id> [weight <n>] [spray] next <sid> [next <sid>]")             \
-_(sr_mpls_policy_del,                                                   \
-  "bsid <id>")                                                          \
 _(sw_interface_set_unnumbered,                                          \
   "<intfc> | sw_if_index <id> unnum_if_index <id> [del]")               \
 _(create_vlan_subif, "<intfc> | sw_if_index <id> vlan <n>")             \
@@ -11640,9 +10375,6 @@ _(sw_interface_ip6_enable_disable,                                      \
 _(l2_patch_add_del,                                                     \
   "rx <intfc> | rx_sw_if_index <id> tx <intfc> | tx_sw_if_index <id>\n" \
   "enable | disable")                                                   \
-_(sr_localsid_add_del,                                                  \
-  "(del) address <addr> next_hop <addr> behavior <beh>\n"               \
-  "fib-table <num> (end.psp) sw_if_index <num>")                        \
 _(get_node_index, "node <node-name")                                    \
 _(add_node_next, "node <node-name> next <next-node-name>")              \
 _(l2_fib_clear_table, "")                                               \
@@ -11675,17 +10407,6 @@ _(interface_name_renumber,                                              \
 _(want_l2_macs_events, "[disable] [learn-limit <n>] [scan-delay <n>] [max-entries <n>]") \
 _(ip_address_dump, "(ipv4 | ipv6) (<intfc> | sw_if_index <id>)")        \
 _(ip_dump, "ipv4 | ipv6")                                               \
-_(ipsec_spd_add_del, "spd_id <n> [del]")                                \
-_(ipsec_interface_add_del_spd, "(<intfc> | sw_if_index <id>)\n"         \
-  "  spid_id <n> ")                                                     \
-_(ipsec_sad_entry_add_del, "sad_id <n> spi <n> crypto_alg <alg>\n"      \
-  "  crypto_key <hex> tunnel_src <ip4|ip6> tunnel_dst <ip4|ip6>\n"      \
-  "  integ_alg <alg> integ_key <hex>")                                  \
-_(ipsec_spd_entry_add_del, "spd_id <n> priority <n> action <action>\n"  \
-  "  (inbound|outbound) [sa_id <n>] laddr_start <ip4|ip6>\n"            \
-  "  laddr_stop <ip4|ip6> raddr_start <ip4|ip6> raddr_stop <ip4|ip6>\n" \
-  "  [lport_start <n> lport_stop <n>] [rport_start <n> rport_stop <n>]" ) \
-_(ipsec_sa_dump, "[sa_id <n>]")                                         \
 _(delete_loopback,"sw_if_index <nn>")                                   \
 _(bd_ip_mac_add_del, "bd_id <bridge-domain-id> <ip4/6-addr> <mac-addr> [del]") \
 _(bd_ip_mac_flush, "bd_id <bridge-domain-id>")                          \