2 *------------------------------------------------------------------
3 * api.c - message handler registration
5 * Copyright (c) 2010 Cisco and/or its affiliates.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at:
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *------------------------------------------------------------------
22 #include <sys/types.h>
25 #include <netinet/in.h>
32 #include <vppinfra/clib.h>
33 #include <vppinfra/vec.h>
34 #include <vppinfra/hash.h>
35 #include <vppinfra/bitmap.h>
36 #include <vppinfra/fifo.h>
37 #include <vppinfra/time.h>
38 #include <vppinfra/mheap.h>
39 #include <vppinfra/heap.h>
40 #include <vppinfra/pool.h>
41 #include <vppinfra/format.h>
42 #include <vppinfra/error.h>
44 #include <vnet/vnet.h>
45 #include <vlib/vlib.h>
46 #include <vlib/unix/unix.h>
47 #include <vlibapi/api.h>
48 #include <vlibmemory/api.h>
50 #include <vpp/api/vpe_msg_enum.h>
52 #include <vnet/ip/ip.h>
53 #include <vnet/interface.h>
56 #define f64_print(a,b)
58 #define vl_typedefs /* define message structures */
59 #include <vpp/api/vpe_all_api_h.h>
62 #define vl_endianfun /* define message structures */
63 #include <vpp/api/vpe_all_api_h.h>
66 /* instantiate all the print functions we know about */
67 #define vl_print(handle, ...)
69 #include <vpp/api/vpe_all_api_h.h>
72 vl_shmem_hdr_t *shmem_hdr;
81 svm_queue_t *vl_input_queue;
85 test_main_t test_main;
88 * Satisfy external references when -lvlib is not available.
90 vlib_main_t vlib_global_main;
91 vlib_main_t **vlib_mains;
94 vlib_cli_output (struct vlib_main_t *vm, char *fmt, ...)
96 clib_warning ("vlib_cli_output called...");
100 format_ethernet_address (u8 * s, va_list * args)
102 u8 *a = va_arg (*args, u8 *);
104 return format (s, "%02x:%02x:%02x:%02x:%02x:%02x",
105 a[0], a[1], a[2], a[3], a[4], a[5]);
109 vl_api_sw_interface_details_t_handler (vl_api_sw_interface_details_t * mp)
111 char *duplex, *speed;
113 switch (mp->link_duplex << VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT)
115 case VNET_HW_INTERFACE_FLAG_HALF_DUPLEX:
118 case VNET_HW_INTERFACE_FLAG_FULL_DUPLEX:
125 switch (mp->link_speed << VNET_HW_INTERFACE_FLAG_SPEED_SHIFT)
127 case VNET_HW_INTERFACE_FLAG_SPEED_10M:
130 case VNET_HW_INTERFACE_FLAG_SPEED_100M:
133 case VNET_HW_INTERFACE_FLAG_SPEED_1G:
136 case VNET_HW_INTERFACE_FLAG_SPEED_2_5G:
139 case VNET_HW_INTERFACE_FLAG_SPEED_5G:
142 case VNET_HW_INTERFACE_FLAG_SPEED_10G:
145 case VNET_HW_INTERFACE_FLAG_SPEED_20G:
148 case VNET_HW_INTERFACE_FLAG_SPEED_25G:
151 case VNET_HW_INTERFACE_FLAG_SPEED_40G:
154 case VNET_HW_INTERFACE_FLAG_SPEED_50G:
157 case VNET_HW_INTERFACE_FLAG_SPEED_56G:
160 case VNET_HW_INTERFACE_FLAG_SPEED_100G:
167 fformat (stdout, "details: %s sw_if_index %d sup_sw_if_index %d "
168 "link_duplex %s link_speed %s",
169 mp->interface_name, ntohl (mp->sw_if_index),
170 ntohl (mp->sup_sw_if_index), duplex, speed);
172 if (mp->l2_address_length)
173 fformat (stdout, " l2 address: %U\n",
174 format_ethernet_address, mp->l2_address);
176 fformat (stdout, "\n");
180 vl_api_sw_interface_set_flags_t_handler (vl_api_sw_interface_set_flags_t * mp)
182 fformat (stdout, "set flags: sw_if_index %d, admin %s\n",
183 ntohl (mp->sw_if_index), mp->admin_up_down ? "up" : "down");
187 vl_api_sw_interface_set_flags_reply_t_handler
188 (vl_api_sw_interface_set_flags_reply_t * mp)
190 fformat (stdout, "set flags reply: reply %d\n", ntohl (mp->retval));
194 vl_api_want_interface_events_reply_t_handler
195 (vl_api_want_interface_events_reply_t * mp)
200 vl_api_want_stats_reply_t_handler (vl_api_want_stats_reply_t * mp)
202 fformat (stdout, "want stats reply %d\n", ntohl (mp->retval));
206 vl_api_want_oam_events_reply_t_handler (vl_api_want_oam_events_reply_t * mp)
208 fformat (stdout, "want oam reply %d\n", ntohl (mp->retval));
212 vl_api_ip_add_del_route_reply_t_handler (vl_api_ip_add_del_route_reply_t * mp)
214 fformat (stdout, "add_route reply %d\n", ntohl (mp->retval));
218 vl_api_sw_interface_add_del_address_reply_t_handler
219 (vl_api_sw_interface_add_del_address_reply_t * mp)
221 fformat (stdout, "add_del_address reply %d\n", ntohl (mp->retval));
225 vl_api_sw_interface_set_table_reply_t_handler
226 (vl_api_sw_interface_set_table_reply_t * mp)
228 fformat (stdout, "set_table reply %d\n", ntohl (mp->retval));
232 vl_api_tap_connect_reply_t_handler (vl_api_tap_connect_reply_t * mp)
234 fformat (stdout, "tap connect reply %d, sw_if_index %d\n",
235 ntohl (mp->retval), ntohl (mp->sw_if_index));
239 vl_api_create_vlan_subif_reply_t_handler (vl_api_create_vlan_subif_reply_t *
242 fformat (stdout, "create vlan subif reply %d, sw_if_index %d\n",
243 ntohl (mp->retval), ntohl (mp->sw_if_index));
246 static void vl_api_proxy_arp_add_del_reply_t_handler
247 (vl_api_proxy_arp_add_del_reply_t * mp)
249 fformat (stdout, "add del proxy arp reply %d\n", ntohl (mp->retval));
252 static void vl_api_proxy_arp_intfc_enable_disable_reply_t_handler
253 (vl_api_proxy_arp_intfc_enable_disable_reply_t * mp)
255 fformat (stdout, "proxy arp intfc ena/dis reply %d\n", ntohl (mp->retval));
258 static void vl_api_ip_neighbor_add_del_reply_t_handler
259 (vl_api_ip_neighbor_add_del_reply_t * mp)
261 fformat (stdout, "ip neighbor add del reply %d\n", ntohl (mp->retval));
266 vl_api_vnet_interface_counters_t_handler (vl_api_vnet_interface_counters_t *
270 u32 count, sw_if_index;
273 count = ntohl (mp->count);
274 sw_if_index = ntohl (mp->first_sw_if_index);
275 if (mp->is_combined == 0)
278 vp = (u64 *) mp->data;
280 switch (mp->vnet_counter_type)
282 case VNET_INTERFACE_COUNTER_DROP:
283 counter_name = "drop";
285 case VNET_INTERFACE_COUNTER_PUNT:
286 counter_name = "punt";
288 case VNET_INTERFACE_COUNTER_IP4:
289 counter_name = "ip4";
291 case VNET_INTERFACE_COUNTER_IP6:
292 counter_name = "ip6";
294 case VNET_INTERFACE_COUNTER_RX_NO_BUF:
295 counter_name = "rx-no-buf";
297 case VNET_INTERFACE_COUNTER_RX_MISS:
298 counter_name = "rx-miss";
300 case VNET_INTERFACE_COUNTER_RX_ERROR:
301 counter_name = "rx-error";
303 case VNET_INTERFACE_COUNTER_TX_ERROR:
304 counter_name = "tx-error (fifo-full)";
307 counter_name = "bogus";
310 for (i = 0; i < count; i++)
312 v = clib_mem_unaligned (vp, u64);
313 v = clib_net_to_host_u64 (v);
315 fformat (stdout, "%d.%s %lld\n", sw_if_index, counter_name, v);
323 vp = (vlib_counter_t *) mp->data;
325 switch (mp->vnet_counter_type)
327 case VNET_INTERFACE_COUNTER_RX:
330 case VNET_INTERFACE_COUNTER_TX:
334 counter_name = "bogus";
337 for (i = 0; i < count; i++)
339 packets = clib_mem_unaligned (&vp->packets, u64);
340 packets = clib_net_to_host_u64 (packets);
341 bytes = clib_mem_unaligned (&vp->bytes, u64);
342 bytes = clib_net_to_host_u64 (bytes);
344 fformat (stdout, "%d.%s.packets %lld\n",
345 sw_if_index, counter_name, packets);
346 fformat (stdout, "%d.%s.bytes %lld\n",
347 sw_if_index, counter_name, bytes);
354 /* Format an IP4 address. */
356 format_ip4_address (u8 * s, va_list * args)
358 u8 *a = va_arg (*args, u8 *);
359 return format (s, "%d.%d.%d.%d", a[0], a[1], a[2], a[3]);
362 /* Format an IP4 route destination and length. */
364 format_ip4_address_and_length (u8 * s, va_list * args)
366 u8 *a = va_arg (*args, u8 *);
367 u8 l = va_arg (*args, u32);
368 return format (s, "%U/%d", format_ip4_address, a, l);
372 vl_api_vnet_ip4_fib_counters_t_handler (vl_api_vnet_ip4_fib_counters_t * mp)
375 vl_api_ip4_fib_counter_t *ctrp;
378 count = ntohl (mp->count);
380 fformat (stdout, "fib id %d, count this msg %d\n",
381 ntohl (mp->vrf_id), count);
384 for (i = 0; i < count; i++)
386 fformat (stdout, "%U: %lld packets, %lld bytes\n",
387 format_ip4_address_and_length, &ctrp->address,
388 (u32) ctrp->address_length,
389 clib_net_to_host_u64 (ctrp->packets),
390 clib_net_to_host_u64 (ctrp->bytes));
395 /* Format an IP6 address. */
397 format_ip6_address (u8 * s, va_list * args)
399 ip6_address_t *a = va_arg (*args, ip6_address_t *);
400 u32 i, i_max_n_zero, max_n_zeros, i_first_zero, n_zeros, last_double_colon;
402 i_max_n_zero = ARRAY_LEN (a->as_u16);
404 i_first_zero = i_max_n_zero;
406 for (i = 0; i < ARRAY_LEN (a->as_u16); i++)
408 u32 is_zero = a->as_u16[i] == 0;
409 if (is_zero && i_first_zero >= ARRAY_LEN (a->as_u16))
415 if ((!is_zero && n_zeros > max_n_zeros)
416 || (i + 1 >= ARRAY_LEN (a->as_u16) && n_zeros > max_n_zeros))
418 i_max_n_zero = i_first_zero;
419 max_n_zeros = n_zeros;
420 i_first_zero = ARRAY_LEN (a->as_u16);
425 last_double_colon = 0;
426 for (i = 0; i < ARRAY_LEN (a->as_u16); i++)
428 if (i == i_max_n_zero && max_n_zeros > 1)
430 s = format (s, "::");
431 i += max_n_zeros - 1;
432 last_double_colon = 1;
436 s = format (s, "%s%x",
437 (last_double_colon || i == 0) ? "" : ":",
438 clib_net_to_host_u16 (a->as_u16[i]));
439 last_double_colon = 0;
446 /* Format an IP6 route destination and length. */
448 format_ip6_address_and_length (u8 * s, va_list * args)
450 ip6_address_t *a = va_arg (*args, ip6_address_t *);
451 u8 l = va_arg (*args, u32);
452 return format (s, "%U/%d", format_ip6_address, a, l);
456 vl_api_vnet_ip6_fib_counters_t_handler (vl_api_vnet_ip6_fib_counters_t * mp)
459 vl_api_ip6_fib_counter_t *ctrp;
462 count = ntohl (mp->count);
464 fformat (stdout, "fib id %d, count this msg %d\n",
465 ntohl (mp->vrf_id), count);
468 for (i = 0; i < count; i++)
470 fformat (stdout, "%U: %lld packets, %lld bytes\n",
471 format_ip6_address_and_length, &ctrp->address,
472 (u32) ctrp->address_length,
473 clib_net_to_host_u64 (ctrp->packets),
474 clib_net_to_host_u64 (ctrp->bytes));
480 vl_api_oam_event_t_handler (vl_api_oam_event_t * mp)
482 fformat (stdout, "OAM: %U now %s\n",
483 format_ip4_address, &mp->dst_address,
484 mp->state == 1 ? "alive" : "dead");
488 vl_api_oam_add_del_reply_t_handler (vl_api_oam_add_del_reply_t * mp)
490 fformat (stdout, "oam add del reply %d\n", ntohl (mp->retval));
494 vl_api_reset_fib_reply_t_handler (vl_api_reset_fib_reply_t * mp)
496 fformat (stdout, "fib reset reply %d\n", ntohl (mp->retval));
500 vl_api_dhcp_proxy_set_vss_reply_t_handler (vl_api_dhcp_proxy_set_vss_reply_t *
503 fformat (stdout, "dhcp proxy set vss reply %d\n", ntohl (mp->retval));
507 vl_api_dhcp_proxy_config_reply_t_handler (vl_api_dhcp_proxy_config_reply_t *
510 fformat (stdout, "dhcp proxy config reply %d\n", ntohl (mp->retval));
514 vl_api_set_ip_flow_hash_reply_t_handler (vl_api_set_ip_flow_hash_reply_t * mp)
516 fformat (stdout, "set ip flow hash reply %d\n", ntohl (mp->retval));
520 vl_api_sw_interface_ip6nd_ra_config_reply_t_handler
521 (vl_api_sw_interface_ip6nd_ra_config_reply_t * mp)
523 fformat (stdout, "ip6 nd ra-config reply %d\n", ntohl (mp->retval));
527 vl_api_sw_interface_ip6nd_ra_prefix_reply_t_handler
528 (vl_api_sw_interface_ip6nd_ra_prefix_reply_t * mp)
530 fformat (stdout, "ip6 nd ra-prefix reply %d\n", ntohl (mp->retval));
534 vl_api_sw_interface_ip6_enable_disable_reply_t_handler
535 (vl_api_sw_interface_ip6_enable_disable_reply_t * mp)
537 fformat (stdout, "ip6 enable/disable reply %d\n", ntohl (mp->retval));
541 vl_api_sw_interface_ip6_set_link_local_address_reply_t_handler
542 (vl_api_sw_interface_ip6_set_link_local_address_reply_t * mp)
544 fformat (stdout, "ip6 set link-local address reply %d\n",
548 static void vl_api_create_loopback_reply_t_handler
549 (vl_api_create_loopback_reply_t * mp)
551 fformat (stdout, "create loopback status %d, sw_if_index %d\n",
552 ntohl (mp->retval), ntohl (mp->sw_if_index));
555 static void vl_api_create_loopback_instance_reply_t_handler
556 (vl_api_create_loopback_instance_reply_t * mp)
558 fformat (stdout, "create loopback status %d, sw_if_index %d\n",
559 ntohl (mp->retval), ntohl (mp->sw_if_index));
562 static void vl_api_l2_patch_add_del_reply_t_handler
563 (vl_api_l2_patch_add_del_reply_t * mp)
565 fformat (stdout, "l2 patch reply %d\n", ntohl (mp->retval));
568 static void vl_api_sw_interface_set_l2_xconnect_reply_t_handler
569 (vl_api_sw_interface_set_l2_xconnect_reply_t * mp)
571 fformat (stdout, "l2_xconnect reply %d\n", ntohl (mp->retval));
574 static void vl_api_sw_interface_set_l2_bridge_reply_t_handler
575 (vl_api_sw_interface_set_l2_bridge_reply_t * mp)
577 fformat (stdout, "l2_bridge reply %d\n", ntohl (mp->retval));
581 noop_handler (void *notused)
585 #define vl_api_vnet_ip4_fib_counters_t_endian noop_handler
586 #define vl_api_vnet_ip4_fib_counters_t_print noop_handler
587 #define vl_api_vnet_ip6_fib_counters_t_endian noop_handler
588 #define vl_api_vnet_ip6_fib_counters_t_print noop_handler
590 #define foreach_api_msg \
591 _(SW_INTERFACE_DETAILS, sw_interface_details) \
592 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
593 _(SW_INTERFACE_SET_FLAGS_REPLY, sw_interface_set_flags_reply) \
594 _(WANT_INTERFACE_EVENTS_REPLY, want_interface_events_reply) \
595 _(WANT_STATS_REPLY, want_stats_reply) \
596 _(WANT_OAM_EVENTS_REPLY, want_oam_events_reply) \
597 _(OAM_EVENT, oam_event) \
598 _(OAM_ADD_DEL_REPLY, oam_add_del_reply) \
599 _(VNET_IP4_FIB_COUNTERS, vnet_ip4_fib_counters) \
600 _(VNET_IP6_FIB_COUNTERS, vnet_ip6_fib_counters) \
601 _(IP_ADD_DEL_ROUTE_REPLY, ip_add_del_route_reply) \
602 _(SW_INTERFACE_ADD_DEL_ADDRESS_REPLY, sw_interface_add_del_address_reply) \
603 _(SW_INTERFACE_SET_TABLE_REPLY, sw_interface_set_table_reply) \
604 _(TAP_CONNECT_REPLY, tap_connect_reply) \
605 _(CREATE_VLAN_SUBIF_REPLY, create_vlan_subif_reply) \
606 _(PROXY_ARP_ADD_DEL_REPLY, proxy_arp_add_del_reply) \
607 _(PROXY_ARP_INTFC_ENABLE_DISABLE_REPLY, proxy_arp_intfc_enable_disable_reply) \
608 _(IP_NEIGHBOR_ADD_DEL_REPLY, ip_neighbor_add_del_reply) \
609 _(RESET_FIB_REPLY, reset_fib_reply) \
610 _(DHCP_PROXY_CONFIG_REPLY, dhcp_proxy_config_reply) \
611 _(DHCP_PROXY_SET_VSS_REPLY, dhcp_proxy_set_vss_reply) \
612 _(SET_IP_FLOW_HASH_REPLY, set_ip_flow_hash_reply) \
613 _(SW_INTERFACE_IP6ND_RA_CONFIG_REPLY, sw_interface_ip6nd_ra_config_reply) \
614 _(SW_INTERFACE_IP6ND_RA_PREFIX_REPLY, sw_interface_ip6nd_ra_prefix_reply) \
615 _(SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY, sw_interface_ip6_enable_disable_reply) \
616 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY, sw_interface_ip6_set_link_local_address_reply) \
617 _(CREATE_LOOPBACK_REPLY, create_loopback_reply) \
618 _(CREATE_LOOPBACK_INSTANCE_REPLY, create_loopback_instance_reply) \
619 _(L2_PATCH_ADD_DEL_REPLY, l2_patch_add_del_reply) \
620 _(SW_INTERFACE_SET_L2_XCONNECT_REPLY, sw_interface_set_l2_xconnect_reply) \
621 _(SW_INTERFACE_SET_L2_BRIDGE_REPLY, sw_interface_set_l2_bridge_reply)
624 connect_to_vpe (char *name)
628 rv = vl_client_connect_to_vlib ("/vpe-api", name, 32);
631 vl_msg_api_set_handlers(VL_API_##N, #n, \
632 vl_api_##n##_t_handler, \
634 vl_api_##n##_t_endian, \
635 vl_api_##n##_t_print, \
636 sizeof(vl_api_##n##_t), 1);
640 shmem_hdr = api_main.shmem_hdr;
646 disconnect_from_vpe (void)
648 vl_client_disconnect_from_vlib ();
653 link_up_down_enable_disable (test_main_t * tm, int enable)
655 vl_api_want_interface_events_t *mp;
657 /* Request admin / link up down messages */
658 mp = vl_msg_api_alloc (sizeof (*mp));
659 memset (mp, 0, sizeof (*mp));
660 mp->_vl_msg_id = ntohs (VL_API_WANT_INTERFACE_EVENTS);
661 mp->client_index = tm->my_client_index;
662 mp->context = 0xdeadbeef;
663 mp->enable_disable = enable;
665 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
666 tm->link_events_on = enable;
670 stats_enable_disable (test_main_t * tm, int enable)
672 vl_api_want_stats_t *mp;
674 mp = vl_msg_api_alloc (sizeof (*mp));
675 memset (mp, 0, sizeof (*mp));
676 mp->_vl_msg_id = ntohs (VL_API_WANT_STATS);
677 mp->client_index = tm->my_client_index;
678 mp->context = 0xdeadbeef;
679 mp->enable_disable = enable;
681 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
682 tm->stats_on = enable;
686 oam_events_enable_disable (test_main_t * tm, int enable)
688 vl_api_want_oam_events_t *mp;
690 mp = vl_msg_api_alloc (sizeof (*mp));
691 memset (mp, 0, sizeof (*mp));
692 mp->_vl_msg_id = ntohs (VL_API_WANT_OAM_EVENTS);
693 mp->client_index = tm->my_client_index;
694 mp->context = 0xdeadbeef;
695 mp->enable_disable = enable;
697 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
698 tm->oam_events_on = enable;
702 oam_add_del (test_main_t * tm, int is_add)
704 vl_api_oam_add_del_t *mp;
707 mp = vl_msg_api_alloc (sizeof (*mp));
708 memset (mp, 0, sizeof (*mp));
709 mp->_vl_msg_id = ntohs (VL_API_OAM_ADD_DEL);
710 mp->client_index = tm->my_client_index;
711 mp->context = 0xdeadbeef;
714 tmp.as_u32 = ntohl (0xc0a80101); /* 192.168.1.1 */
715 clib_memcpy (mp->src_address, tmp.as_u8, 4);
717 tmp.as_u32 = ntohl (0xc0a80103); /* 192.168.1.3 */
718 clib_memcpy (mp->dst_address, tmp.as_u8, 4);
721 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
725 dump (test_main_t * tm)
727 vl_api_sw_interface_dump_t *mp;
729 mp = vl_msg_api_alloc (sizeof (*mp));
730 memset (mp, 0, sizeof (*mp));
731 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_DUMP);
732 mp->client_index = tm->my_client_index;
733 mp->name_filter_valid = 1;
734 strncpy ((char *) mp->name_filter, "eth", sizeof (mp->name_filter) - 1);
736 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
740 add_del_ip4_route (test_main_t * tm, int enable_disable)
742 vl_api_ip_add_del_route_t *mp;
745 mp = vl_msg_api_alloc (sizeof (*mp));
746 memset (mp, 0, sizeof (*mp));
747 mp->_vl_msg_id = ntohs (VL_API_IP_ADD_DEL_ROUTE);
748 mp->client_index = tm->my_client_index;
749 mp->context = 0xdeadbeef;
750 mp->table_id = ntohl (0);
752 mp->next_hop_sw_if_index = ntohl (5);
753 mp->is_add = enable_disable;
754 mp->next_hop_weight = 1;
756 /* Next hop: 6.0.0.1 */
757 tmp = ntohl (0x06000001);
758 clib_memcpy (mp->next_hop_address, &tmp, sizeof (tmp));
760 /* Destination: 10.0.0.1/32 */
762 clib_memcpy (mp->dst_address, &tmp, sizeof (tmp));
763 mp->dst_address_length = 0;
765 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
769 add_del_ip6_route (test_main_t * tm, int enable_disable)
771 vl_api_ip_add_del_route_t *mp;
774 mp = vl_msg_api_alloc (sizeof (*mp));
775 memset (mp, 0, sizeof (*mp));
776 mp->_vl_msg_id = ntohs (VL_API_IP_ADD_DEL_ROUTE);
777 mp->client_index = tm->my_client_index;
778 mp->context = 0xdeadbeef;
779 mp->next_hop_sw_if_index = ntohl (5);
780 mp->is_add = enable_disable;
782 mp->next_hop_weight = 1;
783 mp->dst_address_length = 64;
785 /* add/del dabe::/64 via db01::11 */
787 tmp[0] = clib_host_to_net_u64 (0xdabe000000000000ULL);
788 tmp[1] = clib_host_to_net_u64 (0x0ULL);
789 clib_memcpy (mp->dst_address, &tmp[0], 8);
790 clib_memcpy (&mp->dst_address[8], &tmp[1], 8);
792 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
793 tmp[1] = clib_host_to_net_u64 (0x11ULL);
794 clib_memcpy (mp->next_hop_address, &tmp[0], 8);
795 clib_memcpy (&mp->next_hop_address[8], &tmp[1], 8);
797 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
801 add_del_interface_address (test_main_t * tm, int enable_disable)
803 vl_api_sw_interface_add_del_address_t *mp;
806 mp = vl_msg_api_alloc (sizeof (*mp));
807 memset (mp, 0, sizeof (*mp));
808 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
809 mp->client_index = tm->my_client_index;
810 mp->context = 0xdeadbeef;
811 mp->sw_if_index = ntohl (5);
812 mp->is_add = enable_disable;
813 mp->address_length = 8;
815 tmp = ntohl (0x01020304);
816 clib_memcpy (mp->address, &tmp, 4);
818 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
822 add_del_v6_interface_address (test_main_t * tm, int enable_disable)
824 vl_api_sw_interface_add_del_address_t *mp;
827 mp = vl_msg_api_alloc (sizeof (*mp));
828 memset (mp, 0, sizeof (*mp));
829 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
830 mp->client_index = tm->my_client_index;
831 mp->context = 0xdeadbeef;
833 mp->sw_if_index = ntohl (5);
834 mp->is_add = enable_disable;
835 mp->address_length = 64;
837 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
838 tmp[1] = clib_host_to_net_u64 (0x11ULL);
840 clib_memcpy (mp->address, &tmp[0], 8);
841 clib_memcpy (&mp->address[8], &tmp[1], 8);
843 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
847 del_all_interface_addresses (test_main_t * tm)
849 vl_api_sw_interface_add_del_address_t *mp;
851 mp = vl_msg_api_alloc (sizeof (*mp));
852 memset (mp, 0, sizeof (*mp));
853 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
854 mp->client_index = tm->my_client_index;
855 mp->context = 0xdeadbeef;
856 mp->sw_if_index = ntohl (5);
859 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
863 set_interface_table (test_main_t * tm, int is_ipv6, u32 vrf_id)
865 vl_api_sw_interface_set_table_t *mp;
867 mp = vl_msg_api_alloc (sizeof (*mp));
868 memset (mp, 0, sizeof (*mp));
869 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_TABLE);
870 mp->client_index = tm->my_client_index;
871 mp->context = 0xdeadbeef;
872 mp->sw_if_index = ntohl (5);
873 mp->is_ipv6 = is_ipv6;
874 mp->vrf_id = ntohl (vrf_id);
876 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
880 connect_unix_tap (test_main_t * tm, char *name)
882 vl_api_tap_connect_t *mp;
884 mp = vl_msg_api_alloc (sizeof (*mp));
885 memset (mp, 0, sizeof (*mp));
886 mp->_vl_msg_id = ntohs (VL_API_TAP_CONNECT);
887 mp->client_index = tm->my_client_index;
888 mp->context = 0xdeadbeef;
889 strncpy ((char *) mp->tap_name, name, sizeof (mp->tap_name) - 1);
890 mp->use_random_mac = 1;
891 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
895 create_vlan_subif (test_main_t * tm, u32 vlan_id)
897 vl_api_create_vlan_subif_t *mp;
899 mp = vl_msg_api_alloc (sizeof (*mp));
900 memset (mp, 0, sizeof (*mp));
901 mp->_vl_msg_id = ntohs (VL_API_CREATE_VLAN_SUBIF);
902 mp->client_index = tm->my_client_index;
903 mp->context = 0xdeadbeef;
904 mp->sw_if_index = ntohl (5);
905 mp->vlan_id = ntohl (vlan_id);
907 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
911 add_del_proxy_arp (test_main_t * tm, int is_add)
913 vl_api_proxy_arp_add_del_t *mp;
916 mp = vl_msg_api_alloc (sizeof (*mp));
917 memset (mp, 0, sizeof (*mp));
918 mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_ADD_DEL);
919 mp->client_index = tm->my_client_index;
920 mp->context = 0xdeadbeef;
921 mp->proxy.vrf_id = ntohl (11);
924 /* proxy fib 11, 1.1.1.1 -> 1.1.1.10 */
925 tmp = ntohl (0x01010101);
926 clib_memcpy (mp->proxy.low_address, &tmp, 4);
928 tmp = ntohl (0x0101010a);
929 clib_memcpy (mp->proxy.hi_address, &tmp, 4);
931 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
935 proxy_arp_intfc_enable_disable (test_main_t * tm, int enable_disable)
937 vl_api_proxy_arp_intfc_enable_disable_t *mp;
939 mp = vl_msg_api_alloc (sizeof (*mp));
940 memset (mp, 0, sizeof (*mp));
941 mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_INTFC_ENABLE_DISABLE);
942 mp->client_index = tm->my_client_index;
943 mp->context = 0xdeadbeef;
944 mp->sw_if_index = ntohl (6);
945 mp->enable_disable = enable_disable;
947 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
951 add_ip4_neighbor (test_main_t * tm, int add_del)
953 vl_api_ip_neighbor_add_del_t *mp;
956 mp = vl_msg_api_alloc (sizeof (*mp));
957 memset (mp, 0, sizeof (*mp));
958 mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_ADD_DEL);
959 mp->client_index = tm->my_client_index;
960 mp->context = 0xdeadbeef;
961 mp->sw_if_index = ntohl (6);
962 mp->is_add = add_del;
964 memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
966 tmp = ntohl (0x0101010a);
967 clib_memcpy (mp->dst_address, &tmp, 4);
969 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
973 add_ip6_neighbor (test_main_t * tm, int add_del)
975 vl_api_ip_neighbor_add_del_t *mp;
978 mp = vl_msg_api_alloc (sizeof (*mp));
979 memset (mp, 0, sizeof (*mp));
980 mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_ADD_DEL);
981 mp->client_index = tm->my_client_index;
982 mp->context = 0xdeadbeef;
983 mp->sw_if_index = ntohl (6);
984 mp->is_add = add_del;
987 memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
989 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
990 tmp[1] = clib_host_to_net_u64 (0x11ULL);
992 clib_memcpy (mp->dst_address, &tmp[0], 8);
993 clib_memcpy (&mp->dst_address[8], &tmp[1], 8);
995 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
999 reset_fib (test_main_t * tm, u8 is_ip6)
1001 vl_api_reset_fib_t *mp;
1003 mp = vl_msg_api_alloc (sizeof (*mp));
1004 memset (mp, 0, sizeof (*mp));
1005 mp->_vl_msg_id = ntohs (VL_API_RESET_FIB);
1006 mp->client_index = tm->my_client_index;
1007 mp->context = 0xdeadbeef;
1008 mp->vrf_id = ntohl (11);
1009 mp->is_ipv6 = is_ip6;
1011 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1015 dhcpv6_set_vss (test_main_t * tm)
1017 vl_api_dhcp_proxy_set_vss_t *mp;
1019 mp = vl_msg_api_alloc (sizeof (*mp));
1020 memset (mp, 0, sizeof (*mp));
1021 mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_SET_VSS);
1022 mp->client_index = tm->my_client_index;
1023 mp->context = 0xdeadbeef;
1024 mp->oui = ntohl (6);
1025 mp->tbl_id = ntohl (60);
1028 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1032 dhcpv4_set_vss (test_main_t * tm)
1034 vl_api_dhcp_proxy_set_vss_t *mp;
1036 mp = vl_msg_api_alloc (sizeof (*mp));
1037 memset (mp, 0, sizeof (*mp));
1038 mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_SET_VSS);
1039 mp->client_index = tm->my_client_index;
1040 mp->context = 0xdeadbeef;
1041 mp->oui = ntohl (4);
1042 mp->tbl_id = ntohl (40);
1045 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1049 dhcp_set_vss (test_main_t * tm)
1051 dhcpv4_set_vss (tm);
1052 dhcpv6_set_vss (tm);
1056 dhcp_set_proxy (test_main_t * tm, int ipv6)
1058 vl_api_dhcp_proxy_config_t *mp;
1060 mp = vl_msg_api_alloc (sizeof (*mp));
1061 memset (mp, 0, sizeof (*mp));
1062 mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_CONFIG);
1063 mp->client_index = tm->my_client_index;
1064 mp->context = 0xdeadbeef;
1067 mp->dhcp_server[0] = 0x20;
1068 mp->dhcp_server[1] = 0x01;
1069 mp->dhcp_server[2] = 0xab;
1070 mp->dhcp_server[3] = 0xcd;
1071 mp->dhcp_server[4] = 0x12;
1072 mp->dhcp_server[5] = 0x34;
1073 mp->dhcp_server[6] = 0xfe;
1074 mp->dhcp_server[7] = 0xdc;
1075 mp->dhcp_server[14] = 0;
1076 mp->dhcp_server[15] = 0x2;
1078 mp->dhcp_src_address[0] = 0x20;
1079 mp->dhcp_src_address[1] = 0x01;
1080 mp->dhcp_src_address[2] = 0xab;
1081 mp->dhcp_src_address[3] = 0xcd;
1082 mp->dhcp_src_address[4] = 0x12;
1083 mp->dhcp_src_address[5] = 0x34;
1084 mp->dhcp_src_address[6] = 0x56;
1085 mp->dhcp_src_address[7] = 0x78;
1086 mp->dhcp_src_address[14] = 0;
1087 mp->dhcp_src_address[15] = 0x2;
1089 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1093 set_ip_flow_hash (test_main_t * tm, u8 is_ip6)
1095 vl_api_set_ip_flow_hash_t *mp;
1097 mp = vl_msg_api_alloc (sizeof (*mp));
1098 memset (mp, 0, sizeof (*mp));
1099 mp->_vl_msg_id = ntohs (VL_API_SET_IP_FLOW_HASH);
1100 mp->client_index = tm->my_client_index;
1101 mp->context = 0xdeadbeef;
1103 mp->is_ipv6 = is_ip6;
1107 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1111 ip6nd_ra_config (test_main_t * tm, int is_no)
1113 vl_api_sw_interface_ip6nd_ra_config_t *mp;
1115 mp = vl_msg_api_alloc (sizeof (*mp));
1116 memset (mp, 0, sizeof (*mp));
1118 mp->client_index = tm->my_client_index;
1119 mp->context = 0xdeadbeef;
1120 mp->sw_if_index = ntohl (5);
1126 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6ND_RA_CONFIG);
1127 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1131 ip6nd_ra_prefix (test_main_t * tm, int is_no)
1133 vl_api_sw_interface_ip6nd_ra_prefix_t *mp;
1136 mp = vl_msg_api_alloc (sizeof (*mp));
1137 memset (mp, 0, sizeof (*mp));
1139 mp->client_index = tm->my_client_index;
1140 mp->context = 0xdeadbeef;
1141 mp->sw_if_index = ntohl (5);
1144 mp->use_default = 1;
1147 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
1148 tmp[1] = clib_host_to_net_u64 (0x11ULL);
1151 clib_memcpy (mp->address, &tmp[0], 8);
1152 clib_memcpy (&mp->address[8], &tmp[1], 8);
1154 mp->address_length = 64;
1157 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6ND_RA_PREFIX);
1158 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1162 ip6_enable_disable (test_main_t * tm, int enable)
1164 vl_api_sw_interface_ip6_enable_disable_t *mp;
1166 mp = vl_msg_api_alloc (sizeof (*mp));
1167 memset (mp, 0, sizeof (*mp));
1169 mp->client_index = tm->my_client_index;
1170 mp->context = 0xdeadbeef;
1171 mp->sw_if_index = ntohl (5);
1172 mp->enable = (enable == 1);;
1174 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6_ENABLE_DISABLE);
1175 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1179 loop_create (test_main_t * tm)
1181 vl_api_create_loopback_t *mp;
1183 mp = vl_msg_api_alloc (sizeof (*mp));
1184 memset (mp, 0, sizeof (*mp));
1186 mp->_vl_msg_id = ntohs (VL_API_CREATE_LOOPBACK);
1187 mp->client_index = tm->my_client_index;
1188 mp->context = 0xdeadbeef;
1189 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1193 ip6_set_link_local_address (test_main_t * tm)
1195 vl_api_sw_interface_ip6_set_link_local_address_t *mp;
1198 mp = vl_msg_api_alloc (sizeof (*mp));
1199 memset (mp, 0, sizeof (*mp));
1201 mp->client_index = tm->my_client_index;
1202 mp->context = 0xdeadbeef;
1203 mp->sw_if_index = ntohl (5);
1205 tmp[0] = clib_host_to_net_u64 (0xfe80000000000000ULL);
1206 tmp[1] = clib_host_to_net_u64 (0x11ULL);
1208 clib_memcpy (mp->address, &tmp[0], 8);
1209 clib_memcpy (&mp->address[8], &tmp[1], 8);
1211 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS);
1213 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1218 set_flags (test_main_t * tm, int up_down)
1220 vl_api_sw_interface_set_flags_t *mp;
1222 mp = vl_msg_api_alloc (sizeof (*mp));
1223 memset (mp, 0, sizeof (*mp));
1225 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_FLAGS);
1226 mp->client_index = tm->my_client_index;
1227 mp->context = 0xdeadbeef;
1228 mp->sw_if_index = ntohl (5);
1229 mp->admin_up_down = up_down;
1230 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1235 l2_patch_add_del (test_main_t * tm, int is_add)
1237 vl_api_l2_patch_add_del_t *mp;
1239 mp = vl_msg_api_alloc (sizeof (*mp));
1240 memset (mp, 0, sizeof (*mp));
1241 mp->_vl_msg_id = ntohs (VL_API_L2_PATCH_ADD_DEL);
1242 mp->client_index = tm->my_client_index;
1243 mp->context = 0xdeadbeef;
1244 mp->is_add = is_add;
1245 mp->rx_sw_if_index = ntohl (1);
1246 mp->tx_sw_if_index = ntohl (2);
1248 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1252 l2_xconnect (test_main_t * tm)
1254 vl_api_sw_interface_set_l2_xconnect_t *mp;
1256 mp = vl_msg_api_alloc (sizeof (*mp));
1257 memset (mp, 0, sizeof (*mp));
1258 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_L2_XCONNECT);
1259 mp->client_index = tm->my_client_index;
1260 mp->context = 0xdeadbeef;
1261 mp->rx_sw_if_index = ntohl (5);
1262 mp->tx_sw_if_index = ntohl (6);
1265 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1269 l2_bridge (test_main_t * tm)
1271 vl_api_sw_interface_set_l2_bridge_t *mp;
1273 mp = vl_msg_api_alloc (sizeof (*mp));
1274 memset (mp, 0, sizeof (*mp));
1275 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_L2_BRIDGE);
1276 mp->client_index = tm->my_client_index;
1277 mp->context = 0xdeadbeef;
1278 mp->rx_sw_if_index = ntohl (5);
1279 mp->bd_id = ntohl (6);
1280 mp->bvi = ntohl (1);
1281 mp->shg = ntohl (0);
1284 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1288 main (int argc, char **argv)
1290 api_main_t *am = &api_main;
1291 test_main_t *tm = &test_main;
1294 connect_to_vpe ("test_client");
1296 tm->vl_input_queue = shmem_hdr->vl_input_queue;
1297 tm->my_client_index = am->my_client_index;
1299 fformat (stdout, "Type 'h' for help, 'q' to quit...\n");
1312 link_up_down_enable_disable (tm, 1 /* enable_disable */ );
1315 link_up_down_enable_disable (tm, 0 /* enable_disable */ );
1318 stats_enable_disable (tm, 1 /* enable_disable */ );
1321 stats_enable_disable (tm, 0 /* enable_disable */ );
1324 add_del_ip4_route (tm, 0 /* add */ );
1327 add_del_ip4_route (tm, 1 /* add */ );
1330 add_del_ip6_route (tm, 0 /* add */ );
1333 add_del_ip6_route (tm, 1 /* add */ );
1336 add_del_interface_address (tm, 1 /* add */ );
1339 add_del_interface_address (tm, 0 /* add */ );
1342 add_del_v6_interface_address (tm, 1 /* add */ );
1345 add_del_v6_interface_address (tm, 0 /* add */ );
1348 l2_patch_add_del (tm, 1 /* is_add */ );
1351 l2_patch_add_del (tm, 0 /* is_add */ );
1354 del_all_interface_addresses (tm);
1357 set_interface_table (tm, 0 /* is_ipv6 */ ,
1358 11 /* my amp goes to 11 */ );
1361 set_interface_table (tm, 1 /* is_ipv6 */ ,
1362 12 /* my amp goes to 12 */ );
1366 create_vlan_subif (tm, 123);
1370 connect_unix_tap (tm, "foo");
1374 add_ip4_neighbor (tm, 1 /* is_add */ );
1375 add_ip6_neighbor (tm, 1 /* is_add */ );
1379 add_ip4_neighbor (tm, 0 /* is_add */ );
1380 add_ip6_neighbor (tm, 0 /* is_add */ );
1384 add_del_proxy_arp (tm, 1 /* add */ );
1388 proxy_arp_intfc_enable_disable (tm, 1 /* enable */ );
1392 oam_events_enable_disable (tm, 0 /* enable */ );
1396 oam_events_enable_disable (tm, 1 /* enable */ );
1400 oam_add_del (tm, 0 /* is_add */ );
1404 oam_add_del (tm, 1 /* is_add */ );
1408 reset_fib (tm, 0 /* is_ip6 */ );
1412 reset_fib (tm, 1 /* is_ip6 */ );
1420 dhcp_set_proxy (tm, 0);
1424 dhcp_set_proxy (tm, 1 /*ipv6 */ );
1428 set_ip_flow_hash (tm, 0 /* is_ip6 */ );
1432 ip6_set_link_local_address (tm);
1436 ip6_enable_disable (tm, 1 /* enable */ );
1440 ip6_enable_disable (tm, 0 /* disable */ );
1444 ip6nd_ra_config (tm, 0 /* is_no */ );
1447 ip6nd_ra_config (tm, 1 /* is_no */ );
1450 ip6nd_ra_prefix (tm, 0 /* is_no */ );
1453 ip6nd_ra_prefix (tm, 1 /* is_no */ );
1461 set_flags (tm, 1 /* up_down */ );
1465 set_flags (tm, 0 /* up_down */ );
1477 fformat (stdout, "q=quit,d=dump,L=link evts on,l=link evts off\n");
1478 fformat (stdout, "S=stats on,s=stats off\n");
1479 fformat (stdout, "4=add v4 route, 3=del v4 route\n");
1480 fformat (stdout, "6=add v6 route, 5=del v6 route\n");
1481 fformat (stdout, "A=add v4 intfc route, a=del v4 intfc route\n");
1482 fformat (stdout, "B=add v6 intfc route, b=del v6 intfc route\n");
1483 fformat (stdout, "z=del all intfc routes\n");
1484 fformat (stdout, "t=set v4 intfc table, T=set v6 intfc table\n");
1485 fformat (stdout, "c=connect unix tap\n");
1487 "j=set dhcpv4 and v6 link-address/option-82 params\n");
1488 fformat (stdout, "k=set dhcpv4 relay agent params\n");
1489 fformat (stdout, "K=set dhcpv6 relay agent params\n");
1490 fformat (stdout, "E=add l2 patch, e=del l2 patch\n");
1491 fformat (stdout, "V=ip6 set link-local address \n");
1492 fformat (stdout, "w=ip6 enable \n");
1493 fformat (stdout, "W=ip6 disable \n");
1494 fformat (stdout, "x=ip6 nd config \n");
1495 fformat (stdout, "X=no ip6 nd config\n");
1496 fformat (stdout, "y=ip6 nd prefix \n");
1497 fformat (stdout, "Y=no ip6 nd prefix\n");
1498 fformat (stdout, "@=l2 xconnect\n");
1499 fformat (stdout, "#=l2 bridge\n");
1509 if (tm->link_events_on)
1510 link_up_down_enable_disable (tm, 0 /* enable */ );
1512 stats_enable_disable (tm, 0 /* enable */ );
1513 if (tm->oam_events_on)
1514 oam_events_enable_disable (tm, 0 /* enable */ );
1516 disconnect_from_vpe ();
1520 #undef vl_api_version
1521 #define vl_api_version(n,v) static u32 vpe_api_version = v;
1522 #include <vpp/api/vpe.api.h>
1523 #undef vl_api_version
1526 vl_client_add_api_signatures (vl_api_memclnt_create_t * mp)
1529 * Send the main API signature in slot 0. This bit of code must
1530 * match the checks in ../vpe/api/api.c: vl_msg_api_version_check().
1532 mp->api_versions[0] = clib_host_to_net_u32 (vpe_api_version);
1536 * fd.io coding-style-patch-verification: ON
1539 * eval: (c-set-style "gnu")