GRE: API update
[vpp.git] / src / vat / api_format.c
index d35c19e..bff8156 100644 (file)
@@ -41,7 +41,6 @@
 #include <vnet/classify/flow_classify.h>
 #include <vnet/mpls/mpls.h>
 #include <vnet/ipsec/ipsec.h>
-#include <vnet/ipsec/ikev2.h>
 #include <inttypes.h>
 #include <vnet/cop/cop.h>
 #include <vnet/ip/ip6_hop_by_hop.h>
@@ -395,33 +394,6 @@ format_ipsec_integ_alg (u8 * s, va_list * args)
   return format (s, "%s", t);
 }
 
-uword
-unformat_ikev2_auth_method (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 = IKEV2_AUTH_METHOD_##f;
-  foreach_ikev2_auth_method
-#undef _
-    else
-    return 0;
-  return 1;
-}
-
-uword
-unformat_ikev2_id_type (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 = IKEV2_ID_TYPE_##f;
-  foreach_ikev2_id_type
-#undef _
-    else
-    return 0;
-  return 1;
-}
 #else /* VPP_API_TEST_BUILTIN == 1 */
 static uword
 api_unformat_sw_if_index (unformat_input_t * input, va_list * args)
@@ -740,6 +712,25 @@ increment_v4_address (ip4_address_t * a)
   a->as_u32 = ntohl (v);
 }
 
+static void
+increment_vl_v4_address (vl_api_ip4_address_t * a)
+{
+  u32 v;
+
+  v = *(u32 *) a;
+  v = ntohl (v);
+  v++;
+  v = ntohl (v);
+  clib_memcpy (a, &v, sizeof (v));
+}
+
+static void
+increment_vl_address (vl_api_address_t * a)
+{
+  if (ADDRESS_IP4 == a->af)
+    increment_vl_v4_address (&a->un.ip4);
+}
+
 static void
 increment_v6_address (ip6_address_t * a)
 {
@@ -2475,8 +2466,8 @@ static void vl_api_vxlan_gpe_add_del_tunnel_reply_t_handler_json
   vam->result_ready = 1;
 }
 
-static void vl_api_gre_add_del_tunnel_reply_t_handler
-  (vl_api_gre_add_del_tunnel_reply_t * mp)
+static void vl_api_gre_tunnel_add_del_reply_t_handler
+  (vl_api_gre_tunnel_add_del_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
@@ -2492,8 +2483,8 @@ static void vl_api_gre_add_del_tunnel_reply_t_handler
     }
 }
 
-static void vl_api_gre_add_del_tunnel_reply_t_handler_json
-  (vl_api_gre_add_del_tunnel_reply_t * mp)
+static void vl_api_gre_tunnel_add_del_reply_t_handler_json
+  (vl_api_gre_tunnel_add_del_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
@@ -5058,8 +5049,8 @@ static void vl_api_policer_classify_details_t_handler_json
   vat_json_object_add_uint (node, "table_index", ntohl (mp->table_index));
 }
 
-static void vl_api_ipsec_gre_add_del_tunnel_reply_t_handler
-  (vl_api_ipsec_gre_add_del_tunnel_reply_t * mp)
+static void vl_api_ipsec_gre_tunnel_add_del_reply_t_handler
+  (vl_api_ipsec_gre_tunnel_add_del_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
@@ -5076,8 +5067,8 @@ static void vl_api_ipsec_gre_add_del_tunnel_reply_t_handler
   vam->regenerate_interface_table = 1;
 }
 
-static void vl_api_ipsec_gre_add_del_tunnel_reply_t_handler_json
-  (vl_api_ipsec_gre_add_del_tunnel_reply_t * mp)
+static void vl_api_ipsec_gre_tunnel_add_del_reply_t_handler_json
+  (vl_api_ipsec_gre_tunnel_add_del_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
@@ -5214,19 +5205,6 @@ _(ipsec_sa_set_key_reply)                               \
 _(ipsec_tunnel_if_add_del_reply)                        \
 _(ipsec_tunnel_if_set_key_reply)                        \
 _(ipsec_tunnel_if_set_sa_reply)                         \
-_(ikev2_profile_add_del_reply)                          \
-_(ikev2_profile_set_auth_reply)                         \
-_(ikev2_profile_set_id_reply)                           \
-_(ikev2_profile_set_ts_reply)                           \
-_(ikev2_set_local_key_reply)                            \
-_(ikev2_set_responder_reply)                            \
-_(ikev2_set_ike_transforms_reply)                       \
-_(ikev2_set_esp_transforms_reply)                       \
-_(ikev2_set_sa_lifetime_reply)                          \
-_(ikev2_initiate_sa_init_reply)                         \
-_(ikev2_initiate_del_ike_sa_reply)                      \
-_(ikev2_initiate_del_child_sa_reply)                    \
-_(ikev2_initiate_rekey_child_sa_reply)                  \
 _(delete_loopback_reply)                                \
 _(bd_ip_mac_add_del_reply)                              \
 _(bd_ip_mac_flush_reply)                                \
@@ -5435,7 +5413,7 @@ _(VXLAN_OFFLOAD_RX_REPLY, vxlan_offload_rx_reply)               \
 _(GENEVE_ADD_DEL_TUNNEL_REPLY, geneve_add_del_tunnel_reply)             \
 _(VXLAN_TUNNEL_DETAILS, vxlan_tunnel_details)                           \
 _(GENEVE_TUNNEL_DETAILS, geneve_tunnel_details)                         \
-_(GRE_ADD_DEL_TUNNEL_REPLY, gre_add_del_tunnel_reply)                   \
+_(GRE_TUNNEL_ADD_DEL_REPLY, gre_tunnel_add_del_reply)                   \
 _(GRE_TUNNEL_DETAILS, gre_tunnel_details)                               \
 _(L2_FIB_CLEAR_TABLE_REPLY, l2_fib_clear_table_reply)                   \
 _(L2_INTERFACE_EFP_FILTER_REPLY, l2_interface_efp_filter_reply)         \
@@ -5470,19 +5448,6 @@ _(IPSEC_SA_SET_KEY_REPLY, ipsec_sa_set_key_reply)                       \
 _(IPSEC_TUNNEL_IF_ADD_DEL_REPLY, ipsec_tunnel_if_add_del_reply)         \
 _(IPSEC_TUNNEL_IF_SET_KEY_REPLY, ipsec_tunnel_if_set_key_reply)         \
 _(IPSEC_TUNNEL_IF_SET_SA_REPLY, ipsec_tunnel_if_set_sa_reply)           \
-_(IKEV2_PROFILE_ADD_DEL_REPLY, ikev2_profile_add_del_reply)             \
-_(IKEV2_PROFILE_SET_AUTH_REPLY, ikev2_profile_set_auth_reply)           \
-_(IKEV2_PROFILE_SET_ID_REPLY, ikev2_profile_set_id_reply)               \
-_(IKEV2_PROFILE_SET_TS_REPLY, ikev2_profile_set_ts_reply)               \
-_(IKEV2_SET_LOCAL_KEY_REPLY, ikev2_set_local_key_reply)                 \
-_(IKEV2_SET_RESPONDER_REPLY, ikev2_set_responder_reply)                 \
-_(IKEV2_SET_IKE_TRANSFORMS_REPLY, ikev2_set_ike_transforms_reply)       \
-_(IKEV2_SET_ESP_TRANSFORMS_REPLY, ikev2_set_esp_transforms_reply)       \
-_(IKEV2_SET_SA_LIFETIME_REPLY, ikev2_set_sa_lifetime_reply)             \
-_(IKEV2_INITIATE_SA_INIT_REPLY, ikev2_initiate_sa_init_reply)           \
-_(IKEV2_INITIATE_DEL_IKE_SA_REPLY, ikev2_initiate_del_ike_sa_reply)     \
-_(IKEV2_INITIATE_DEL_CHILD_SA_REPLY, ikev2_initiate_del_child_sa_reply) \
-_(IKEV2_INITIATE_REKEY_CHILD_SA_REPLY, ikev2_initiate_rekey_child_sa_reply) \
 _(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)                         \
@@ -5604,7 +5569,7 @@ _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL_REPLY,                         \
  ip_source_and_port_range_check_add_del_reply)                          \
 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL_REPLY,               \
  ip_source_and_port_range_check_interface_add_del_reply)                \
-_(IPSEC_GRE_ADD_DEL_TUNNEL_REPLY, ipsec_gre_add_del_tunnel_reply)       \
+_(IPSEC_GRE_TUNNEL_ADD_DEL_REPLY, ipsec_gre_tunnel_add_del_reply)       \
 _(IPSEC_GRE_TUNNEL_DETAILS, ipsec_gre_tunnel_details)                   \
 _(DELETE_SUBIF_REPLY, delete_subif_reply)                               \
 _(L2_INTERFACE_PBB_TAG_REWRITE_REPLY, l2_interface_pbb_tag_rewrite_reply) \
@@ -13327,16 +13292,17 @@ api_geneve_tunnel_dump (vat_main_t * vam)
 }
 
 static int
-api_gre_add_del_tunnel (vat_main_t * vam)
+api_gre_tunnel_add_del (vat_main_t * vam)
 {
   unformat_input_t *line_input = vam->input;
-  vl_api_gre_add_del_tunnel_t *mp;
-  ip4_address_t src4, dst4;
-  ip6_address_t src6, dst6;
+  vl_api_address_t src = { }, dst =
+  {
+  };
+  vl_api_gre_tunnel_add_del_t *mp;
+  vl_api_gre_tunnel_type_t t_type;
   u8 is_add = 1;
   u8 ipv4_set = 0;
   u8 ipv6_set = 0;
-  u8 t_type = GRE_TUNNEL_TYPE_L3;
   u8 src_set = 0;
   u8 dst_set = 0;
   u32 outer_fib_id = 0;
@@ -13344,10 +13310,7 @@ api_gre_add_del_tunnel (vat_main_t * vam)
   u32 instance = ~0;
   int ret;
 
-  clib_memset (&src4, 0, sizeof src4);
-  clib_memset (&dst4, 0, sizeof dst4);
-  clib_memset (&src6, 0, sizeof src6);
-  clib_memset (&dst6, 0, sizeof dst6);
+  t_type = GRE_API_TUNNEL_TYPE_L3;
 
   while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
@@ -13355,32 +13318,20 @@ api_gre_add_del_tunnel (vat_main_t * vam)
        is_add = 0;
       else if (unformat (line_input, "instance %d", &instance))
        ;
-      else if (unformat (line_input, "src %U", unformat_ip4_address, &src4))
-       {
-         src_set = 1;
-         ipv4_set = 1;
-       }
-      else if (unformat (line_input, "dst %U", unformat_ip4_address, &dst4))
-       {
-         dst_set = 1;
-         ipv4_set = 1;
-       }
-      else if (unformat (line_input, "src %U", unformat_ip6_address, &src6))
+      else if (unformat (line_input, "src %U", unformat_vl_api_address, &src))
        {
          src_set = 1;
-         ipv6_set = 1;
        }
-      else if (unformat (line_input, "dst %U", unformat_ip6_address, &dst6))
+      else if (unformat (line_input, "dst %U", unformat_vl_api_address, &dst))
        {
          dst_set = 1;
-         ipv6_set = 1;
        }
       else if (unformat (line_input, "outer-fib-id %d", &outer_fib_id))
        ;
       else if (unformat (line_input, "teb"))
-       t_type = GRE_TUNNEL_TYPE_TEB;
+       t_type = GRE_API_TUNNEL_TYPE_TEB;
       else if (unformat (line_input, "erspan %d", &session_id))
-       t_type = GRE_TUNNEL_TYPE_ERSPAN;
+       t_type = GRE_API_TUNNEL_TYPE_ERSPAN;
       else
        {
          errmsg ("parse error '%U'", format_unformat_error, line_input);
@@ -13398,31 +13349,17 @@ api_gre_add_del_tunnel (vat_main_t * vam)
       errmsg ("tunnel dst address not specified");
       return -99;
     }
-  if (ipv4_set && ipv6_set)
-    {
-      errmsg ("both IPv4 and IPv6 addresses specified");
-      return -99;
-    }
 
+  M (GRE_TUNNEL_ADD_DEL, mp);
 
-  M (GRE_ADD_DEL_TUNNEL, mp);
+  clib_memcpy (&mp->tunnel.src, &src, sizeof (mp->tunnel.src));
+  clib_memcpy (&mp->tunnel.dst, &dst, sizeof (mp->tunnel.dst));
 
-  if (ipv4_set)
-    {
-      clib_memcpy (&mp->src_address, &src4, 4);
-      clib_memcpy (&mp->dst_address, &dst4, 4);
-    }
-  else
-    {
-      clib_memcpy (&mp->src_address, &src6, 16);
-      clib_memcpy (&mp->dst_address, &dst6, 16);
-    }
-  mp->instance = htonl (instance);
-  mp->outer_fib_id = htonl (outer_fib_id);
+  mp->tunnel.instance = htonl (instance);
+  mp->tunnel.outer_fib_id = htonl (outer_fib_id);
   mp->is_add = is_add;
-  mp->session_id = htons ((u16) session_id);
-  mp->tunnel_type = t_type;
-  mp->is_ipv6 = ipv6_set;
+  mp->tunnel.session_id = htons ((u16) session_id);
+  mp->tunnel.type = htonl (t_type);
 
   S (mp);
   W (ret);
@@ -13433,15 +13370,34 @@ static void vl_api_gre_tunnel_details_t_handler
   (vl_api_gre_tunnel_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
-  ip46_address_t src = to_ip46 (mp->is_ipv6, mp->src_address);
-  ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->dst_address);
 
   print (vam->ofp, "%11d%11d%24U%24U%13d%14d%12d",
-        ntohl (mp->sw_if_index),
-        ntohl (mp->instance),
-        format_ip46_address, &src, IP46_TYPE_ANY,
-        format_ip46_address, &dst, IP46_TYPE_ANY,
-        mp->tunnel_type, ntohl (mp->outer_fib_id), ntohl (mp->session_id));
+        ntohl (mp->tunnel.sw_if_index),
+        ntohl (mp->tunnel.instance),
+        format_vl_api_address, &mp->tunnel.src,
+        format_vl_api_address, &mp->tunnel.dst,
+        mp->tunnel.type, ntohl (mp->tunnel.outer_fib_id),
+        ntohl (mp->tunnel.session_id));
+}
+
+static void
+vat_json_object_add_address (vat_json_node_t * node,
+                            const char *str, const vl_api_address_t * addr)
+{
+  if (ADDRESS_IP6 == addr->af)
+    {
+      struct in6_addr ip6;
+
+      clib_memcpy (&ip6, &addr->un.ip6, sizeof (ip6));
+      vat_json_object_add_ip6 (node, str, ip6);
+    }
+  else
+    {
+      struct in_addr ip4;
+
+      clib_memcpy (&ip4, &addr->un.ip4, sizeof (ip4));
+      vat_json_object_add_ip4 (node, str, ip4);
+    }
 }
 
 static void vl_api_gre_tunnel_details_t_handler_json
@@ -13460,26 +13416,16 @@ static void vl_api_gre_tunnel_details_t_handler_json
   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, "instance", ntohl (mp->instance));
-  if (!mp->is_ipv6)
-    {
-      clib_memcpy (&ip4, &mp->src_address, sizeof (ip4));
-      vat_json_object_add_ip4 (node, "src_address", ip4);
-      clib_memcpy (&ip4, &mp->dst_address, sizeof (ip4));
-      vat_json_object_add_ip4 (node, "dst_address", ip4);
-    }
-  else
-    {
-      clib_memcpy (&ip6, &mp->src_address, sizeof (ip6));
-      vat_json_object_add_ip6 (node, "src_address", ip6);
-      clib_memcpy (&ip6, &mp->dst_address, sizeof (ip6));
-      vat_json_object_add_ip6 (node, "dst_address", ip6);
-    }
-  vat_json_object_add_uint (node, "tunnel_type", mp->tunnel_type);
-  vat_json_object_add_uint (node, "outer_fib_id", ntohl (mp->outer_fib_id));
-  vat_json_object_add_uint (node, "is_ipv6", mp->is_ipv6);
-  vat_json_object_add_uint (node, "session_id", mp->session_id);
+  vat_json_object_add_uint (node, "sw_if_index",
+                           ntohl (mp->tunnel.sw_if_index));
+  vat_json_object_add_uint (node, "instance", ntohl (mp->tunnel.instance));
+
+  vat_json_object_add_address (node, "src", &mp->tunnel.src);
+  vat_json_object_add_address (node, "dst", &mp->tunnel.dst);
+  vat_json_object_add_uint (node, "tunnel_type", mp->tunnel.type);
+  vat_json_object_add_uint (node, "outer_fib_id",
+                           ntohl (mp->tunnel.outer_fib_id));
+  vat_json_object_add_uint (node, "session_id", mp->tunnel.session_id);
 }
 
 static int
@@ -15082,13 +15028,15 @@ api_ipsec_tunnel_if_add_del (vat_main_t * vam)
   u32 crypto_alg = 0, integ_alg = 0;
   u8 *lck = NULL, *rck = NULL;
   u8 *lik = NULL, *rik = NULL;
-  ip4_address_t local_ip = { {0} };
-  ip4_address_t remote_ip = { {0} };
+  vl_api_address_t local_ip = { 0 };
+  vl_api_address_t remote_ip = { 0 };
+  f64 before = 0;
   u8 is_add = 1;
   u8 esn = 0;
   u8 anti_replay = 0;
   u8 renumber = 0;
   u32 instance = ~0;
+  u32 count = 1, jj;
   int ret;
 
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
@@ -15097,15 +15045,19 @@ api_ipsec_tunnel_if_add_del (vat_main_t * vam)
        is_add = 0;
       else if (unformat (i, "esn"))
        esn = 1;
-      else if (unformat (i, "anti_replay"))
+      else if (unformat (i, "anti-replay"))
        anti_replay = 1;
+      else if (unformat (i, "count %d", &count))
+       ;
       else if (unformat (i, "local_spi %d", &local_spi))
        ;
       else if (unformat (i, "remote_spi %d", &remote_spi))
        ;
-      else if (unformat (i, "local_ip %U", unformat_ip4_address, &local_ip))
+      else
+       if (unformat (i, "local_ip %U", unformat_vl_api_address, &local_ip))
        ;
-      else if (unformat (i, "remote_ip %U", unformat_ip4_address, &remote_ip))
+      else
+       if (unformat (i, "remote_ip %U", unformat_vl_api_address, &remote_ip))
        ;
       else if (unformat (i, "local_crypto_key %U", unformat_hex_string, &lck))
        ;
@@ -15147,65 +15099,123 @@ api_ipsec_tunnel_if_add_del (vat_main_t * vam)
        }
     }
 
-  M (IPSEC_TUNNEL_IF_ADD_DEL, mp);
+  if (count > 1)
+    {
+      /* Turn on async mode */
+      vam->async_mode = 1;
+      vam->async_errors = 0;
+      before = vat_time_now (vam);
+    }
+
+  for (jj = 0; jj < count; jj++)
+    {
+      M (IPSEC_TUNNEL_IF_ADD_DEL, mp);
 
-  mp->is_add = is_add;
-  mp->esn = esn;
-  mp->anti_replay = anti_replay;
+      mp->is_add = is_add;
+      mp->esn = esn;
+      mp->anti_replay = anti_replay;
 
-  clib_memcpy (mp->local_ip, &local_ip, sizeof (ip4_address_t));
-  clib_memcpy (mp->remote_ip, &remote_ip, sizeof (ip4_address_t));
+      if (jj > 0)
+       increment_vl_address (&remote_ip);
 
-  mp->local_spi = htonl (local_spi);
-  mp->remote_spi = htonl (remote_spi);
-  mp->crypto_alg = (u8) crypto_alg;
+      clib_memcpy (&mp->local_ip, &local_ip, sizeof (local_ip));
+      clib_memcpy (&mp->remote_ip, &remote_ip, sizeof (remote_ip));
 
-  mp->local_crypto_key_len = 0;
-  if (lck)
-    {
-      mp->local_crypto_key_len = vec_len (lck);
-      if (mp->local_crypto_key_len > sizeof (mp->local_crypto_key))
-       mp->local_crypto_key_len = sizeof (mp->local_crypto_key);
-      clib_memcpy (mp->local_crypto_key, lck, mp->local_crypto_key_len);
-    }
+      mp->local_spi = htonl (local_spi + jj);
+      mp->remote_spi = htonl (remote_spi + jj);
+      mp->crypto_alg = (u8) crypto_alg;
 
-  mp->remote_crypto_key_len = 0;
-  if (rck)
-    {
-      mp->remote_crypto_key_len = vec_len (rck);
-      if (mp->remote_crypto_key_len > sizeof (mp->remote_crypto_key))
-       mp->remote_crypto_key_len = sizeof (mp->remote_crypto_key);
-      clib_memcpy (mp->remote_crypto_key, rck, mp->remote_crypto_key_len);
-    }
+      mp->local_crypto_key_len = 0;
+      if (lck)
+       {
+         mp->local_crypto_key_len = vec_len (lck);
+         if (mp->local_crypto_key_len > sizeof (mp->local_crypto_key))
+           mp->local_crypto_key_len = sizeof (mp->local_crypto_key);
+         clib_memcpy (mp->local_crypto_key, lck, mp->local_crypto_key_len);
+       }
 
-  mp->integ_alg = (u8) integ_alg;
+      mp->remote_crypto_key_len = 0;
+      if (rck)
+       {
+         mp->remote_crypto_key_len = vec_len (rck);
+         if (mp->remote_crypto_key_len > sizeof (mp->remote_crypto_key))
+           mp->remote_crypto_key_len = sizeof (mp->remote_crypto_key);
+         clib_memcpy (mp->remote_crypto_key, rck, mp->remote_crypto_key_len);
+       }
 
-  mp->local_integ_key_len = 0;
-  if (lik)
-    {
-      mp->local_integ_key_len = vec_len (lik);
-      if (mp->local_integ_key_len > sizeof (mp->local_integ_key))
-       mp->local_integ_key_len = sizeof (mp->local_integ_key);
-      clib_memcpy (mp->local_integ_key, lik, mp->local_integ_key_len);
+      mp->integ_alg = (u8) integ_alg;
+
+      mp->local_integ_key_len = 0;
+      if (lik)
+       {
+         mp->local_integ_key_len = vec_len (lik);
+         if (mp->local_integ_key_len > sizeof (mp->local_integ_key))
+           mp->local_integ_key_len = sizeof (mp->local_integ_key);
+         clib_memcpy (mp->local_integ_key, lik, mp->local_integ_key_len);
+       }
+
+      mp->remote_integ_key_len = 0;
+      if (rik)
+       {
+         mp->remote_integ_key_len = vec_len (rik);
+         if (mp->remote_integ_key_len > sizeof (mp->remote_integ_key))
+           mp->remote_integ_key_len = sizeof (mp->remote_integ_key);
+         clib_memcpy (mp->remote_integ_key, rik, mp->remote_integ_key_len);
+       }
+
+      if (renumber)
+       {
+         mp->renumber = renumber;
+         mp->show_instance = ntohl (instance);
+       }
+      S (mp);
     }
 
-  mp->remote_integ_key_len = 0;
-  if (rik)
+  /* When testing multiple add/del ops, use a control-ping to sync */
+  if (count > 1)
     {
-      mp->remote_integ_key_len = vec_len (rik);
-      if (mp->remote_integ_key_len > sizeof (mp->remote_integ_key))
-       mp->remote_integ_key_len = sizeof (mp->remote_integ_key);
-      clib_memcpy (mp->remote_integ_key, rik, mp->remote_integ_key_len);
-    }
+      vl_api_control_ping_t *mp_ping;
+      f64 after;
+      f64 timeout;
+
+      /* 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);
+
+      /* slim chance, but we might have eaten SIGTERM on the first iteration */
+      if (jj > 0)
+       count = jj;
 
-  if (renumber)
+      print (vam->ofp, "%d tunnels in %.6f secs, %.2f tunnels/sec",
+            count, after - before, count / (after - before));
+    }
+  else
     {
-      mp->renumber = renumber;
-      mp->show_instance = ntohl (instance);
+      /* Wait for a reply... */
+      W (ret);
+      return ret;
     }
 
-  S (mp);
-  W (ret);
   return ret;
 }
 
@@ -15215,25 +15225,24 @@ 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 use_esn %u "
-        "use_anti_replay %u is_tunnel %u is_tunnel_ip6 %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 total_data_size %lu\n",
-        ntohl (mp->sa_id), ntohl (mp->sw_if_index), ntohl (mp->spi),
-        mp->protocol,
-        mp->crypto_alg, format_hex_bytes, mp->crypto_key, mp->crypto_key_len,
-        mp->integ_alg, format_hex_bytes, mp->integ_key, mp->integ_key_len,
-        mp->use_esn, mp->use_anti_replay, mp->is_tunnel, mp->is_tunnel_ip6,
-        (mp->is_tunnel_ip6) ? format_ip6_address : format_ip4_address,
-        mp->tunnel_src_addr,
-        (mp->is_tunnel_ip6) ? format_ip6_address : format_ip4_address,
-        mp->tunnel_dst_addr,
-        ntohl (mp->salt),
+        "replay_window %lu\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),
-        clib_net_to_host_u64 (mp->total_data_size));
+        clib_net_to_host_u64 (mp->replay_window));
 }
 
 #define vl_api_ipsec_sa_details_t_endian vl_noop_handler
@@ -15244,8 +15253,7 @@ static void vl_api_ipsec_sa_details_t_handler_json
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = NULL;
-  struct in_addr src_ip4, dst_ip4;
-  struct in6_addr src_ip6, dst_ip6;
+  vl_api_ipsec_sad_flags_t flags;
 
   if (VAT_JSON_ARRAY != vam->json_tree.type)
     {
@@ -15255,39 +15263,33 @@ static void vl_api_ipsec_sa_details_t_handler_json
   node = vat_json_array_add (&vam->json_tree);
 
   vat_json_init_object (node);
-  vat_json_object_add_uint (node, "sa_id", ntohl (mp->sa_id));
+  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->spi));
-  vat_json_object_add_uint (node, "proto", mp->protocol);
-  vat_json_object_add_uint (node, "crypto_alg", mp->crypto_alg);
-  vat_json_object_add_uint (node, "integ_alg", mp->integ_alg);
-  vat_json_object_add_uint (node, "use_esn", mp->use_esn);
-  vat_json_object_add_uint (node, "use_anti_replay", mp->use_anti_replay);
-  vat_json_object_add_uint (node, "is_tunnel", mp->is_tunnel);
-  vat_json_object_add_uint (node, "is_tunnel_ip6", mp->is_tunnel_ip6);
-  vat_json_object_add_bytes (node, "crypto_key", mp->crypto_key,
-                            mp->crypto_key_len);
-  vat_json_object_add_bytes (node, "integ_key", mp->integ_key,
-                            mp->integ_key_len);
-  if (mp->is_tunnel_ip6)
-    {
-      clib_memcpy (&src_ip6, mp->tunnel_src_addr, sizeof (src_ip6));
-      vat_json_object_add_ip6 (node, "tunnel_src_addr", src_ip6);
-      clib_memcpy (&dst_ip6, mp->tunnel_dst_addr, sizeof (dst_ip6));
-      vat_json_object_add_ip6 (node, "tunnel_dst_addr", dst_ip6);
-    }
-  else
-    {
-      clib_memcpy (&src_ip4, mp->tunnel_src_addr, sizeof (src_ip4));
-      vat_json_object_add_ip4 (node, "tunnel_src_addr", src_ip4);
-      clib_memcpy (&dst_ip4, mp->tunnel_dst_addr, sizeof (dst_ip4));
-      vat_json_object_add_ip4 (node, "tunnel_dst_addr", dst_ip4);
-    }
+  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, "total_data_size",
-                           clib_net_to_host_u64 (mp->total_data_size));
-
 }
 
 static int
@@ -15454,732 +15456,95 @@ api_ipsec_tunnel_if_set_sa (vat_main_t * vam)
 }
 
 static int
-api_ikev2_profile_add_del (vat_main_t * vam)
+api_get_first_msg_id (vat_main_t * vam)
 {
+  vl_api_get_first_msg_id_t *mp;
   unformat_input_t *i = vam->input;
-  vl_api_ikev2_profile_add_del_t *mp;
-  u8 is_add = 1;
-  u8 *name = 0;
+  u8 *name;
+  u8 name_set = 0;
   int ret;
 
-  const char *valid_chars = "a-zA-Z0-9_";
-
   while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "del"))
-       is_add = 0;
-      else if (unformat (i, "name %U", unformat_token, valid_chars, &name))
-       vec_add1 (name, 0);
+      if (unformat (i, "client %s", &name))
+       name_set = 1;
       else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
+       break;
     }
 
-  if (!vec_len (name))
+  if (name_set == 0)
     {
-      errmsg ("profile name must be specified");
+      errmsg ("missing client name");
       return -99;
     }
+  vec_add1 (name, 0);
 
-  if (vec_len (name) > 64)
+  if (vec_len (name) > 63)
     {
-      errmsg ("profile name too long");
+      errmsg ("client name too long");
       return -99;
     }
 
-  M (IKEV2_PROFILE_ADD_DEL, mp);
-
+  M (GET_FIRST_MSG_ID, mp);
   clib_memcpy (mp->name, name, vec_len (name));
-  mp->is_add = is_add;
-  vec_free (name);
-
   S (mp);
   W (ret);
   return ret;
 }
 
 static int
-api_ikev2_profile_set_auth (vat_main_t * vam)
+api_cop_interface_enable_disable (vat_main_t * vam)
 {
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_profile_set_auth_t *mp;
-  u8 *name = 0;
-  u8 *data = 0;
-  u32 auth_method = 0;
-  u8 is_hex = 0;
+  unformat_input_t *line_input = vam->input;
+  vl_api_cop_interface_enable_disable_t *mp;
+  u32 sw_if_index = ~0;
+  u8 enable_disable = 1;
   int ret;
 
-  const char *valid_chars = "a-zA-Z0-9_";
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
-      if (unformat (i, "name %U", unformat_token, valid_chars, &name))
-       vec_add1 (name, 0);
-      else if (unformat (i, "auth_method %U",
-                        unformat_ikev2_auth_method, &auth_method))
+      if (unformat (line_input, "disable"))
+       enable_disable = 0;
+      if (unformat (line_input, "enable"))
+       enable_disable = 1;
+      else if (unformat (line_input, "%U", api_unformat_sw_if_index,
+                        vam, &sw_if_index))
        ;
-      else if (unformat (i, "auth_data 0x%U", unformat_hex_string, &data))
-       is_hex = 1;
-      else if (unformat (i, "auth_data %v", &data))
+      else if (unformat (line_input, "sw_if_index %d", &sw_if_index))
        ;
       else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  if (!vec_len (name))
-    {
-      errmsg ("profile name must be specified");
-      return -99;
-    }
-
-  if (vec_len (name) > 64)
-    {
-      errmsg ("profile name too long");
-      return -99;
-    }
-
-  if (!vec_len (data))
-    {
-      errmsg ("auth_data must be specified");
-      return -99;
+       break;
     }
 
-  if (!auth_method)
+  if (sw_if_index == ~0)
     {
-      errmsg ("auth_method must be specified");
+      errmsg ("missing interface name or sw_if_index");
       return -99;
     }
 
-  M (IKEV2_PROFILE_SET_AUTH, mp);
-
-  mp->is_hex = is_hex;
-  mp->auth_method = (u8) auth_method;
-  mp->data_len = vec_len (data);
-  clib_memcpy (mp->name, name, vec_len (name));
-  clib_memcpy (mp->data, data, vec_len (data));
-  vec_free (name);
-  vec_free (data);
+  /* Construct the API message */
+  M (COP_INTERFACE_ENABLE_DISABLE, mp);
+  mp->sw_if_index = ntohl (sw_if_index);
+  mp->enable_disable = enable_disable;
 
+  /* send it... */
   S (mp);
+  /* Wait for the reply */
   W (ret);
   return ret;
 }
 
 static int
-api_ikev2_profile_set_id (vat_main_t * vam)
+api_cop_whitelist_enable_disable (vat_main_t * vam)
 {
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_profile_set_id_t *mp;
-  u8 *name = 0;
-  u8 *data = 0;
-  u8 is_local = 0;
-  u32 id_type = 0;
-  ip4_address_t ip4;
+  unformat_input_t *line_input = vam->input;
+  vl_api_cop_whitelist_enable_disable_t *mp;
+  u32 sw_if_index = ~0;
+  u8 ip4 = 0, ip6 = 0, default_cop = 0;
+  u32 fib_id = 0;
   int ret;
 
-  const char *valid_chars = "a-zA-Z0-9_";
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "name %U", unformat_token, valid_chars, &name))
-       vec_add1 (name, 0);
-      else if (unformat (i, "id_type %U", unformat_ikev2_id_type, &id_type))
-       ;
-      else if (unformat (i, "id_data %U", unformat_ip4_address, &ip4))
-       {
-         data = vec_new (u8, 4);
-         clib_memcpy (data, ip4.as_u8, 4);
-       }
-      else if (unformat (i, "id_data 0x%U", unformat_hex_string, &data))
-       ;
-      else if (unformat (i, "id_data %v", &data))
-       ;
-      else if (unformat (i, "local"))
-       is_local = 1;
-      else if (unformat (i, "remote"))
-       is_local = 0;
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  if (!vec_len (name))
-    {
-      errmsg ("profile name must be specified");
-      return -99;
-    }
-
-  if (vec_len (name) > 64)
-    {
-      errmsg ("profile name too long");
-      return -99;
-    }
-
-  if (!vec_len (data))
-    {
-      errmsg ("id_data must be specified");
-      return -99;
-    }
-
-  if (!id_type)
-    {
-      errmsg ("id_type must be specified");
-      return -99;
-    }
-
-  M (IKEV2_PROFILE_SET_ID, mp);
-
-  mp->is_local = is_local;
-  mp->id_type = (u8) id_type;
-  mp->data_len = vec_len (data);
-  clib_memcpy (mp->name, name, vec_len (name));
-  clib_memcpy (mp->data, data, vec_len (data));
-  vec_free (name);
-  vec_free (data);
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ikev2_profile_set_ts (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_profile_set_ts_t *mp;
-  u8 *name = 0;
-  u8 is_local = 0;
-  u32 proto = 0, start_port = 0, end_port = (u32) ~ 0;
-  ip4_address_t start_addr, end_addr;
-
-  const char *valid_chars = "a-zA-Z0-9_";
-  int ret;
-
-  start_addr.as_u32 = 0;
-  end_addr.as_u32 = (u32) ~ 0;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "name %U", unformat_token, valid_chars, &name))
-       vec_add1 (name, 0);
-      else if (unformat (i, "protocol %d", &proto))
-       ;
-      else if (unformat (i, "start_port %d", &start_port))
-       ;
-      else if (unformat (i, "end_port %d", &end_port))
-       ;
-      else
-       if (unformat (i, "start_addr %U", unformat_ip4_address, &start_addr))
-       ;
-      else if (unformat (i, "end_addr %U", unformat_ip4_address, &end_addr))
-       ;
-      else if (unformat (i, "local"))
-       is_local = 1;
-      else if (unformat (i, "remote"))
-       is_local = 0;
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  if (!vec_len (name))
-    {
-      errmsg ("profile name must be specified");
-      return -99;
-    }
-
-  if (vec_len (name) > 64)
-    {
-      errmsg ("profile name too long");
-      return -99;
-    }
-
-  M (IKEV2_PROFILE_SET_TS, mp);
-
-  mp->is_local = is_local;
-  mp->proto = (u8) proto;
-  mp->start_port = (u16) start_port;
-  mp->end_port = (u16) end_port;
-  mp->start_addr = start_addr.as_u32;
-  mp->end_addr = end_addr.as_u32;
-  clib_memcpy (mp->name, name, vec_len (name));
-  vec_free (name);
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ikev2_set_local_key (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_set_local_key_t *mp;
-  u8 *file = 0;
-  int ret;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "file %v", &file))
-       vec_add1 (file, 0);
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  if (!vec_len (file))
-    {
-      errmsg ("RSA key file must be specified");
-      return -99;
-    }
-
-  if (vec_len (file) > 256)
-    {
-      errmsg ("file name too long");
-      return -99;
-    }
-
-  M (IKEV2_SET_LOCAL_KEY, mp);
-
-  clib_memcpy (mp->key_file, file, vec_len (file));
-  vec_free (file);
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ikev2_set_responder (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_set_responder_t *mp;
-  int ret;
-  u8 *name = 0;
-  u32 sw_if_index = ~0;
-  ip4_address_t address;
-
-  const char *valid_chars = "a-zA-Z0-9_";
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat
-         (i, "%U interface %d address %U", unformat_token, valid_chars,
-          &name, &sw_if_index, unformat_ip4_address, &address))
-       vec_add1 (name, 0);
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  if (!vec_len (name))
-    {
-      errmsg ("profile name must be specified");
-      return -99;
-    }
-
-  if (vec_len (name) > 64)
-    {
-      errmsg ("profile name too long");
-      return -99;
-    }
-
-  M (IKEV2_SET_RESPONDER, mp);
-
-  clib_memcpy (mp->name, name, vec_len (name));
-  vec_free (name);
-
-  mp->sw_if_index = sw_if_index;
-  clib_memcpy (mp->address, &address, sizeof (address));
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ikev2_set_ike_transforms (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_set_ike_transforms_t *mp;
-  int ret;
-  u8 *name = 0;
-  u32 crypto_alg, crypto_key_size, integ_alg, dh_group;
-
-  const char *valid_chars = "a-zA-Z0-9_";
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "%U %d %d %d %d", unformat_token, valid_chars, &name,
-                   &crypto_alg, &crypto_key_size, &integ_alg, &dh_group))
-       vec_add1 (name, 0);
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  if (!vec_len (name))
-    {
-      errmsg ("profile name must be specified");
-      return -99;
-    }
-
-  if (vec_len (name) > 64)
-    {
-      errmsg ("profile name too long");
-      return -99;
-    }
-
-  M (IKEV2_SET_IKE_TRANSFORMS, mp);
-
-  clib_memcpy (mp->name, name, vec_len (name));
-  vec_free (name);
-  mp->crypto_alg = crypto_alg;
-  mp->crypto_key_size = crypto_key_size;
-  mp->integ_alg = integ_alg;
-  mp->dh_group = dh_group;
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-
-static int
-api_ikev2_set_esp_transforms (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_set_esp_transforms_t *mp;
-  int ret;
-  u8 *name = 0;
-  u32 crypto_alg, crypto_key_size, integ_alg, dh_group;
-
-  const char *valid_chars = "a-zA-Z0-9_";
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "%U %d %d %d %d", unformat_token, valid_chars, &name,
-                   &crypto_alg, &crypto_key_size, &integ_alg, &dh_group))
-       vec_add1 (name, 0);
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  if (!vec_len (name))
-    {
-      errmsg ("profile name must be specified");
-      return -99;
-    }
-
-  if (vec_len (name) > 64)
-    {
-      errmsg ("profile name too long");
-      return -99;
-    }
-
-  M (IKEV2_SET_ESP_TRANSFORMS, mp);
-
-  clib_memcpy (mp->name, name, vec_len (name));
-  vec_free (name);
-  mp->crypto_alg = crypto_alg;
-  mp->crypto_key_size = crypto_key_size;
-  mp->integ_alg = integ_alg;
-  mp->dh_group = dh_group;
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ikev2_set_sa_lifetime (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_set_sa_lifetime_t *mp;
-  int ret;
-  u8 *name = 0;
-  u64 lifetime, lifetime_maxdata;
-  u32 lifetime_jitter, handover;
-
-  const char *valid_chars = "a-zA-Z0-9_";
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "%U %lu %u %u %lu", unformat_token, valid_chars, &name,
-                   &lifetime, &lifetime_jitter, &handover,
-                   &lifetime_maxdata))
-       vec_add1 (name, 0);
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  if (!vec_len (name))
-    {
-      errmsg ("profile name must be specified");
-      return -99;
-    }
-
-  if (vec_len (name) > 64)
-    {
-      errmsg ("profile name too long");
-      return -99;
-    }
-
-  M (IKEV2_SET_SA_LIFETIME, mp);
-
-  clib_memcpy (mp->name, name, vec_len (name));
-  vec_free (name);
-  mp->lifetime = lifetime;
-  mp->lifetime_jitter = lifetime_jitter;
-  mp->handover = handover;
-  mp->lifetime_maxdata = lifetime_maxdata;
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ikev2_initiate_sa_init (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_initiate_sa_init_t *mp;
-  int ret;
-  u8 *name = 0;
-
-  const char *valid_chars = "a-zA-Z0-9_";
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "%U", unformat_token, valid_chars, &name))
-       vec_add1 (name, 0);
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  if (!vec_len (name))
-    {
-      errmsg ("profile name must be specified");
-      return -99;
-    }
-
-  if (vec_len (name) > 64)
-    {
-      errmsg ("profile name too long");
-      return -99;
-    }
-
-  M (IKEV2_INITIATE_SA_INIT, mp);
-
-  clib_memcpy (mp->name, name, vec_len (name));
-  vec_free (name);
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ikev2_initiate_del_ike_sa (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_initiate_del_ike_sa_t *mp;
-  int ret;
-  u64 ispi;
-
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "%lx", &ispi))
-       ;
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  M (IKEV2_INITIATE_DEL_IKE_SA, mp);
-
-  mp->ispi = ispi;
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ikev2_initiate_del_child_sa (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_initiate_del_child_sa_t *mp;
-  int ret;
-  u32 ispi;
-
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "%x", &ispi))
-       ;
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  M (IKEV2_INITIATE_DEL_CHILD_SA, mp);
-
-  mp->ispi = ispi;
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_ikev2_initiate_rekey_child_sa (vat_main_t * vam)
-{
-  unformat_input_t *i = vam->input;
-  vl_api_ikev2_initiate_rekey_child_sa_t *mp;
-  int ret;
-  u32 ispi;
-
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "%x", &ispi))
-       ;
-      else
-       {
-         errmsg ("parse error '%U'", format_unformat_error, i);
-         return -99;
-       }
-    }
-
-  M (IKEV2_INITIATE_REKEY_CHILD_SA, mp);
-
-  mp->ispi = ispi;
-
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_get_first_msg_id (vat_main_t * vam)
-{
-  vl_api_get_first_msg_id_t *mp;
-  unformat_input_t *i = vam->input;
-  u8 *name;
-  u8 name_set = 0;
-  int ret;
-
-  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (i, "client %s", &name))
-       name_set = 1;
-      else
-       break;
-    }
-
-  if (name_set == 0)
-    {
-      errmsg ("missing client name");
-      return -99;
-    }
-  vec_add1 (name, 0);
-
-  if (vec_len (name) > 63)
-    {
-      errmsg ("client name too long");
-      return -99;
-    }
-
-  M (GET_FIRST_MSG_ID, mp);
-  clib_memcpy (mp->name, name, vec_len (name));
-  S (mp);
-  W (ret);
-  return ret;
-}
-
-static int
-api_cop_interface_enable_disable (vat_main_t * vam)
-{
-  unformat_input_t *line_input = vam->input;
-  vl_api_cop_interface_enable_disable_t *mp;
-  u32 sw_if_index = ~0;
-  u8 enable_disable = 1;
-  int ret;
-
-  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (line_input, "disable"))
-       enable_disable = 0;
-      if (unformat (line_input, "enable"))
-       enable_disable = 1;
-      else if (unformat (line_input, "%U", api_unformat_sw_if_index,
-                        vam, &sw_if_index))
-       ;
-      else if (unformat (line_input, "sw_if_index %d", &sw_if_index))
-       ;
-      else
-       break;
-    }
-
-  if (sw_if_index == ~0)
-    {
-      errmsg ("missing interface name or sw_if_index");
-      return -99;
-    }
-
-  /* Construct the API message */
-  M (COP_INTERFACE_ENABLE_DISABLE, mp);
-  mp->sw_if_index = ntohl (sw_if_index);
-  mp->enable_disable = enable_disable;
-
-  /* send it... */
-  S (mp);
-  /* Wait for the reply */
-  W (ret);
-  return ret;
-}
-
-static int
-api_cop_whitelist_enable_disable (vat_main_t * vam)
-{
-  unformat_input_t *line_input = vam->input;
-  vl_api_cop_whitelist_enable_disable_t *mp;
-  u32 sw_if_index = ~0;
-  u8 ip4 = 0, ip6 = 0, default_cop = 0;
-  u32 fib_id = 0;
-  int ret;
-
-  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
     {
       if (unformat (line_input, "ip4"))
        ip4 = 1;
@@ -20085,8 +19450,6 @@ static void vl_api_ip_neighbor_details_t_handler_json
 
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node;
-  struct in_addr ip4;
-  struct in6_addr ip6;
 
   if (VAT_JSON_ARRAY != vam->json_tree.type)
     {
@@ -20104,17 +19467,7 @@ static void vl_api_ip_neighbor_details_t_handler_json
   vat_json_object_add_string_copy (node, "link_layer",
                                   format (0, "%U", format_vl_api_mac_address,
                                           &mp->neighbor.mac_address));
-
-  if (ADDRESS_IP6 == mp->neighbor.ip_address.af)
-    {
-      clib_memcpy (&ip6, &mp->neighbor.ip_address.un.ip6, sizeof (ip6));
-      vat_json_object_add_ip6 (node, "ip_address", ip6);
-    }
-  else
-    {
-      clib_memcpy (&ip4, &mp->neighbor.ip_address.un.ip4, sizeof (ip4));
-      vat_json_object_add_ip4 (node, "ip_address", ip4);
-    }
+  vat_json_object_add_address (node, "ip", &mp->neighbor.ip_address);
 }
 
 static int
@@ -21035,14 +20388,14 @@ api_ip_source_and_port_range_check_interface_add_del (vat_main_t * vam)
 }
 
 static int
-api_ipsec_gre_add_del_tunnel (vat_main_t * vam)
+api_ipsec_gre_tunnel_add_del (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_ipsec_gre_add_del_tunnel_t *mp;
+  vl_api_ipsec_gre_tunnel_add_del_t *mp;
   u32 local_sa_id = 0;
   u32 remote_sa_id = 0;
-  ip4_address_t src_address;
-  ip4_address_t dst_address;
+  vl_api_ip4_address_t src_address;
+  vl_api_ip4_address_t dst_address;
   u8 is_add = 1;
   int ret;
 
@@ -21052,9 +20405,11 @@ api_ipsec_gre_add_del_tunnel (vat_main_t * vam)
        ;
       else if (unformat (i, "remote_sa %d", &remote_sa_id))
        ;
-      else if (unformat (i, "src %U", unformat_ip4_address, &src_address))
+      else
+       if (unformat (i, "src %U", unformat_vl_api_ip4_address, &src_address))
        ;
-      else if (unformat (i, "dst %U", unformat_ip4_address, &dst_address))
+      else
+       if (unformat (i, "dst %U", unformat_vl_api_ip4_address, &dst_address))
        ;
       else if (unformat (i, "del"))
        is_add = 0;
@@ -21065,12 +20420,12 @@ api_ipsec_gre_add_del_tunnel (vat_main_t * vam)
        }
     }
 
-  M (IPSEC_GRE_ADD_DEL_TUNNEL, mp);
+  M (IPSEC_GRE_TUNNEL_ADD_DEL, mp);
 
-  mp->local_sa_id = ntohl (local_sa_id);
-  mp->remote_sa_id = ntohl (remote_sa_id);
-  clib_memcpy (mp->src_address, &src_address, sizeof (src_address));
-  clib_memcpy (mp->dst_address, &dst_address, sizeof (dst_address));
+  mp->tunnel.local_sa_id = ntohl (local_sa_id);
+  mp->tunnel.remote_sa_id = ntohl (remote_sa_id);
+  clib_memcpy (mp->tunnel.src, &src_address, sizeof (src_address));
+  clib_memcpy (mp->tunnel.dst, &dst_address, sizeof (dst_address));
   mp->is_add = is_add;
 
   S (mp);
@@ -21124,10 +20479,21 @@ static void vl_api_ipsec_gre_tunnel_details_t_handler
   vat_main_t *vam = &vat_main;
 
   print (vam->ofp, "%11d%15U%15U%14d%14d",
-        ntohl (mp->sw_if_index),
-        format_ip4_address, &mp->src_address,
-        format_ip4_address, &mp->dst_address,
-        ntohl (mp->local_sa_id), ntohl (mp->remote_sa_id));
+        ntohl (mp->tunnel.sw_if_index),
+        format_vl_api_ip4_address, mp->tunnel.src,
+        format_vl_api_ip4_address, mp->tunnel.dst,
+        ntohl (mp->tunnel.local_sa_id), ntohl (mp->tunnel.remote_sa_id));
+}
+
+static void
+vat_json_object_add_vl_api_ip4 (vat_json_node_t * node,
+                               const char *name,
+                               const vl_api_ip4_address_t addr)
+{
+  struct in_addr ip4;
+
+  clib_memcpy (&ip4, addr, sizeof (ip4));
+  vat_json_object_add_ip4 (node, name, ip4);
 }
 
 static void vl_api_ipsec_gre_tunnel_details_t_handler_json
@@ -21145,13 +20511,14 @@ static void vl_api_ipsec_gre_tunnel_details_t_handler_json
   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));
-  clib_memcpy (&ip4, &mp->src_address, sizeof (ip4));
-  vat_json_object_add_ip4 (node, "src_address", ip4);
-  clib_memcpy (&ip4, &mp->dst_address, sizeof (ip4));
-  vat_json_object_add_ip4 (node, "dst_address", ip4);
-  vat_json_object_add_uint (node, "local_sa_id", ntohl (mp->local_sa_id));
-  vat_json_object_add_uint (node, "remote_sa_id", ntohl (mp->remote_sa_id));
+  vat_json_object_add_uint (node, "sw_if_index",
+                           ntohl (mp->tunnel.sw_if_index));
+  vat_json_object_add_vl_api_ip4 (node, "src", mp->tunnel.src);
+  vat_json_object_add_vl_api_ip4 (node, "src", mp->tunnel.dst);
+  vat_json_object_add_uint (node, "local_sa_id",
+                           ntohl (mp->tunnel.local_sa_id));
+  vat_json_object_add_uint (node, "remote_sa_id",
+                           ntohl (mp->tunnel.remote_sa_id));
 }
 
 static int
@@ -22025,7 +21392,7 @@ api_sock_init_shm (vat_main_t * vam)
   config[6].count = 128;
   config[6].size = sizeof (uword);
 
-  rv = vl_socket_client_init_shm (config);
+  rv = vl_socket_client_init_shm (config, 1 /* want_pthread */ );
   if (!rv)
     vam->client_index_invalid = 1;
   return rv;
@@ -23113,7 +22480,7 @@ _(geneve_add_del_tunnel,                                                \
   "vni <vni> [encap-vrf-id <nn>] [decap-next <l2|nn>] [del]")           \
 _(vxlan_tunnel_dump, "[<intfc> | sw_if_index <nn>]")                    \
 _(geneve_tunnel_dump, "[<intfc> | sw_if_index <nn>]")                   \
-_(gre_add_del_tunnel,                                                   \
+_(gre_tunnel_add_del,                                                   \
   "src <ip-addr> dst <ip-addr> [outer-fib-id <nn>] [instance <n>]\n"    \
   "[teb | erspan <session-id>] [del]")                                 \
 _(gre_tunnel_dump, "[<intfc> | sw_if_index <nn>]")                      \
@@ -23174,23 +22541,6 @@ _(ipsec_sa_dump, "[sa_id <n>]")                                         \
 _(ipsec_tunnel_if_set_key, "<intfc> <local|remote> <crypto|integ>\n"    \
   "  <alg> <hex>\n")                                                    \
 _(ipsec_tunnel_if_set_sa, "<intfc> sa_id <n> <inbound|outbound>\n")     \
-_(ikev2_profile_add_del, "name <profile_name> [del]")                   \
-_(ikev2_profile_set_auth, "name <profile_name> auth_method <method>\n"  \
-  "(auth_data 0x<data> | auth_data <data>)")                            \
-_(ikev2_profile_set_id, "name <profile_name> id_type <type>\n"          \
-  "(id_data 0x<data> | id_data <data>) (local|remote)")                 \
-_(ikev2_profile_set_ts, "name <profile_name> protocol <proto>\n"        \
-  "start_port <port> end_port <port> start_addr <ip4> end_addr <ip4>\n" \
-  "(local|remote)")                                                     \
-_(ikev2_set_local_key, "file <absolute_file_path>")                     \
-_(ikev2_set_responder, "<profile_name> interface <interface> address <addr>") \
-_(ikev2_set_ike_transforms, "<profile_name> <crypto alg> <key size> <integrity alg> <DH group>") \
-_(ikev2_set_esp_transforms, "<profile_name> <crypto alg> <key size> <integrity alg> <DH group>") \
-_(ikev2_set_sa_lifetime, "<profile_name> <seconds> <jitter> <handover> <max bytes>") \
-_(ikev2_initiate_sa_init, "<profile_name>")                             \
-_(ikev2_initiate_del_ike_sa, "<ispi>")                                  \
-_(ikev2_initiate_del_child_sa, "<ispi>")                                \
-_(ikev2_initiate_rekey_child_sa, "<ispi>")                              \
 _(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>")                          \
@@ -23363,7 +22713,7 @@ _(ip_source_and_port_range_check_add_del,                               \
 _(ip_source_and_port_range_check_interface_add_del,                     \
   "<intf> | sw_if_index <nn> [tcp-out-vrf <id>] [tcp-in-vrf <id>]"      \
   "[udp-in-vrf <id>] [udp-out-vrf <id>]")                               \
-_(ipsec_gre_add_del_tunnel,                                             \
+_(ipsec_gre_tunnel_add_del,                                             \
   "src <addr> dst <addr> local_sa <sa-id> remote_sa <sa-id> [del]")     \
 _(ipsec_gre_tunnel_dump, "[sw_if_index <nn>]")                          \
 _(delete_subif,"<intfc> | sw_if_index <nn>")                            \