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 unix_shared_memory_queue_t *vl_input_queue;
85 test_main_t test_main;
88 * Satisfy external references when -lvlib is not available.
91 vlib_cli_output (struct vlib_main_t *vm, char *fmt, ...)
93 clib_warning ("vlib_cli_output callled...");
97 format_ethernet_address (u8 * s, va_list * args)
99 u8 *a = va_arg (*args, u8 *);
101 return format (s, "%02x:%02x:%02x:%02x:%02x:%02x",
102 a[0], a[1], a[2], a[3], a[4], a[5]);
106 vl_api_sw_interface_details_t_handler (vl_api_sw_interface_details_t * mp)
108 char *duplex, *speed;
110 switch (mp->link_duplex << VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT)
112 case VNET_HW_INTERFACE_FLAG_HALF_DUPLEX:
115 case VNET_HW_INTERFACE_FLAG_FULL_DUPLEX:
122 switch (mp->link_speed << VNET_HW_INTERFACE_FLAG_SPEED_SHIFT)
124 case VNET_HW_INTERFACE_FLAG_SPEED_10M:
127 case VNET_HW_INTERFACE_FLAG_SPEED_100M:
130 case VNET_HW_INTERFACE_FLAG_SPEED_1G:
133 case VNET_HW_INTERFACE_FLAG_SPEED_10G:
136 case VNET_HW_INTERFACE_FLAG_SPEED_40G:
139 case VNET_HW_INTERFACE_FLAG_SPEED_100G:
146 fformat (stdout, "details: %s sw_if_index %d sup_sw_if_index %d "
147 "link_duplex %s link_speed %s",
148 mp->interface_name, ntohl (mp->sw_if_index),
149 ntohl (mp->sup_sw_if_index), duplex, speed);
151 if (mp->l2_address_length)
152 fformat (stdout, " l2 address: %U\n",
153 format_ethernet_address, mp->l2_address);
155 fformat (stdout, "\n");
159 vl_api_sw_interface_set_flags_t_handler (vl_api_sw_interface_set_flags_t * mp)
161 fformat (stdout, "set flags: sw_if_index %d, admin %s link %s\n",
162 ntohl (mp->sw_if_index),
163 mp->admin_up_down ? "up" : "down",
164 mp->link_up_down ? "up" : "down");
168 vl_api_sw_interface_set_flags_reply_t_handler
169 (vl_api_sw_interface_set_flags_reply_t * mp)
171 fformat (stdout, "set flags reply: reply %d\n", ntohl (mp->retval));
175 vl_api_want_interface_events_reply_t_handler
176 (vl_api_want_interface_events_reply_t * mp)
181 vl_api_want_stats_reply_t_handler (vl_api_want_stats_reply_t * mp)
183 fformat (stdout, "want stats reply %d\n", ntohl (mp->retval));
187 vl_api_want_oam_events_reply_t_handler (vl_api_want_oam_events_reply_t * mp)
189 fformat (stdout, "want oam reply %d\n", ntohl (mp->retval));
193 vl_api_ip_add_del_route_reply_t_handler (vl_api_ip_add_del_route_reply_t * mp)
195 fformat (stdout, "add_route reply %d\n", ntohl (mp->retval));
199 vl_api_sw_interface_add_del_address_reply_t_handler
200 (vl_api_sw_interface_add_del_address_reply_t * mp)
202 fformat (stdout, "add_del_address reply %d\n", ntohl (mp->retval));
206 vl_api_sw_interface_set_table_reply_t_handler
207 (vl_api_sw_interface_set_table_reply_t * mp)
209 fformat (stdout, "set_table reply %d\n", ntohl (mp->retval));
213 vl_api_tap_connect_reply_t_handler (vl_api_tap_connect_reply_t * mp)
215 fformat (stdout, "tap connect reply %d, sw_if_index %d\n",
216 ntohl (mp->retval), ntohl (mp->sw_if_index));
220 vl_api_create_vlan_subif_reply_t_handler (vl_api_create_vlan_subif_reply_t *
223 fformat (stdout, "create vlan subif reply %d, sw_if_index %d\n",
224 ntohl (mp->retval), ntohl (mp->sw_if_index));
228 vl_api_mpls_add_del_encap_reply_t_handler (vl_api_mpls_add_del_encap_reply_t *
231 fformat (stdout, "add del mpls label reply %d\n", ntohl (mp->retval));
234 static void vl_api_proxy_arp_add_del_reply_t_handler
235 (vl_api_proxy_arp_add_del_reply_t * mp)
237 fformat (stdout, "add del proxy arp reply %d\n", ntohl (mp->retval));
240 static void vl_api_proxy_arp_intfc_enable_disable_reply_t_handler
241 (vl_api_proxy_arp_intfc_enable_disable_reply_t * mp)
243 fformat (stdout, "proxy arp intfc ena/dis reply %d\n", ntohl (mp->retval));
246 static void vl_api_ip_neighbor_add_del_reply_t_handler
247 (vl_api_ip_neighbor_add_del_reply_t * mp)
249 fformat (stdout, "ip neighbor add del reply %d\n", ntohl (mp->retval));
253 vl_api_vnet_interface_counters_t_handler (vl_api_vnet_interface_counters_t *
257 u32 count, sw_if_index;
260 count = ntohl (mp->count);
261 sw_if_index = ntohl (mp->first_sw_if_index);
262 if (mp->is_combined == 0)
265 vp = (u64 *) mp->data;
267 switch (mp->vnet_counter_type)
269 case VNET_INTERFACE_COUNTER_DROP:
270 counter_name = "drop";
272 case VNET_INTERFACE_COUNTER_PUNT:
273 counter_name = "punt";
275 case VNET_INTERFACE_COUNTER_IP4:
276 counter_name = "ip4";
278 case VNET_INTERFACE_COUNTER_IP6:
279 counter_name = "ip6";
281 case VNET_INTERFACE_COUNTER_RX_NO_BUF:
282 counter_name = "rx-no-buf";
284 case VNET_INTERFACE_COUNTER_RX_MISS:
285 counter_name = "rx-miss";
287 case VNET_INTERFACE_COUNTER_RX_ERROR:
288 counter_name = "rx-error";
290 case VNET_INTERFACE_COUNTER_TX_ERROR:
291 counter_name = "tx-error (fifo-full)";
294 counter_name = "bogus";
297 for (i = 0; i < count; i++)
299 v = clib_mem_unaligned (vp, u64);
300 v = clib_net_to_host_u64 (v);
302 fformat (stdout, "%d.%s %lld\n", sw_if_index, counter_name, v);
310 vp = (vlib_counter_t *) mp->data;
312 switch (mp->vnet_counter_type)
314 case VNET_INTERFACE_COUNTER_RX:
317 case VNET_INTERFACE_COUNTER_TX:
321 counter_name = "bogus";
324 for (i = 0; i < count; i++)
326 packets = clib_mem_unaligned (&vp->packets, u64);
327 packets = clib_net_to_host_u64 (packets);
328 bytes = clib_mem_unaligned (&vp->bytes, u64);
329 bytes = clib_net_to_host_u64 (bytes);
331 fformat (stdout, "%d.%s.packets %lld\n",
332 sw_if_index, counter_name, packets);
333 fformat (stdout, "%d.%s.bytes %lld\n",
334 sw_if_index, counter_name, bytes);
340 /* Format an IP4 address. */
342 format_ip4_address (u8 * s, va_list * args)
344 u8 *a = va_arg (*args, u8 *);
345 return format (s, "%d.%d.%d.%d", a[0], a[1], a[2], a[3]);
348 /* Format an IP4 route destination and length. */
350 format_ip4_address_and_length (u8 * s, va_list * args)
352 u8 *a = va_arg (*args, u8 *);
353 u8 l = va_arg (*args, u32);
354 return format (s, "%U/%d", format_ip4_address, a, l);
358 vl_api_vnet_ip4_fib_counters_t_handler (vl_api_vnet_ip4_fib_counters_t * mp)
361 vl_api_ip4_fib_counter_t *ctrp;
364 count = ntohl (mp->count);
366 fformat (stdout, "fib id %d, count this msg %d\n",
367 ntohl (mp->vrf_id), count);
370 for (i = 0; i < count; i++)
372 fformat (stdout, "%U: %lld packets, %lld bytes\n",
373 format_ip4_address_and_length, &ctrp->address,
374 (u32) ctrp->address_length,
375 clib_net_to_host_u64 (ctrp->packets),
376 clib_net_to_host_u64 (ctrp->bytes));
381 /* Format an IP6 address. */
383 format_ip6_address (u8 * s, va_list * args)
385 ip6_address_t *a = va_arg (*args, ip6_address_t *);
386 u32 i, i_max_n_zero, max_n_zeros, i_first_zero, n_zeros, last_double_colon;
388 i_max_n_zero = ARRAY_LEN (a->as_u16);
390 i_first_zero = i_max_n_zero;
392 for (i = 0; i < ARRAY_LEN (a->as_u16); i++)
394 u32 is_zero = a->as_u16[i] == 0;
395 if (is_zero && i_first_zero >= ARRAY_LEN (a->as_u16))
401 if ((!is_zero && n_zeros > max_n_zeros)
402 || (i + 1 >= ARRAY_LEN (a->as_u16) && n_zeros > max_n_zeros))
404 i_max_n_zero = i_first_zero;
405 max_n_zeros = n_zeros;
406 i_first_zero = ARRAY_LEN (a->as_u16);
411 last_double_colon = 0;
412 for (i = 0; i < ARRAY_LEN (a->as_u16); i++)
414 if (i == i_max_n_zero && max_n_zeros > 1)
416 s = format (s, "::");
417 i += max_n_zeros - 1;
418 last_double_colon = 1;
422 s = format (s, "%s%x",
423 (last_double_colon || i == 0) ? "" : ":",
424 clib_net_to_host_u16 (a->as_u16[i]));
425 last_double_colon = 0;
432 /* Format an IP6 route destination and length. */
434 format_ip6_address_and_length (u8 * s, va_list * args)
436 ip6_address_t *a = va_arg (*args, ip6_address_t *);
437 u8 l = va_arg (*args, u32);
438 return format (s, "%U/%d", format_ip6_address, a, l);
442 vl_api_vnet_ip6_fib_counters_t_handler (vl_api_vnet_ip6_fib_counters_t * mp)
445 vl_api_ip6_fib_counter_t *ctrp;
448 count = ntohl (mp->count);
450 fformat (stdout, "fib id %d, count this msg %d\n",
451 ntohl (mp->vrf_id), count);
454 for (i = 0; i < count; i++)
456 fformat (stdout, "%U: %lld packets, %lld bytes\n",
457 format_ip6_address_and_length, &ctrp->address,
458 (u32) ctrp->address_length,
459 clib_net_to_host_u64 (ctrp->packets),
460 clib_net_to_host_u64 (ctrp->bytes));
466 vl_api_oam_event_t_handler (vl_api_oam_event_t * mp)
468 fformat (stdout, "OAM: %U now %s\n",
469 format_ip4_address, &mp->dst_address,
470 mp->state == 1 ? "alive" : "dead");
474 vl_api_oam_add_del_reply_t_handler (vl_api_oam_add_del_reply_t * mp)
476 fformat (stdout, "oam add del reply %d\n", ntohl (mp->retval));
480 vl_api_reset_fib_reply_t_handler (vl_api_reset_fib_reply_t * mp)
482 fformat (stdout, "fib reset reply %d\n", ntohl (mp->retval));
486 vl_api_dhcp_proxy_set_vss_reply_t_handler (vl_api_dhcp_proxy_set_vss_reply_t *
489 fformat (stdout, "dhcp proxy set vss reply %d\n", ntohl (mp->retval));
493 vl_api_dhcp_proxy_config_reply_t_handler (vl_api_dhcp_proxy_config_reply_t *
496 fformat (stdout, "dhcp proxy config reply %d\n", ntohl (mp->retval));
500 vl_api_set_ip_flow_hash_reply_t_handler (vl_api_set_ip_flow_hash_reply_t * mp)
502 fformat (stdout, "set ip flow hash reply %d\n", ntohl (mp->retval));
506 vl_api_sw_interface_ip6nd_ra_config_reply_t_handler
507 (vl_api_sw_interface_ip6nd_ra_config_reply_t * mp)
509 fformat (stdout, "ip6 nd ra-config reply %d\n", ntohl (mp->retval));
513 vl_api_sw_interface_ip6nd_ra_prefix_reply_t_handler
514 (vl_api_sw_interface_ip6nd_ra_prefix_reply_t * mp)
516 fformat (stdout, "ip6 nd ra-prefix reply %d\n", ntohl (mp->retval));
520 vl_api_sw_interface_ip6_enable_disable_reply_t_handler
521 (vl_api_sw_interface_ip6_enable_disable_reply_t * mp)
523 fformat (stdout, "ip6 enable/disable reply %d\n", ntohl (mp->retval));
527 vl_api_sw_interface_ip6_set_link_local_address_reply_t_handler
528 (vl_api_sw_interface_ip6_set_link_local_address_reply_t * mp)
530 fformat (stdout, "ip6 set link-local address reply %d\n",
534 static void vl_api_create_loopback_reply_t_handler
535 (vl_api_create_loopback_reply_t * mp)
537 fformat (stdout, "create loopback status %d, sw_if_index %d\n",
538 ntohl (mp->retval), ntohl (mp->sw_if_index));
542 vl_api_sr_tunnel_add_del_reply_t_handler (vl_api_sr_tunnel_add_del_reply_t *
545 fformat (stdout, "sr tunnel add/del reply %d\n", ntohl (mp->retval));
548 static void vl_api_l2_patch_add_del_reply_t_handler
549 (vl_api_l2_patch_add_del_reply_t * mp)
551 fformat (stdout, "l2 patch reply %d\n", ntohl (mp->retval));
554 static void vl_api_sw_interface_set_l2_xconnect_reply_t_handler
555 (vl_api_sw_interface_set_l2_xconnect_reply_t * mp)
557 fformat (stdout, "l2_xconnect reply %d\n", ntohl (mp->retval));
560 static void vl_api_sw_interface_set_l2_bridge_reply_t_handler
561 (vl_api_sw_interface_set_l2_bridge_reply_t * mp)
563 fformat (stdout, "l2_bridge reply %d\n", ntohl (mp->retval));
567 noop_handler (void *notused)
571 #define vl_api_vnet_ip4_fib_counters_t_endian noop_handler
572 #define vl_api_vnet_ip4_fib_counters_t_print noop_handler
573 #define vl_api_vnet_ip6_fib_counters_t_endian noop_handler
574 #define vl_api_vnet_ip6_fib_counters_t_print noop_handler
576 #define foreach_api_msg \
577 _(SW_INTERFACE_DETAILS, sw_interface_details) \
578 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
579 _(SW_INTERFACE_SET_FLAGS_REPLY, sw_interface_set_flags_reply) \
580 _(WANT_INTERFACE_EVENTS_REPLY, want_interface_events_reply) \
581 _(WANT_STATS_REPLY, want_stats_reply) \
582 _(WANT_OAM_EVENTS_REPLY, want_oam_events_reply) \
583 _(OAM_EVENT, oam_event) \
584 _(OAM_ADD_DEL_REPLY, oam_add_del_reply) \
585 _(VNET_INTERFACE_COUNTERS, vnet_interface_counters) \
586 _(VNET_IP4_FIB_COUNTERS, vnet_ip4_fib_counters) \
587 _(VNET_IP6_FIB_COUNTERS, vnet_ip6_fib_counters) \
588 _(IP_ADD_DEL_ROUTE_REPLY, ip_add_del_route_reply) \
589 _(SW_INTERFACE_ADD_DEL_ADDRESS_REPLY, sw_interface_add_del_address_reply) \
590 _(SW_INTERFACE_SET_TABLE_REPLY, sw_interface_set_table_reply) \
591 _(TAP_CONNECT_REPLY, tap_connect_reply) \
592 _(CREATE_VLAN_SUBIF_REPLY, create_vlan_subif_reply) \
593 _(MPLS_ADD_DEL_ENCAP_REPLY, mpls_add_del_encap_reply) \
594 _(PROXY_ARP_ADD_DEL_REPLY, proxy_arp_add_del_reply) \
595 _(PROXY_ARP_INTFC_ENABLE_DISABLE_REPLY, proxy_arp_intfc_enable_disable_reply) \
596 _(IP_NEIGHBOR_ADD_DEL_REPLY, ip_neighbor_add_del_reply) \
597 _(RESET_FIB_REPLY, reset_fib_reply) \
598 _(DHCP_PROXY_CONFIG_REPLY, dhcp_proxy_config_reply) \
599 _(DHCP_PROXY_SET_VSS_REPLY, dhcp_proxy_set_vss_reply) \
600 _(SET_IP_FLOW_HASH_REPLY, set_ip_flow_hash_reply) \
601 _(SW_INTERFACE_IP6ND_RA_CONFIG_REPLY, sw_interface_ip6nd_ra_config_reply) \
602 _(SW_INTERFACE_IP6ND_RA_PREFIX_REPLY, sw_interface_ip6nd_ra_prefix_reply) \
603 _(SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY, sw_interface_ip6_enable_disable_reply) \
604 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY, sw_interface_ip6_set_link_local_address_reply) \
605 _(CREATE_LOOPBACK_REPLY, create_loopback_reply) \
606 _(L2_PATCH_ADD_DEL_REPLY, l2_patch_add_del_reply) \
607 _(SR_TUNNEL_ADD_DEL_REPLY,sr_tunnel_add_del_reply) \
608 _(SW_INTERFACE_SET_L2_XCONNECT_REPLY, sw_interface_set_l2_xconnect_reply) \
609 _(SW_INTERFACE_SET_L2_BRIDGE_REPLY, sw_interface_set_l2_bridge_reply)
612 connect_to_vpe (char *name)
616 rv = vl_client_connect_to_vlib ("/vpe-api", name, 32);
619 vl_msg_api_set_handlers(VL_API_##N, #n, \
620 vl_api_##n##_t_handler, \
622 vl_api_##n##_t_endian, \
623 vl_api_##n##_t_print, \
624 sizeof(vl_api_##n##_t), 1);
628 shmem_hdr = api_main.shmem_hdr;
634 disconnect_from_vpe (void)
636 vl_client_disconnect_from_vlib ();
641 link_up_down_enable_disable (test_main_t * tm, int enable)
643 vl_api_want_interface_events_t *mp;
645 /* Request admin / link up down messages */
646 mp = vl_msg_api_alloc (sizeof (*mp));
647 memset (mp, 0, sizeof (*mp));
648 mp->_vl_msg_id = ntohs (VL_API_WANT_INTERFACE_EVENTS);
649 mp->client_index = tm->my_client_index;
650 mp->context = 0xdeadbeef;
651 mp->enable_disable = enable;
653 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
654 tm->link_events_on = enable;
658 stats_enable_disable (test_main_t * tm, int enable)
660 vl_api_want_stats_t *mp;
662 mp = vl_msg_api_alloc (sizeof (*mp));
663 memset (mp, 0, sizeof (*mp));
664 mp->_vl_msg_id = ntohs (VL_API_WANT_STATS);
665 mp->client_index = tm->my_client_index;
666 mp->context = 0xdeadbeef;
667 mp->enable_disable = enable;
669 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
670 tm->stats_on = enable;
674 oam_events_enable_disable (test_main_t * tm, int enable)
676 vl_api_want_oam_events_t *mp;
678 mp = vl_msg_api_alloc (sizeof (*mp));
679 memset (mp, 0, sizeof (*mp));
680 mp->_vl_msg_id = ntohs (VL_API_WANT_OAM_EVENTS);
681 mp->client_index = tm->my_client_index;
682 mp->context = 0xdeadbeef;
683 mp->enable_disable = enable;
685 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
686 tm->oam_events_on = enable;
690 oam_add_del (test_main_t * tm, int is_add)
692 vl_api_oam_add_del_t *mp;
695 mp = vl_msg_api_alloc (sizeof (*mp));
696 memset (mp, 0, sizeof (*mp));
697 mp->_vl_msg_id = ntohs (VL_API_OAM_ADD_DEL);
698 mp->client_index = tm->my_client_index;
699 mp->context = 0xdeadbeef;
702 tmp.as_u32 = ntohl (0xc0a80101); /* 192.168.1.1 */
703 clib_memcpy (mp->src_address, tmp.as_u8, 4);
705 tmp.as_u32 = ntohl (0xc0a80103); /* 192.168.1.3 */
706 clib_memcpy (mp->dst_address, tmp.as_u8, 4);
709 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
713 dump (test_main_t * tm)
715 vl_api_sw_interface_dump_t *mp;
717 mp = vl_msg_api_alloc (sizeof (*mp));
718 memset (mp, 0, sizeof (*mp));
719 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_DUMP);
720 mp->client_index = tm->my_client_index;
721 mp->name_filter_valid = 1;
722 strncpy ((char *) mp->name_filter, "eth", sizeof (mp->name_filter) - 1);
724 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
728 add_del_ip4_route (test_main_t * tm, int enable_disable)
730 vl_api_ip_add_del_route_t *mp;
733 mp = vl_msg_api_alloc (sizeof (*mp));
734 memset (mp, 0, sizeof (*mp));
735 mp->_vl_msg_id = ntohs (VL_API_IP_ADD_DEL_ROUTE);
736 mp->client_index = tm->my_client_index;
737 mp->context = 0xdeadbeef;
738 mp->table_id = ntohl (0);
739 mp->create_vrf_if_needed = 1;
740 /* Arp, please, if needed */
741 mp->resolve_if_needed = 1;
742 mp->resolve_attempts = ntohl (10);
744 mp->next_hop_sw_if_index = ntohl (5);
745 mp->is_add = enable_disable;
746 mp->next_hop_weight = 1;
748 /* Next hop: 6.0.0.1 */
749 tmp = ntohl (0x06000001);
750 clib_memcpy (mp->next_hop_address, &tmp, sizeof (tmp));
752 /* Destination: 10.0.0.1/32 */
754 clib_memcpy (mp->dst_address, &tmp, sizeof (tmp));
755 mp->dst_address_length = 0;
757 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
761 add_del_ip6_route (test_main_t * tm, int enable_disable)
763 vl_api_ip_add_del_route_t *mp;
766 mp = vl_msg_api_alloc (sizeof (*mp));
767 memset (mp, 0, sizeof (*mp));
768 mp->_vl_msg_id = ntohs (VL_API_IP_ADD_DEL_ROUTE);
769 mp->client_index = tm->my_client_index;
770 mp->context = 0xdeadbeef;
771 mp->next_hop_sw_if_index = ntohl (5);
772 mp->is_add = enable_disable;
774 mp->next_hop_weight = 1;
775 mp->dst_address_length = 64;
777 /* add/del dabe::/64 via db01::11 */
779 tmp[0] = clib_host_to_net_u64 (0xdabe000000000000ULL);
780 tmp[1] = clib_host_to_net_u64 (0x0ULL);
781 clib_memcpy (mp->dst_address, &tmp[0], 8);
782 clib_memcpy (&mp->dst_address[8], &tmp[1], 8);
784 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
785 tmp[1] = clib_host_to_net_u64 (0x11ULL);
786 clib_memcpy (mp->next_hop_address, &tmp[0], 8);
787 clib_memcpy (&mp->next_hop_address[8], &tmp[1], 8);
789 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
793 add_del_interface_address (test_main_t * tm, int enable_disable)
795 vl_api_sw_interface_add_del_address_t *mp;
798 mp = vl_msg_api_alloc (sizeof (*mp));
799 memset (mp, 0, sizeof (*mp));
800 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
801 mp->client_index = tm->my_client_index;
802 mp->context = 0xdeadbeef;
803 mp->sw_if_index = ntohl (5);
804 mp->is_add = enable_disable;
805 mp->address_length = 8;
807 tmp = ntohl (0x01020304);
808 clib_memcpy (mp->address, &tmp, 4);
810 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
814 add_del_v6_interface_address (test_main_t * tm, int enable_disable)
816 vl_api_sw_interface_add_del_address_t *mp;
819 mp = vl_msg_api_alloc (sizeof (*mp));
820 memset (mp, 0, sizeof (*mp));
821 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
822 mp->client_index = tm->my_client_index;
823 mp->context = 0xdeadbeef;
825 mp->sw_if_index = ntohl (5);
826 mp->is_add = enable_disable;
827 mp->address_length = 64;
829 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
830 tmp[1] = clib_host_to_net_u64 (0x11ULL);
832 clib_memcpy (mp->address, &tmp[0], 8);
833 clib_memcpy (&mp->address[8], &tmp[1], 8);
835 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
839 del_all_interface_addresses (test_main_t * tm)
841 vl_api_sw_interface_add_del_address_t *mp;
843 mp = vl_msg_api_alloc (sizeof (*mp));
844 memset (mp, 0, sizeof (*mp));
845 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
846 mp->client_index = tm->my_client_index;
847 mp->context = 0xdeadbeef;
848 mp->sw_if_index = ntohl (5);
851 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
855 set_interface_table (test_main_t * tm, int is_ipv6, u32 vrf_id)
857 vl_api_sw_interface_set_table_t *mp;
859 mp = vl_msg_api_alloc (sizeof (*mp));
860 memset (mp, 0, sizeof (*mp));
861 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_TABLE);
862 mp->client_index = tm->my_client_index;
863 mp->context = 0xdeadbeef;
864 mp->sw_if_index = ntohl (5);
865 mp->is_ipv6 = is_ipv6;
866 mp->vrf_id = ntohl (vrf_id);
868 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
872 connect_unix_tap (test_main_t * tm, char *name)
874 vl_api_tap_connect_t *mp;
876 mp = vl_msg_api_alloc (sizeof (*mp));
877 memset (mp, 0, sizeof (*mp));
878 mp->_vl_msg_id = ntohs (VL_API_TAP_CONNECT);
879 mp->client_index = tm->my_client_index;
880 mp->context = 0xdeadbeef;
881 strncpy ((char *) mp->tap_name, name, sizeof (mp->tap_name) - 1);
882 mp->use_random_mac = 1;
883 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
887 create_vlan_subif (test_main_t * tm, u32 vlan_id)
889 vl_api_create_vlan_subif_t *mp;
891 mp = vl_msg_api_alloc (sizeof (*mp));
892 memset (mp, 0, sizeof (*mp));
893 mp->_vl_msg_id = ntohs (VL_API_CREATE_VLAN_SUBIF);
894 mp->client_index = tm->my_client_index;
895 mp->context = 0xdeadbeef;
896 mp->sw_if_index = ntohl (5);
897 mp->vlan_id = ntohl (vlan_id);
899 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
903 add_del_proxy_arp (test_main_t * tm, int is_add)
905 vl_api_proxy_arp_add_del_t *mp;
908 mp = vl_msg_api_alloc (sizeof (*mp));
909 memset (mp, 0, sizeof (*mp));
910 mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_ADD_DEL);
911 mp->client_index = tm->my_client_index;
912 mp->context = 0xdeadbeef;
913 mp->vrf_id = ntohl (11);
916 /* proxy fib 11, 1.1.1.1 -> 1.1.1.10 */
917 tmp = ntohl (0x01010101);
918 clib_memcpy (mp->low_address, &tmp, 4);
920 tmp = ntohl (0x0101010a);
921 clib_memcpy (mp->hi_address, &tmp, 4);
923 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
927 proxy_arp_intfc_enable_disable (test_main_t * tm, int enable_disable)
929 vl_api_proxy_arp_intfc_enable_disable_t *mp;
931 mp = vl_msg_api_alloc (sizeof (*mp));
932 memset (mp, 0, sizeof (*mp));
933 mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_INTFC_ENABLE_DISABLE);
934 mp->client_index = tm->my_client_index;
935 mp->context = 0xdeadbeef;
936 mp->sw_if_index = ntohl (6);
937 mp->enable_disable = enable_disable;
939 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
943 add_ip4_neighbor (test_main_t * tm, int add_del)
945 vl_api_ip_neighbor_add_del_t *mp;
948 mp = vl_msg_api_alloc (sizeof (*mp));
949 memset (mp, 0, sizeof (*mp));
950 mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_ADD_DEL);
951 mp->client_index = tm->my_client_index;
952 mp->context = 0xdeadbeef;
953 mp->vrf_id = ntohl (11);
954 mp->sw_if_index = ntohl (6);
955 mp->is_add = add_del;
957 memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
959 tmp = ntohl (0x0101010a);
960 clib_memcpy (mp->dst_address, &tmp, 4);
962 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
966 add_ip6_neighbor (test_main_t * tm, int add_del)
968 vl_api_ip_neighbor_add_del_t *mp;
971 mp = vl_msg_api_alloc (sizeof (*mp));
972 memset (mp, 0, sizeof (*mp));
973 mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_ADD_DEL);
974 mp->client_index = tm->my_client_index;
975 mp->context = 0xdeadbeef;
976 mp->vrf_id = ntohl (11);
977 mp->sw_if_index = ntohl (6);
978 mp->is_add = add_del;
981 memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
983 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
984 tmp[1] = clib_host_to_net_u64 (0x11ULL);
986 clib_memcpy (mp->dst_address, &tmp[0], 8);
987 clib_memcpy (&mp->dst_address[8], &tmp[1], 8);
989 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
993 reset_fib (test_main_t * tm, u8 is_ip6)
995 vl_api_reset_fib_t *mp;
997 mp = vl_msg_api_alloc (sizeof (*mp));
998 memset (mp, 0, sizeof (*mp));
999 mp->_vl_msg_id = ntohs (VL_API_RESET_FIB);
1000 mp->client_index = tm->my_client_index;
1001 mp->context = 0xdeadbeef;
1002 mp->vrf_id = ntohl (11);
1003 mp->is_ipv6 = is_ip6;
1005 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1009 dhcpv6_set_vss (test_main_t * tm)
1011 vl_api_dhcp_proxy_set_vss_t *mp;
1013 mp = vl_msg_api_alloc (sizeof (*mp));
1014 memset (mp, 0, sizeof (*mp));
1015 mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_SET_VSS);
1016 mp->client_index = tm->my_client_index;
1017 mp->context = 0xdeadbeef;
1018 mp->oui = ntohl (6);
1019 mp->fib_id = ntohl (60);
1022 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1026 dhcpv4_set_vss (test_main_t * tm)
1028 vl_api_dhcp_proxy_set_vss_t *mp;
1030 mp = vl_msg_api_alloc (sizeof (*mp));
1031 memset (mp, 0, sizeof (*mp));
1032 mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_SET_VSS);
1033 mp->client_index = tm->my_client_index;
1034 mp->context = 0xdeadbeef;
1035 mp->oui = ntohl (4);
1036 mp->fib_id = ntohl (40);
1039 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1043 dhcp_set_vss (test_main_t * tm)
1045 dhcpv4_set_vss (tm);
1046 dhcpv6_set_vss (tm);
1050 dhcp_set_proxy (test_main_t * tm, int ipv6)
1052 vl_api_dhcp_proxy_config_t *mp;
1054 mp = vl_msg_api_alloc (sizeof (*mp));
1055 memset (mp, 0, sizeof (*mp));
1056 mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_CONFIG);
1057 mp->client_index = tm->my_client_index;
1058 mp->context = 0xdeadbeef;
1059 mp->vrf_id = ntohl (0);
1061 mp->insert_circuit_id = 1;
1063 mp->dhcp_server[0] = 0x20;
1064 mp->dhcp_server[1] = 0x01;
1065 mp->dhcp_server[2] = 0xab;
1066 mp->dhcp_server[3] = 0xcd;
1067 mp->dhcp_server[4] = 0x12;
1068 mp->dhcp_server[5] = 0x34;
1069 mp->dhcp_server[6] = 0xfe;
1070 mp->dhcp_server[7] = 0xdc;
1071 mp->dhcp_server[14] = 0;
1072 mp->dhcp_server[15] = 0x2;
1074 mp->dhcp_src_address[0] = 0x20;
1075 mp->dhcp_src_address[1] = 0x01;
1076 mp->dhcp_src_address[2] = 0xab;
1077 mp->dhcp_src_address[3] = 0xcd;
1078 mp->dhcp_src_address[4] = 0x12;
1079 mp->dhcp_src_address[5] = 0x34;
1080 mp->dhcp_src_address[6] = 0x56;
1081 mp->dhcp_src_address[7] = 0x78;
1082 mp->dhcp_src_address[14] = 0;
1083 mp->dhcp_src_address[15] = 0x2;
1085 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1089 set_ip_flow_hash (test_main_t * tm, u8 is_ip6)
1091 vl_api_set_ip_flow_hash_t *mp;
1093 mp = vl_msg_api_alloc (sizeof (*mp));
1094 memset (mp, 0, sizeof (*mp));
1095 mp->_vl_msg_id = ntohs (VL_API_SET_IP_FLOW_HASH);
1096 mp->client_index = tm->my_client_index;
1097 mp->context = 0xdeadbeef;
1099 mp->is_ipv6 = is_ip6;
1103 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1107 ip6nd_ra_config (test_main_t * tm, int is_no)
1109 vl_api_sw_interface_ip6nd_ra_config_t *mp;
1111 mp = vl_msg_api_alloc (sizeof (*mp));
1112 memset (mp, 0, sizeof (*mp));
1114 mp->client_index = tm->my_client_index;
1115 mp->context = 0xdeadbeef;
1116 mp->sw_if_index = ntohl (5);
1122 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6ND_RA_CONFIG);
1123 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1127 ip6nd_ra_prefix (test_main_t * tm, int is_no)
1129 vl_api_sw_interface_ip6nd_ra_prefix_t *mp;
1132 mp = vl_msg_api_alloc (sizeof (*mp));
1133 memset (mp, 0, sizeof (*mp));
1135 mp->client_index = tm->my_client_index;
1136 mp->context = 0xdeadbeef;
1137 mp->sw_if_index = ntohl (5);
1140 mp->use_default = 1;
1143 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
1144 tmp[1] = clib_host_to_net_u64 (0x11ULL);
1147 clib_memcpy (mp->address, &tmp[0], 8);
1148 clib_memcpy (&mp->address[8], &tmp[1], 8);
1150 mp->address_length = 64;
1153 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6ND_RA_PREFIX);
1154 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1158 ip6_enable_disable (test_main_t * tm, int enable)
1160 vl_api_sw_interface_ip6_enable_disable_t *mp;
1162 mp = vl_msg_api_alloc (sizeof (*mp));
1163 memset (mp, 0, sizeof (*mp));
1165 mp->client_index = tm->my_client_index;
1166 mp->context = 0xdeadbeef;
1167 mp->sw_if_index = ntohl (5);
1168 mp->enable = (enable == 1);;
1170 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6_ENABLE_DISABLE);
1171 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1175 loop_create (test_main_t * tm)
1177 vl_api_create_loopback_t *mp;
1179 mp = vl_msg_api_alloc (sizeof (*mp));
1180 memset (mp, 0, sizeof (*mp));
1182 mp->_vl_msg_id = ntohs (VL_API_CREATE_LOOPBACK);
1183 mp->client_index = tm->my_client_index;
1184 mp->context = 0xdeadbeef;
1185 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1189 ip6_set_link_local_address (test_main_t * tm)
1191 vl_api_sw_interface_ip6_set_link_local_address_t *mp;
1194 mp = vl_msg_api_alloc (sizeof (*mp));
1195 memset (mp, 0, sizeof (*mp));
1197 mp->client_index = tm->my_client_index;
1198 mp->context = 0xdeadbeef;
1199 mp->sw_if_index = ntohl (5);
1201 tmp[0] = clib_host_to_net_u64 (0xfe80000000000000ULL);
1202 tmp[1] = clib_host_to_net_u64 (0x11ULL);
1204 clib_memcpy (mp->address, &tmp[0], 8);
1205 clib_memcpy (&mp->address[8], &tmp[1], 8);
1207 mp->address_length = 64;
1209 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS);
1211 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1216 set_flags (test_main_t * tm, int up_down)
1218 vl_api_sw_interface_set_flags_t *mp;
1220 mp = vl_msg_api_alloc (sizeof (*mp));
1221 memset (mp, 0, sizeof (*mp));
1223 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_FLAGS);
1224 mp->client_index = tm->my_client_index;
1225 mp->context = 0xdeadbeef;
1226 mp->sw_if_index = ntohl (5);
1227 mp->admin_up_down = up_down;
1228 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1233 l2_patch_add_del (test_main_t * tm, int is_add)
1235 vl_api_l2_patch_add_del_t *mp;
1237 mp = vl_msg_api_alloc (sizeof (*mp));
1238 memset (mp, 0, sizeof (*mp));
1239 mp->_vl_msg_id = ntohs (VL_API_L2_PATCH_ADD_DEL);
1240 mp->client_index = tm->my_client_index;
1241 mp->context = 0xdeadbeef;
1242 mp->is_add = is_add;
1243 mp->rx_sw_if_index = ntohl (1);
1244 mp->tx_sw_if_index = ntohl (2);
1246 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1250 l2_xconnect (test_main_t * tm)
1252 vl_api_sw_interface_set_l2_xconnect_t *mp;
1254 mp = vl_msg_api_alloc (sizeof (*mp));
1255 memset (mp, 0, sizeof (*mp));
1256 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_L2_XCONNECT);
1257 mp->client_index = tm->my_client_index;
1258 mp->context = 0xdeadbeef;
1259 mp->rx_sw_if_index = ntohl (5);
1260 mp->tx_sw_if_index = ntohl (6);
1263 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1267 l2_bridge (test_main_t * tm)
1269 vl_api_sw_interface_set_l2_bridge_t *mp;
1271 mp = vl_msg_api_alloc (sizeof (*mp));
1272 memset (mp, 0, sizeof (*mp));
1273 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_L2_BRIDGE);
1274 mp->client_index = tm->my_client_index;
1275 mp->context = 0xdeadbeef;
1276 mp->rx_sw_if_index = ntohl (5);
1277 mp->bd_id = ntohl (6);
1278 mp->bvi = ntohl (1);
1279 mp->shg = ntohl (0);
1282 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1286 main (int argc, char **argv)
1288 api_main_t *am = &api_main;
1289 test_main_t *tm = &test_main;
1292 connect_to_vpe ("test_client");
1294 tm->vl_input_queue = shmem_hdr->vl_input_queue;
1295 tm->my_client_index = am->my_client_index;
1297 fformat (stdout, "Type 'h' for help, 'q' to quit...\n");
1310 link_up_down_enable_disable (tm, 1 /* enable_disable */ );
1313 link_up_down_enable_disable (tm, 0 /* enable_disable */ );
1316 stats_enable_disable (tm, 1 /* enable_disable */ );
1319 stats_enable_disable (tm, 0 /* enable_disable */ );
1322 add_del_ip4_route (tm, 0 /* add */ );
1325 add_del_ip4_route (tm, 1 /* add */ );
1328 add_del_ip6_route (tm, 0 /* add */ );
1331 add_del_ip6_route (tm, 1 /* add */ );
1334 add_del_interface_address (tm, 1 /* add */ );
1337 add_del_interface_address (tm, 0 /* add */ );
1340 add_del_v6_interface_address (tm, 1 /* add */ );
1343 add_del_v6_interface_address (tm, 0 /* add */ );
1346 l2_patch_add_del (tm, 1 /* is_add */ );
1349 l2_patch_add_del (tm, 0 /* is_add */ );
1352 del_all_interface_addresses (tm);
1355 set_interface_table (tm, 0 /* is_ipv6 */ ,
1356 11 /* my amp goes to 11 */ );
1359 set_interface_table (tm, 1 /* is_ipv6 */ ,
1360 12 /* my amp goes to 12 */ );
1364 create_vlan_subif (tm, 123);
1368 connect_unix_tap (tm, "foo");
1372 add_ip4_neighbor (tm, 1 /* is_add */ );
1373 add_ip6_neighbor (tm, 1 /* is_add */ );
1377 add_ip4_neighbor (tm, 0 /* is_add */ );
1378 add_ip6_neighbor (tm, 0 /* is_add */ );
1382 add_del_proxy_arp (tm, 1 /* add */ );
1386 proxy_arp_intfc_enable_disable (tm, 1 /* enable */ );
1390 oam_events_enable_disable (tm, 0 /* enable */ );
1394 oam_events_enable_disable (tm, 1 /* enable */ );
1398 oam_add_del (tm, 0 /* is_add */ );
1402 oam_add_del (tm, 1 /* is_add */ );
1406 reset_fib (tm, 0 /* is_ip6 */ );
1410 reset_fib (tm, 1 /* is_ip6 */ );
1418 dhcp_set_proxy (tm, 0);
1422 dhcp_set_proxy (tm, 1 /*ipv6 */ );
1426 set_ip_flow_hash (tm, 0 /* is_ip6 */ );
1430 ip6_set_link_local_address (tm);
1434 ip6_enable_disable (tm, 1 /* enable */ );
1438 ip6_enable_disable (tm, 0 /* disable */ );
1442 ip6nd_ra_config (tm, 0 /* is_no */ );
1445 ip6nd_ra_config (tm, 1 /* is_no */ );
1448 ip6nd_ra_prefix (tm, 0 /* is_no */ );
1451 ip6nd_ra_prefix (tm, 1 /* is_no */ );
1459 set_flags (tm, 1 /* up_down */ );
1463 set_flags (tm, 0 /* up_down */ );
1475 fformat (stdout, "q=quit,d=dump,L=link evts on,l=link evts off\n");
1476 fformat (stdout, "S=stats on,s=stats off\n");
1477 fformat (stdout, "4=add v4 route, 3=del v4 route\n");
1478 fformat (stdout, "6=add v6 route, 5=del v6 route\n");
1479 fformat (stdout, "A=add v4 intfc route, a=del v4 intfc route\n");
1480 fformat (stdout, "B=add v6 intfc route, b=del v6 intfc route\n");
1481 fformat (stdout, "z=del all intfc routes\n");
1482 fformat (stdout, "t=set v4 intfc table, T=set v6 intfc table\n");
1483 fformat (stdout, "c=connect unix tap\n");
1485 "j=set dhcpv4 and v6 link-address/option-82 params\n");
1486 fformat (stdout, "k=set dhcpv4 relay agent params\n");
1487 fformat (stdout, "K=set dhcpv6 relay agent params\n");
1488 fformat (stdout, "E=add l2 patch, e=del l2 patch\n");
1489 fformat (stdout, "V=ip6 set link-local address \n");
1490 fformat (stdout, "w=ip6 enable \n");
1491 fformat (stdout, "W=ip6 disable \n");
1492 fformat (stdout, "x=ip6 nd config \n");
1493 fformat (stdout, "X=no ip6 nd config\n");
1494 fformat (stdout, "y=ip6 nd prefix \n");
1495 fformat (stdout, "Y=no ip6 nd prefix\n");
1496 fformat (stdout, "@=l2 xconnect\n");
1497 fformat (stdout, "#=l2 bridge\n");
1507 if (tm->link_events_on)
1508 link_up_down_enable_disable (tm, 0 /* enable */ );
1510 stats_enable_disable (tm, 0 /* enable */ );
1511 if (tm->oam_events_on)
1512 oam_events_enable_disable (tm, 0 /* enable */ );
1514 disconnect_from_vpe ();
1518 #undef vl_api_version
1519 #define vl_api_version(n,v) static u32 vpe_api_version = v;
1520 #include <vpp-api/vpe.api.h>
1521 #undef vl_api_version
1524 vl_client_add_api_signatures (vl_api_memclnt_create_t * mp)
1527 * Send the main API signature in slot 0. This bit of code must
1528 * match the checks in ../vpe/api/api.c: vl_msg_api_version_check().
1530 mp->api_versions[0] = clib_host_to_net_u32 (vpe_api_version);
1534 * fd.io coding-style-patch-verification: ON
1537 * eval: (c-set-style "gnu")