API refactoring : l2, mpls, sr
[vpp.git] / src / vpp / api / api.c
index 46e28e9..3d6905d 100644 (file)
@@ -52,8 +52,6 @@
 #include <vnet/ip/ip.h>
 #include <vnet/ip/ip6.h>
 #include <vnet/ip/ip6_neighbor.h>
-#include <vnet/mpls/mpls.h>
-#include <vnet/mpls/mpls_tunnel.h>
 #include <vnet/dhcp/proxy.h>
 #include <vnet/dhcp/client.h>
 #if IPV6SR > 0
 #define foreach_vpe_api_msg                                             \
 _(WANT_OAM_EVENTS, want_oam_events)                                     \
 _(OAM_ADD_DEL, oam_add_del)                                             \
-_(MPLS_ROUTE_ADD_DEL, mpls_route_add_del)                               \
-_(MPLS_IP_BIND_UNBIND, mpls_ip_bind_unbind)                             \
 _(IS_ADDRESS_REACHABLE, is_address_reachable)                           \
 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable)           \
 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath)                       \
 _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass)         \
 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect)           \
 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge)               \
-_(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del)                         \
-_(BRIDGE_DOMAIN_DUMP, bridge_domain_dump)                               \
-_(BRIDGE_DOMAIN_DETAILS, bridge_domain_details)                         \
-_(BRIDGE_DOMAIN_SW_IF_DETAILS, bridge_domain_sw_if_details)             \
-_(L2FIB_ADD_DEL, l2fib_add_del)                                         \
-_(L2_FLAGS, l2_flags)                                                   \
-_(BRIDGE_FLAGS, bridge_flags)                                           \
 _(CREATE_VLAN_SUBIF, create_vlan_subif)                                 \
 _(CREATE_SUBIF, create_subif)                                           \
-_(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del)                            \
 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del)                                 \
 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable)       \
 _(VNET_GET_SUMMARY_STATS, vnet_get_summary_stats)                      \
@@ -159,12 +147,9 @@ _(GET_NODE_INDEX, get_node_index)                                       \
 _(ADD_NODE_NEXT, add_node_next)                                                \
 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel)                           \
 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump)                                 \
-_(L2_FIB_CLEAR_TABLE, l2_fib_clear_table)                               \
 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter)                     \
 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite)         \
 _(SHOW_VERSION, show_version)                                          \
-_(L2_FIB_TABLE_DUMP, l2_fib_table_dump)                                        \
-_(L2_FIB_TABLE_ENTRY, l2_fib_table_entry)                               \
 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel)                   \
 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump)                         \
 _(INTERFACE_NAME_RENUMBER, interface_name_renumber)                    \
@@ -178,15 +163,10 @@ _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable)             \
 _(GET_NODE_GRAPH, get_node_graph)                                       \
 _(IOAM_ENABLE, ioam_enable)                                             \
 _(IOAM_DISABLE, ioam_disable)                                           \
-_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del)                   \
 _(POLICER_ADD_DEL, policer_add_del)                                     \
 _(POLICER_DUMP, policer_dump)                                           \
 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface)       \
 _(POLICER_CLASSIFY_DUMP, policer_classify_dump)                         \
-_(MPLS_TUNNEL_DUMP, mpls_tunnel_dump)                                   \
-_(MPLS_TUNNEL_DETAILS, mpls_tunnel_details)                             \
-_(MPLS_FIB_DUMP, mpls_fib_dump)                                         \
-_(MPLS_FIB_DETAILS, mpls_fib_details)                                   \
 _(CLASSIFY_TABLE_IDS,classify_table_ids)                                \
 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface)             \
 _(CLASSIFY_TABLE_INFO,classify_table_info)                              \
@@ -411,173 +391,6 @@ VLIB_REGISTER_NODE (vpe_resolver_process_node,static) = {
 };
 /* *INDENT-ON* */
 
-static int
-mpls_route_add_del_t_handler (vnet_main_t * vnm,
-                             vl_api_mpls_route_add_del_t * mp)
-{
-  u32 fib_index, next_hop_fib_index;
-  mpls_label_t *label_stack = NULL;
-  int rv, ii, n_labels;;
-
-  fib_prefix_t pfx = {
-    .fp_len = 21,
-    .fp_proto = FIB_PROTOCOL_MPLS,
-    .fp_eos = mp->mr_eos,
-    .fp_label = ntohl (mp->mr_label),
-  };
-  if (pfx.fp_eos)
-    {
-      if (mp->mr_next_hop_proto_is_ip4)
-       {
-         pfx.fp_payload_proto = DPO_PROTO_IP4;
-       }
-      else
-       {
-         pfx.fp_payload_proto = DPO_PROTO_IP6;
-       }
-    }
-  else
-    {
-      pfx.fp_payload_proto = DPO_PROTO_MPLS;
-    }
-
-  rv = add_del_route_check (FIB_PROTOCOL_MPLS,
-                           mp->mr_table_id,
-                           mp->mr_next_hop_sw_if_index,
-                           dpo_proto_to_fib (pfx.fp_payload_proto),
-                           mp->mr_next_hop_table_id,
-                           mp->mr_create_table_if_needed,
-                           &fib_index, &next_hop_fib_index);
-
-  if (0 != rv)
-    return (rv);
-
-  ip46_address_t nh;
-  memset (&nh, 0, sizeof (nh));
-
-  if (mp->mr_next_hop_proto_is_ip4)
-    memcpy (&nh.ip4, mp->mr_next_hop, sizeof (nh.ip4));
-  else
-    memcpy (&nh.ip6, mp->mr_next_hop, sizeof (nh.ip6));
-
-  n_labels = mp->mr_next_hop_n_out_labels;
-  if (n_labels == 0)
-    ;
-  else if (1 == n_labels)
-    vec_add1 (label_stack, ntohl (mp->mr_next_hop_out_label_stack[0]));
-  else
-    {
-      vec_validate (label_stack, n_labels - 1);
-      for (ii = 0; ii < n_labels; ii++)
-       label_stack[ii] = ntohl (mp->mr_next_hop_out_label_stack[ii]);
-    }
-
-  return (add_del_route_t_handler (mp->mr_is_multipath, mp->mr_is_add, 0,      // mp->is_drop,
-                                  0,   // mp->is_unreach,
-                                  0,   // mp->is_prohibit,
-                                  0,   // mp->is_local,
-                                  mp->mr_is_classify,
-                                  mp->mr_classify_table_index,
-                                  mp->mr_is_resolve_host,
-                                  mp->mr_is_resolve_attached,
-                                  fib_index, &pfx,
-                                  mp->mr_next_hop_proto_is_ip4,
-                                  &nh, ntohl (mp->mr_next_hop_sw_if_index),
-                                  next_hop_fib_index,
-                                  mp->mr_next_hop_weight,
-                                  ntohl (mp->mr_next_hop_via_label),
-                                  label_stack));
-}
-
-void
-vl_api_mpls_route_add_del_t_handler (vl_api_mpls_route_add_del_t * mp)
-{
-  vl_api_mpls_route_add_del_reply_t *rmp;
-  vnet_main_t *vnm;
-  int rv;
-
-  vnm = vnet_get_main ();
-  vnm->api_errno = 0;
-
-  rv = mpls_route_add_del_t_handler (vnm, mp);
-
-  rv = (rv == 0) ? vnm->api_errno : rv;
-
-  REPLY_MACRO (VL_API_MPLS_ROUTE_ADD_DEL_REPLY);
-}
-
-static int
-mpls_ip_bind_unbind_handler (vnet_main_t * vnm,
-                            vl_api_mpls_ip_bind_unbind_t * mp)
-{
-  u32 mpls_fib_index, ip_fib_index;
-
-  mpls_fib_index =
-    fib_table_find (FIB_PROTOCOL_MPLS, ntohl (mp->mb_mpls_table_id));
-
-  if (~0 == mpls_fib_index)
-    {
-      if (mp->mb_create_table_if_needed)
-       {
-         mpls_fib_index =
-           fib_table_find_or_create_and_lock (FIB_PROTOCOL_MPLS,
-                                              ntohl (mp->mb_mpls_table_id));
-       }
-      else
-       return VNET_API_ERROR_NO_SUCH_FIB;
-    }
-
-  ip_fib_index = fib_table_find ((mp->mb_is_ip4 ?
-                                 FIB_PROTOCOL_IP4 :
-                                 FIB_PROTOCOL_IP6),
-                                ntohl (mp->mb_ip_table_id));
-  if (~0 == ip_fib_index)
-    return VNET_API_ERROR_NO_SUCH_FIB;
-
-  fib_prefix_t pfx = {
-    .fp_len = mp->mb_address_length,
-  };
-
-  if (mp->mb_is_ip4)
-    {
-      pfx.fp_proto = FIB_PROTOCOL_IP4;
-      clib_memcpy (&pfx.fp_addr.ip4, mp->mb_address,
-                  sizeof (pfx.fp_addr.ip4));
-    }
-  else
-    {
-      pfx.fp_proto = FIB_PROTOCOL_IP6;
-      clib_memcpy (&pfx.fp_addr.ip6, mp->mb_address,
-                  sizeof (pfx.fp_addr.ip6));
-    }
-
-  if (mp->mb_is_bind)
-    fib_table_entry_local_label_add (ip_fib_index, &pfx,
-                                    ntohl (mp->mb_label));
-  else
-    fib_table_entry_local_label_remove (ip_fib_index, &pfx,
-                                       ntohl (mp->mb_label));
-
-  return (0);
-}
-
-void
-vl_api_mpls_ip_bind_unbind_t_handler (vl_api_mpls_ip_bind_unbind_t * mp)
-{
-  vl_api_mpls_route_add_del_reply_t *rmp;
-  vnet_main_t *vnm;
-  int rv;
-
-  vnm = vnet_get_main ();
-  vnm->api_errno = 0;
-
-  rv = mpls_ip_bind_unbind_handler (vnm, mp);
-
-  rv = (rv == 0) ? vnm->api_errno : rv;
-
-  REPLY_MACRO (VL_API_MPLS_ROUTE_ADD_DEL_REPLY);
-}
-
 static void
 vl_api_sw_interface_set_vpath_t_handler (vl_api_sw_interface_set_vpath_t * mp)
 {
@@ -690,278 +503,6 @@ static void
   REPLY_MACRO (VL_API_SW_INTERFACE_SET_L2_BRIDGE_REPLY);
 }
 
-static void
-vl_api_bridge_domain_add_del_t_handler (vl_api_bridge_domain_add_del_t * mp)
-{
-  vlib_main_t *vm = vlib_get_main ();
-  bd_main_t *bdm = &bd_main;
-  vl_api_bridge_domain_add_del_reply_t *rmp;
-  int rv = 0;
-  u32 enable_flags = 0, disable_flags = 0;
-  u32 bd_id = ntohl (mp->bd_id);
-  u32 bd_index;
-
-  if (mp->is_add)
-    {
-      bd_index = bd_find_or_add_bd_index (bdm, bd_id);
-
-      if (mp->flood)
-       enable_flags |= L2_FLOOD;
-      else
-       disable_flags |= L2_FLOOD;
-
-      if (mp->uu_flood)
-       enable_flags |= L2_UU_FLOOD;
-      else
-       disable_flags |= L2_UU_FLOOD;
-
-      if (mp->forward)
-       enable_flags |= L2_FWD;
-      else
-       disable_flags |= L2_FWD;
-
-      if (mp->arp_term)
-       enable_flags |= L2_ARP_TERM;
-      else
-       disable_flags |= L2_ARP_TERM;
-
-      if (mp->learn)
-       enable_flags |= L2_LEARN;
-      else
-       disable_flags |= L2_LEARN;
-
-      if (enable_flags)
-       bd_set_flags (vm, bd_index, enable_flags, 1 /* enable */ );
-
-      if (disable_flags)
-       bd_set_flags (vm, bd_index, disable_flags, 0 /* disable */ );
-
-      bd_set_mac_age (vm, bd_index, mp->mac_age);
-    }
-  else
-    rv = bd_delete_bd_index (bdm, bd_id);
-
-  REPLY_MACRO (VL_API_BRIDGE_DOMAIN_ADD_DEL_REPLY);
-}
-
-static void
-vl_api_bridge_domain_details_t_handler (vl_api_bridge_domain_details_t * mp)
-{
-  clib_warning ("BUG");
-}
-
-static void
-  vl_api_bridge_domain_sw_if_details_t_handler
-  (vl_api_bridge_domain_sw_if_details_t * mp)
-{
-  clib_warning ("BUG");
-}
-
-static void
-send_bridge_domain_details (unix_shared_memory_queue_t * q,
-                           l2_bridge_domain_t * bd_config,
-                           u32 n_sw_ifs, u32 context)
-{
-  vl_api_bridge_domain_details_t *mp;
-
-  mp = vl_msg_api_alloc (sizeof (*mp));
-  memset (mp, 0, sizeof (*mp));
-  mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_DETAILS);
-  mp->bd_id = ntohl (bd_config->bd_id);
-  mp->flood = bd_feature_flood (bd_config);
-  mp->uu_flood = bd_feature_uu_flood (bd_config);
-  mp->forward = bd_feature_forward (bd_config);
-  mp->learn = bd_feature_learn (bd_config);
-  mp->arp_term = bd_feature_arp_term (bd_config);
-  mp->bvi_sw_if_index = ntohl (bd_config->bvi_sw_if_index);
-  mp->mac_age = bd_config->mac_age;
-  mp->n_sw_ifs = ntohl (n_sw_ifs);
-  mp->context = context;
-
-  vl_msg_api_send_shmem (q, (u8 *) & mp);
-}
-
-static void
-send_bd_sw_if_details (l2input_main_t * l2im,
-                      unix_shared_memory_queue_t * q,
-                      l2_flood_member_t * member, u32 bd_id, u32 context)
-{
-  vl_api_bridge_domain_sw_if_details_t *mp;
-  l2_input_config_t *input_cfg;
-
-  mp = vl_msg_api_alloc (sizeof (*mp));
-  memset (mp, 0, sizeof (*mp));
-  mp->_vl_msg_id = ntohs (VL_API_BRIDGE_DOMAIN_SW_IF_DETAILS);
-  mp->bd_id = ntohl (bd_id);
-  mp->sw_if_index = ntohl (member->sw_if_index);
-  input_cfg = vec_elt_at_index (l2im->configs, member->sw_if_index);
-  mp->shg = input_cfg->shg;
-  mp->context = context;
-
-  vl_msg_api_send_shmem (q, (u8 *) & mp);
-}
-
-static void
-vl_api_bridge_domain_dump_t_handler (vl_api_bridge_domain_dump_t * mp)
-{
-  bd_main_t *bdm = &bd_main;
-  l2input_main_t *l2im = &l2input_main;
-  unix_shared_memory_queue_t *q;
-  l2_bridge_domain_t *bd_config;
-  u32 bd_id, bd_index;
-  u32 end;
-
-  q = vl_api_client_index_to_input_queue (mp->client_index);
-
-  if (q == 0)
-    return;
-
-  bd_id = ntohl (mp->bd_id);
-
-  bd_index = (bd_id == ~0) ? 0 : bd_find_or_add_bd_index (bdm, bd_id);
-  end = (bd_id == ~0) ? vec_len (l2im->bd_configs) : bd_index + 1;
-  for (; bd_index < end; bd_index++)
-    {
-      bd_config = l2input_bd_config_from_index (l2im, bd_index);
-      /* skip dummy bd_id 0 */
-      if (bd_config && (bd_config->bd_id > 0))
-       {
-         u32 n_sw_ifs;
-         l2_flood_member_t *m;
-
-         n_sw_ifs = vec_len (bd_config->members);
-         send_bridge_domain_details (q, bd_config, n_sw_ifs, mp->context);
-
-         vec_foreach (m, bd_config->members)
-         {
-           send_bd_sw_if_details (l2im, q, m, bd_config->bd_id, mp->context);
-         }
-       }
-    }
-}
-
-static void
-vl_api_l2fib_add_del_t_handler (vl_api_l2fib_add_del_t * mp)
-{
-  bd_main_t *bdm = &bd_main;
-  l2input_main_t *l2im = &l2input_main;
-  vl_api_l2fib_add_del_reply_t *rmp;
-  int rv = 0;
-  u64 mac = 0;
-  u32 sw_if_index = ntohl (mp->sw_if_index);
-  u32 bd_id = ntohl (mp->bd_id);
-  u32 bd_index;
-  u32 static_mac;
-  u32 filter_mac;
-  u32 bvi_mac;
-  uword *p;
-
-  mac = mp->mac;
-
-  p = hash_get (bdm->bd_index_by_bd_id, bd_id);
-  if (!p)
-    {
-      rv = VNET_API_ERROR_NO_SUCH_ENTRY;
-      goto bad_sw_if_index;
-    }
-  bd_index = p[0];
-
-  if (mp->is_add)
-    {
-      filter_mac = mp->filter_mac ? 1 : 0;
-      if (filter_mac == 0)
-       {
-         VALIDATE_SW_IF_INDEX (mp);
-         if (vec_len (l2im->configs) <= sw_if_index)
-           {
-             rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
-             goto bad_sw_if_index;
-           }
-         else
-           {
-             l2_input_config_t *config;
-             config = vec_elt_at_index (l2im->configs, sw_if_index);
-             if (config->bridge == 0)
-               {
-                 rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
-                 goto bad_sw_if_index;
-               }
-           }
-       }
-      static_mac = mp->static_mac ? 1 : 0;
-      bvi_mac = mp->bvi_mac ? 1 : 0;
-      l2fib_add_entry (mac, bd_index, sw_if_index, static_mac, filter_mac,
-                      bvi_mac);
-    }
-  else
-    {
-      l2fib_del_entry (mac, bd_index);
-    }
-
-  BAD_SW_IF_INDEX_LABEL;
-
-  REPLY_MACRO (VL_API_L2FIB_ADD_DEL_REPLY);
-}
-
-static void
-vl_api_l2_flags_t_handler (vl_api_l2_flags_t * mp)
-{
-  vl_api_l2_flags_reply_t *rmp;
-  int rv = 0;
-  u32 sw_if_index = ntohl (mp->sw_if_index);
-  u32 flags = ntohl (mp->feature_bitmap);
-  u32 rbm = 0;
-
-  VALIDATE_SW_IF_INDEX (mp);
-
-#define _(a,b) \
-    if (flags & L2INPUT_FEAT_ ## a) \
-        rbm = l2input_intf_bitmap_enable (sw_if_index, L2INPUT_FEAT_ ## a, mp->is_set);
-  foreach_l2input_feat;
-#undef _
-
-  BAD_SW_IF_INDEX_LABEL;
-
-  /* *INDENT-OFF* */
-  REPLY_MACRO2(VL_API_L2_FLAGS_REPLY,
-  ({
-    rmp->resulting_feature_bitmap = ntohl(rbm);
-  }));
-  /* *INDENT-ON* */
-}
-
-static void
-vl_api_bridge_flags_t_handler (vl_api_bridge_flags_t * mp)
-{
-  vlib_main_t *vm = vlib_get_main ();
-  bd_main_t *bdm = &bd_main;
-  vl_api_bridge_flags_reply_t *rmp;
-  int rv = 0;
-  u32 bd_id = ntohl (mp->bd_id);
-  u32 bd_index;
-  u32 flags = ntohl (mp->feature_bitmap);
-  uword *p;
-
-  p = hash_get (bdm->bd_index_by_bd_id, bd_id);
-  if (p == 0)
-    {
-      rv = VNET_API_ERROR_NO_SUCH_ENTRY;
-      goto out;
-    }
-
-  bd_index = p[0];
-
-  bd_set_flags (vm, bd_index, flags, mp->is_set);
-
-out:
-  /* *INDENT-OFF* */
-  REPLY_MACRO2(VL_API_BRIDGE_FLAGS_REPLY,
-  ({
-    rmp->resulting_feature_bitmap = ntohl(flags);
-  }));
-  /* *INDENT-ON* */
-}
-
 static void
 vl_api_bd_ip_mac_add_del_t_handler (vl_api_bd_ip_mac_add_del_t * mp)
 {
@@ -1147,64 +688,6 @@ out:
   /* *INDENT-ON* */
 }
 
-static void
-vl_api_mpls_tunnel_add_del_t_handler (vl_api_mpls_tunnel_add_del_t * mp)
-{
-  vl_api_mpls_tunnel_add_del_reply_t *rmp;
-  int rv = 0;
-  stats_main_t *sm = &stats_main;
-  u32 tunnel_sw_if_index;
-  int ii;
-
-  dslock (sm, 1 /* release hint */ , 5 /* tag */ );
-
-  if (mp->mt_is_add)
-    {
-      fib_route_path_t rpath, *rpaths = NULL;
-      mpls_label_t *label_stack = NULL;
-
-      memset (&rpath, 0, sizeof (rpath));
-
-      if (mp->mt_next_hop_proto_is_ip4)
-       {
-         rpath.frp_proto = FIB_PROTOCOL_IP4;
-         clib_memcpy (&rpath.frp_addr.ip4,
-                      mp->mt_next_hop, sizeof (rpath.frp_addr.ip4));
-       }
-      else
-       {
-         rpath.frp_proto = FIB_PROTOCOL_IP6;
-         clib_memcpy (&rpath.frp_addr.ip6,
-                      mp->mt_next_hop, sizeof (rpath.frp_addr.ip6));
-       }
-      rpath.frp_sw_if_index = ntohl (mp->mt_next_hop_sw_if_index);
-
-      for (ii = 0; ii < mp->mt_next_hop_n_out_labels; ii++)
-       vec_add1 (label_stack, ntohl (mp->mt_next_hop_out_label_stack[ii]));
-
-      vec_add1 (rpaths, rpath);
-
-      vnet_mpls_tunnel_add (rpaths, label_stack,
-                           mp->mt_l2_only, &tunnel_sw_if_index);
-      vec_free (rpaths);
-      vec_free (label_stack);
-    }
-  else
-    {
-      tunnel_sw_if_index = ntohl (mp->mt_sw_if_index);
-      vnet_mpls_tunnel_del (tunnel_sw_if_index);
-    }
-
-  dsunlock (sm);
-
-  /* *INDENT-OFF* */
-  REPLY_MACRO2(VL_API_MPLS_TUNNEL_ADD_DEL_REPLY,
-  ({
-    rmp->sw_if_index = ntohl(tunnel_sw_if_index);
-  }));
-  /* *INDENT-ON* */
-}
-
 static void
 vl_api_proxy_arp_add_del_t_handler (vl_api_proxy_arp_add_del_t * mp)
 {
@@ -1929,164 +1412,6 @@ vl_api_set_arp_neighbor_limit_t_handler (vl_api_set_arp_neighbor_limit_t * mp)
   REPLY_MACRO (VL_API_SET_ARP_NEIGHBOR_LIMIT_REPLY);
 }
 
-static void vl_api_sr_tunnel_add_del_t_handler
-  (vl_api_sr_tunnel_add_del_t * mp)
-{
-#if IP6SR == 0
-  clib_warning ("unimplemented");
-#else
-  ip6_sr_add_del_tunnel_args_t _a, *a = &_a;
-  int rv = 0;
-  vl_api_sr_tunnel_add_del_reply_t *rmp;
-  ip6_address_t *segments = 0, *seg;
-  ip6_address_t *tags = 0, *tag;
-  ip6_address_t *this_address;
-  int i;
-
-  if (mp->n_segments == 0)
-    {
-      rv = -11;
-      goto out;
-    }
-
-  memset (a, 0, sizeof (*a));
-  a->src_address = (ip6_address_t *) & mp->src_address;
-  a->dst_address = (ip6_address_t *) & mp->dst_address;
-  a->dst_mask_width = mp->dst_mask_width;
-  a->flags_net_byte_order = mp->flags_net_byte_order;
-  a->is_del = (mp->is_add == 0);
-  a->rx_table_id = ntohl (mp->outer_vrf_id);
-  a->tx_table_id = ntohl (mp->inner_vrf_id);
-
-  a->name = format (0, "%s", mp->name);
-  if (!(vec_len (a->name)))
-    a->name = 0;
-
-  a->policy_name = format (0, "%s", mp->policy_name);
-  if (!(vec_len (a->policy_name)))
-    a->policy_name = 0;
-
-  /* Yank segments and tags out of the API message */
-  this_address = (ip6_address_t *) mp->segs_and_tags;
-  for (i = 0; i < mp->n_segments; i++)
-    {
-      vec_add2 (segments, seg, 1);
-      clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
-      this_address++;
-    }
-  for (i = 0; i < mp->n_tags; i++)
-    {
-      vec_add2 (tags, tag, 1);
-      clib_memcpy (tag->as_u8, this_address->as_u8, sizeof (*this_address));
-      this_address++;
-    }
-
-  a->segments = segments;
-  a->tags = tags;
-
-  rv = ip6_sr_add_del_tunnel (a);
-
-out:
-
-  REPLY_MACRO (VL_API_SR_TUNNEL_ADD_DEL_REPLY);
-#endif
-}
-
-static void vl_api_sr_policy_add_del_t_handler
-  (vl_api_sr_policy_add_del_t * mp)
-{
-#if IP6SR == 0
-  clib_warning ("unimplemented");
-#else
-  ip6_sr_add_del_policy_args_t _a, *a = &_a;
-  int rv = 0;
-  vl_api_sr_policy_add_del_reply_t *rmp;
-  int i;
-
-  memset (a, 0, sizeof (*a));
-  a->is_del = (mp->is_add == 0);
-
-  a->name = format (0, "%s", mp->name);
-  if (!(vec_len (a->name)))
-    {
-      rv = VNET_API_ERROR_NO_SUCH_NODE2;
-      goto out;
-    }
-
-  if (!(mp->tunnel_names[0]))
-    {
-      rv = VNET_API_ERROR_NO_SUCH_NODE2;
-      goto out;
-    }
-
-  // start deserializing tunnel_names
-  int num_tunnels = mp->tunnel_names[0];       //number of tunnels
-  u8 *deser_tun_names = mp->tunnel_names;
-  deser_tun_names += 1;                //moving along
-
-  u8 *tun_name = 0;
-  int tun_name_len = 0;
-
-  for (i = 0; i < num_tunnels; i++)
-    {
-      tun_name_len = *deser_tun_names;
-      deser_tun_names += 1;
-      vec_resize (tun_name, tun_name_len);
-      memcpy (tun_name, deser_tun_names, tun_name_len);
-      vec_add1 (a->tunnel_names, tun_name);
-      deser_tun_names += tun_name_len;
-      tun_name = 0;
-    }
-
-  rv = ip6_sr_add_del_policy (a);
-
-out:
-
-  REPLY_MACRO (VL_API_SR_POLICY_ADD_DEL_REPLY);
-#endif
-}
-
-static void vl_api_sr_multicast_map_add_del_t_handler
-  (vl_api_sr_multicast_map_add_del_t * mp)
-{
-#if IP6SR == 0
-  clib_warning ("unimplemented");
-#else
-  ip6_sr_add_del_multicastmap_args_t _a, *a = &_a;
-  int rv = 0;
-  vl_api_sr_multicast_map_add_del_reply_t *rmp;
-
-  memset (a, 0, sizeof (*a));
-  a->is_del = (mp->is_add == 0);
-
-  a->multicast_address = (ip6_address_t *) & mp->multicast_address;
-  a->policy_name = format (0, "%s", mp->policy_name);
-
-  if (a->multicast_address == 0)
-    {
-      rv = -1;
-      goto out;
-    }
-
-  if (!(a->policy_name))
-    {
-      rv = -2;
-      goto out;
-    }
-
-#if DPDK > 0                   /* Cannot call replicate without DPDK */
-  rv = ip6_sr_add_del_multicastmap (a);
-#else
-  clib_warning ("multicast replication without DPDK not implemented");
-  rv = VNET_API_ERROR_UNIMPLEMENTED;
-#endif /* DPDK */
-
-out:
-
-  REPLY_MACRO (VL_API_SR_MULTICAST_MAP_ADD_DEL_REPLY);
-#endif
-}
-
 #define foreach_classify_add_del_table_field    \
 _(table_index)                                  \
 _(nbuckets)                                     \
@@ -2246,21 +1571,6 @@ static void vl_api_classify_set_interface_l2_tables_t_handler
   REPLY_MACRO (VL_API_CLASSIFY_SET_INTERFACE_L2_TABLES_REPLY);
 }
 
-static void
-vl_api_l2_fib_clear_table_t_handler (vl_api_l2_fib_clear_table_t * mp)
-{
-  int rv = 0;
-  vl_api_l2_fib_clear_table_reply_t *rmp;
-
-  /* DAW-FIXME: This API should only clear non-static l2fib entries, but
-   *            that is not currently implemented.  When that TODO is fixed
-   *            this call should be changed to pass 1 instead of 0.
-   */
-  l2fib_clear_table (0);
-
-  REPLY_MACRO (VL_API_L2_FIB_CLEAR_TABLE_REPLY);
-}
-
 extern void l2_efp_filter_configure (vnet_main_t * vnet_main,
                                     u32 sw_if_index, u32 enable);
 
@@ -2321,76 +1631,6 @@ static void
   REPLY_MACRO (VL_API_L2_INTERFACE_VLAN_TAG_REWRITE_REPLY);
 }
 
-static void
-vl_api_l2_fib_table_entry_t_handler (vl_api_l2_fib_table_entry_t * mp)
-{
-  clib_warning ("BUG");
-}
-
-static void
-send_l2fib_table_entry (vpe_api_main_t * am,
-                       unix_shared_memory_queue_t * q,
-                       l2fib_entry_key_t * l2fe_key,
-                       l2fib_entry_result_t * l2fe_res, u32 context)
-{
-  vl_api_l2_fib_table_entry_t *mp;
-
-  mp = vl_msg_api_alloc (sizeof (*mp));
-  memset (mp, 0, sizeof (*mp));
-  mp->_vl_msg_id = ntohs (VL_API_L2_FIB_TABLE_ENTRY);
-
-  mp->bd_id =
-    ntohl (l2input_main.bd_configs[l2fe_key->fields.bd_index].bd_id);
-
-  mp->mac = l2fib_make_key (l2fe_key->fields.mac, 0);
-  mp->sw_if_index = ntohl (l2fe_res->fields.sw_if_index);
-  mp->static_mac = l2fe_res->fields.static_mac;
-  mp->filter_mac = l2fe_res->fields.filter;
-  mp->bvi_mac = l2fe_res->fields.bvi;
-  mp->context = context;
-
-  vl_msg_api_send_shmem (q, (u8 *) & mp);
-}
-
-static void
-vl_api_l2_fib_table_dump_t_handler (vl_api_l2_fib_table_dump_t * mp)
-{
-  vpe_api_main_t *am = &vpe_api_main;
-  bd_main_t *bdm = &bd_main;
-  l2fib_entry_key_t *l2fe_key = NULL;
-  l2fib_entry_result_t *l2fe_res = NULL;
-  u32 ni, bd_id = ntohl (mp->bd_id);
-  u32 bd_index;
-  unix_shared_memory_queue_t *q;
-  uword *p;
-
-  q = vl_api_client_index_to_input_queue (mp->client_index);
-  if (q == 0)
-    return;
-
-  /* see l2fib_table_dump: ~0 means "any" */
-  if (bd_id == ~0)
-    bd_index = ~0;
-  else
-    {
-      p = hash_get (bdm->bd_index_by_bd_id, bd_id);
-      if (p == 0)
-       return;
-
-      bd_index = p[0];
-    }
-
-  l2fib_table_dump (bd_index, &l2fe_key, &l2fe_res);
-
-  vec_foreach_index (ni, l2fe_key)
-  {
-    send_l2fib_table_entry (am, q, vec_elt_at_index (l2fe_key, ni),
-                           vec_elt_at_index (l2fe_res, ni), mp->context);
-  }
-  vec_free (l2fe_key);
-  vec_free (l2fe_res);
-}
-
 static void
 vl_api_show_version_t_handler (vl_api_show_version_t * mp)
 {
@@ -3357,167 +2597,6 @@ vl_api_policer_classify_dump_t_handler (vl_api_policer_classify_dump_t * mp)
     }
 }
 
-static void
-vl_api_mpls_tunnel_details_t_handler (vl_api_mpls_fib_details_t * mp)
-{
-  clib_warning ("BUG");
-}
-
-typedef struct mpls_tunnel_send_walk_ctx_t_
-{
-  unix_shared_memory_queue_t *q;
-  u32 index;
-  u32 context;
-} mpls_tunnel_send_walk_ctx_t;
-
-static void
-send_mpls_tunnel_entry (u32 mti, void *arg)
-{
-  mpls_tunnel_send_walk_ctx_t *ctx;
-  vl_api_mpls_tunnel_details_t *mp;
-  const mpls_tunnel_t *mt;
-  u32 nlabels;
-
-  ctx = arg;
-
-  if (~0 != ctx->index && mti != ctx->index)
-    return;
-
-  mt = mpls_tunnel_get (mti);
-  nlabels = vec_len (mt->mt_label_stack);
-
-  mp = vl_msg_api_alloc (sizeof (*mp) + nlabels * sizeof (u32));
-  memset (mp, 0, sizeof (*mp));
-  mp->_vl_msg_id = ntohs (VL_API_MPLS_TUNNEL_DETAILS);
-  mp->context = ctx->context;
-
-  mp->tunnel_index = ntohl (mti);
-  memcpy (mp->mt_next_hop_out_labels,
-         mt->mt_label_stack, nlabels * sizeof (u32));
-
-  // FIXME
-
-  vl_msg_api_send_shmem (ctx->q, (u8 *) & mp);
-}
-
-static void
-vl_api_mpls_tunnel_dump_t_handler (vl_api_mpls_tunnel_dump_t * mp)
-{
-  unix_shared_memory_queue_t *q;
-
-  q = vl_api_client_index_to_input_queue (mp->client_index);
-  if (q == 0)
-    return;
-
-  mpls_tunnel_send_walk_ctx_t ctx = {
-    .q = q,
-    .index = ntohl (mp->tunnel_index),
-    .context = mp->context,
-  };
-  mpls_tunnel_walk (send_mpls_tunnel_entry, &ctx);
-}
-
-static void
-vl_api_mpls_fib_details_t_handler (vl_api_mpls_fib_details_t * mp)
-{
-  clib_warning ("BUG");
-}
-
-static void
-vl_api_mpls_fib_details_t_endian (vl_api_mpls_fib_details_t * mp)
-{
-  clib_warning ("BUG");
-}
-
-static void
-vl_api_mpls_fib_details_t_print (vl_api_mpls_fib_details_t * mp)
-{
-  clib_warning ("BUG");
-}
-
-static void
-send_mpls_fib_details (vpe_api_main_t * am,
-                      unix_shared_memory_queue_t * q,
-                      u32 table_id, u32 label, u32 eos,
-                      fib_route_path_encode_t * api_rpaths, u32 context)
-{
-  vl_api_mpls_fib_details_t *mp;
-  fib_route_path_encode_t *api_rpath;
-  vl_api_fib_path2_t *fp;
-  int path_count;
-
-  path_count = vec_len (api_rpaths);
-  mp = vl_msg_api_alloc (sizeof (*mp) + path_count * sizeof (*fp));
-  if (!mp)
-    return;
-  memset (mp, 0, sizeof (*mp));
-  mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_DETAILS);
-  mp->context = context;
-
-  mp->table_id = htonl (table_id);
-  mp->eos_bit = eos;
-  mp->label = htonl (label);
-
-  mp->count = htonl (path_count);
-  fp = mp->path;
-  vec_foreach (api_rpath, api_rpaths)
-  {
-    memset (fp, 0, sizeof (*fp));
-    fp->weight = htonl (api_rpath->rpath.frp_weight);
-    fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
-    copy_fib_next_hop (api_rpath, fp);
-    fp++;
-  }
-
-  vl_msg_api_send_shmem (q, (u8 *) & mp);
-}
-
-static void
-vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
-{
-  vpe_api_main_t *am = &vpe_api_main;
-  unix_shared_memory_queue_t *q;
-  mpls_main_t *mm = &mpls_main;
-  fib_table_t *fib_table;
-  fib_node_index_t lfei, *lfeip, *lfeis = NULL;
-  mpls_label_t key;
-  fib_prefix_t pfx;
-  u32 fib_index;
-  fib_route_path_encode_t *api_rpaths;
-
-  q = vl_api_client_index_to_input_queue (mp->client_index);
-  if (q == 0)
-    return;
-
-  /* *INDENT-OFF* */
-  pool_foreach (fib_table, mm->fibs,
-  ({
-    hash_foreach(key, lfei, fib_table->mpls.mf_entries,
-    ({
-       vec_add1(lfeis, lfei);
-    }));
-  }));
-  vec_sort_with_function(lfeis, fib_entry_cmp_for_sort);
-
-  vec_foreach(lfeip, lfeis)
-  {
-    fib_entry_get_prefix(*lfeip, &pfx);
-    fib_index = fib_entry_get_fib_index(*lfeip);
-    fib_table = fib_table_get(fib_index, pfx.fp_proto);
-    api_rpaths = NULL;
-    fib_entry_encode(*lfeip, &api_rpaths);
-    send_mpls_fib_details (am, q,
-                          fib_table->ft_table_id,
-                          pfx.fp_label,
-                          pfx.fp_eos,
-                           api_rpaths,
-                          mp->context);
-    vec_free(api_rpaths);
-  }
-
-  vec_free (lfeis);
-}
-
 static void
 vl_api_classify_table_ids_t_handler (vl_api_classify_table_ids_t * mp)
 {
@@ -4487,32 +3566,8 @@ vpe_api_hookup (vlib_main_t * vm)
 #undef _
 
   /*
-   * Manually register the sr tunnel add del msg, so we trace
-   * enough bytes to capture a typical segment list
-   */
-  vl_msg_api_set_handlers (VL_API_SR_TUNNEL_ADD_DEL,
-                          "sr_tunnel_add_del",
-                          vl_api_sr_tunnel_add_del_t_handler,
-                          vl_noop_handler,
-                          vl_api_sr_tunnel_add_del_t_endian,
-                          vl_api_sr_tunnel_add_del_t_print, 256, 1);
-
-
-  /*
-   * Manually register the sr policy add del msg, so we trace
-   * enough bytes to capture a typical tunnel name list
-   */
-  vl_msg_api_set_handlers (VL_API_SR_POLICY_ADD_DEL,
-                          "sr_policy_add_del",
-                          vl_api_sr_policy_add_del_t_handler,
-                          vl_noop_handler,
-                          vl_api_sr_policy_add_del_t_endian,
-                          vl_api_sr_policy_add_del_t_print, 256, 1);
-
-  /*
-   * Trace space for 8 MPLS encap labels, classifier mask+match
+   * Trace space for classifier mask+match
    */
-  am->api_trace_cfg[VL_API_MPLS_TUNNEL_ADD_DEL].size += 8 * sizeof (u32);
   am->api_trace_cfg[VL_API_CLASSIFY_ADD_DEL_TABLE].size += 5 * sizeof (u32x4);
   am->api_trace_cfg[VL_API_CLASSIFY_ADD_DEL_SESSION].size
     += 5 * sizeof (u32x4);