Beispiel #1
0
Datei: nsim.c Projekt: chrisy/vpp
/* API message handler */
static void vl_api_nsim_cross_connect_enable_disable_t_handler
  (vl_api_nsim_cross_connect_enable_disable_t * mp)
{
  vl_api_nsim_cross_connect_enable_disable_reply_t *rmp;
  nsim_main_t *nsm = &nsim_main;
  int rv;
  u32 sw_if_index0, sw_if_index1;

  sw_if_index0 = clib_net_to_host_u32 (mp->sw_if_index0);
  sw_if_index1 = clib_net_to_host_u32 (mp->sw_if_index1);

  if (!vnet_sw_if_index_is_api_valid (sw_if_index0))
    {
      rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
      goto bad_sw_if_index;
    }
  if (!vnet_sw_if_index_is_api_valid (sw_if_index1))
    {
      rv = VNET_API_ERROR_INVALID_SW_IF_INDEX_2;
      goto bad_sw_if_index;
    }

  rv = nsim_cross_connect_enable_disable (nsm, sw_if_index0, sw_if_index1,
					  (int) (mp->enable_disable));

  BAD_SW_IF_INDEX_LABEL;
  REPLY_MACRO (VL_API_NSIM_CROSS_CONNECT_ENABLE_DISABLE_REPLY);
}
Beispiel #2
0
Datei: cdp.c Projekt: chrisy/vpp
/* API message handler */
static void vl_api_cdp_enable_disable_t_handler
  (vl_api_cdp_enable_disable_t * mp)
{
  vl_api_cdp_enable_disable_reply_t *rmp;
  cdp_main_t *cm = &cdp_main;
  int rv;

  rv = cdp_enable_disable (cm, (int) (mp->enable_disable));

  REPLY_MACRO (VL_API_CDP_ENABLE_DISABLE_REPLY);
}
Beispiel #3
0
/* API message handler */
static void vl_api_sample_macswap_enable_disable_t_handler
(vl_api_sample_macswap_enable_disable_t * mp)
{
  vl_api_sample_macswap_enable_disable_reply_t * rmp;
  sample_main_t * sm = &sample_main;
  int rv;

  rv = sample_macswap_enable_disable (sm, ntohl(mp->sw_if_index), 
                                      (int) (mp->enable_disable));
  
  REPLY_MACRO(VL_API_SAMPLE_MACSWAP_ENABLE_DISABLE_REPLY);
}
Beispiel #4
0
/* API message handler */
static void vl_api_ioam_export_ip6_enable_disable_t_handler
  (vl_api_ioam_export_ip6_enable_disable_t * mp)
{
  vl_api_ioam_export_ip6_enable_disable_reply_t *rmp;
  ioam_export_main_t *sm = &ioam_export_main;
  int rv;

  rv = ioam_export_ip6_enable_disable (sm, (int) (mp->is_disable),
				       (ip4_address_t *)
				       mp->collector_address,
				       (ip4_address_t *) mp->src_address);

  REPLY_MACRO (VL_API_IOAM_EXPORT_IP6_ENABLE_DISABLE_REPLY);
}
Beispiel #5
0
Datei: nsim.c Projekt: chrisy/vpp
/* API message handler */
static void vl_api_nsim_output_feature_enable_disable_t_handler
  (vl_api_nsim_output_feature_enable_disable_t * mp)
{
  vl_api_nsim_output_feature_enable_disable_reply_t *rmp;
  nsim_main_t *nsm = &nsim_main;
  int rv;
  VALIDATE_SW_IF_INDEX (mp);

  rv = nsim_output_feature_enable_disable (nsm, ntohl (mp->sw_if_index),
					   (int) (mp->enable_disable));

  BAD_SW_IF_INDEX_LABEL;
  REPLY_MACRO (VL_API_NSIM_OUTPUT_FEATURE_ENABLE_DISABLE_REPLY);
}
Beispiel #6
0
void
vl_api_flowprobe_params_t_handler (vl_api_flowprobe_params_t * mp)
{
  flowprobe_main_t *fm = &flowprobe_main;
  vl_api_flowprobe_params_reply_t *rmp;
  int rv = 0;

  rv = flowprobe_params
    (fm, mp->record_l2, mp->record_l3, mp->record_l4,
     clib_net_to_host_u32 (mp->active_timer),
     clib_net_to_host_u32 (mp->passive_timer));

  REPLY_MACRO (VL_API_FLOWPROBE_PARAMS_REPLY);
}
Beispiel #7
0
static void
  vl_api_sw_interface_set_vxlan_gbp_bypass_t_handler
  (vl_api_sw_interface_set_vxlan_gbp_bypass_t * mp)
{
  vl_api_sw_interface_set_vxlan_gbp_bypass_reply_t *rmp;
  int rv = 0;
  u32 sw_if_index = ntohl (mp->sw_if_index);

  VALIDATE_SW_IF_INDEX (mp);

  vnet_int_vxlan_gbp_bypass_mode (sw_if_index, mp->is_ipv6, mp->enable);
  BAD_SW_IF_INDEX_LABEL;

  REPLY_MACRO (VL_API_SW_INTERFACE_SET_VXLAN_GBP_BYPASS_REPLY);
}
Beispiel #8
0
void
  vl_api_dhcp6_pd_send_client_message_t_handler
  (vl_api_dhcp6_pd_send_client_message_t * mp)
{
  vl_api_dhcp6_pd_send_client_message_reply_t *rmp;
  dhcp6_pd_send_client_message_params_t params;
  vlib_main_t *vm = vlib_get_main ();
  u32 n_prefixes;
  u32 i;
  int rv = 0;

  VALIDATE_SW_IF_INDEX (mp);

  BAD_SW_IF_INDEX_LABEL;
  REPLY_MACRO (VL_API_DHCP6_PD_SEND_CLIENT_MESSAGE_REPLY);

  if (rv != 0)
    return;

  params.sw_if_index = ntohl (mp->sw_if_index);
  params.server_index = ntohl (mp->server_index);
  params.irt = ntohl (mp->irt);
  params.mrt = ntohl (mp->mrt);
  params.mrc = ntohl (mp->mrc);
  params.mrd = ntohl (mp->mrd);
  params.msg_type = mp->msg_type;
  params.T1 = ntohl (mp->T1);
  params.T2 = ntohl (mp->T2);
  n_prefixes = ntohl (mp->n_prefixes);
  params.prefixes = 0;
  if (n_prefixes > 0)
    vec_validate (params.prefixes, n_prefixes - 1);
  for (i = 0; i < n_prefixes; i++)
    {
      vl_api_dhcp6_pd_prefix_info_t *pi = &mp->prefixes[i];
      dhcp6_pd_send_client_message_params_prefix_t *pref =
	&params.prefixes[i];
      pref->preferred_lt = ntohl (pi->preferred_time);
      pref->valid_lt = ntohl (pi->valid_time);
      memcpy (pref->prefix.as_u8, pi->prefix, 16);
      pref->prefix_length = pi->prefix_length;
    }

  dhcp6_pd_send_client_message (vm, ntohl (mp->sw_if_index), mp->stop,
				&params);
}
Beispiel #9
0
/**
 * @brief API message handler
 * @param mp vl_api_flowprobe_tx_interface_add_del_t * mp the api message
 */
void vl_api_flowprobe_tx_interface_add_del_t_handler
  (vl_api_flowprobe_tx_interface_add_del_t * mp)
{
  flowprobe_main_t *fm = &flowprobe_main;
  vl_api_flowprobe_tx_interface_add_del_reply_t *rmp;
  u32 sw_if_index = ntohl (mp->sw_if_index);
  int rv = 0;

  VALIDATE_SW_IF_INDEX (mp);

  if (mp->which != FLOW_VARIANT_IP4 && mp->which != FLOW_VARIANT_L2
      && mp->which != FLOW_VARIANT_IP6)
    {
      rv = VNET_API_ERROR_UNIMPLEMENTED;
      goto out;
    }

  if (fm->record == 0)
    {
      clib_warning ("Please specify flowprobe params record first...");
      rv = VNET_API_ERROR_CANNOT_ENABLE_DISABLE_FEATURE;
      goto out;
    }

  rv = validate_feature_on_interface (fm, sw_if_index, mp->which);
  if ((rv == 1 && mp->is_add == 1) || rv == 0)
    {
      rv = VNET_API_ERROR_CANNOT_ENABLE_DISABLE_FEATURE;
      goto out;
    }

  rv = flowprobe_tx_interface_add_del_feature
    (fm, sw_if_index, mp->which, mp->is_add);

out:
  BAD_SW_IF_INDEX_LABEL;

  REPLY_MACRO (VL_API_FLOWPROBE_TX_INTERFACE_ADD_DEL_REPLY);
}
Beispiel #10
0
Datei: nsim.c Projekt: chrisy/vpp
/* API message handler */
static void
vl_api_nsim_configure_t_handler (vl_api_nsim_configure_t * mp)
{
  vl_api_nsim_configure_reply_t *rmp;
  nsim_main_t *nsm = &nsim_main;
  f64 delay, bandwidth, packet_size, drop_fraction;
  u32 packets_per_drop;
  int rv;

  delay = ((f64) (ntohl (mp->delay_in_usec))) * 1e-6;
  bandwidth = (f64) (clib_net_to_host_u64 (mp->bandwidth_in_bits_per_second));
  packet_size = (f64) (ntohl (mp->average_packet_size));

  packets_per_drop = ntohl (mp->packets_per_drop);
  if (packets_per_drop > 0)
    drop_fraction = 1.0 / (f64) (packets_per_drop);
  else
    drop_fraction = 0.0;

  rv = nsim_configure (nsm, bandwidth, delay, packet_size, drop_fraction);

  REPLY_MACRO (VL_API_NSIM_CONFIGURE_REPLY);
}