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_gre_add_del_tunnel_reply_t_handler
229 (vl_api_mpls_gre_add_del_tunnel_reply_t * mp)
231 fformat (stdout, "add_del mpls gre tunnel reply %d\n", ntohl (mp->retval));
235 vl_api_mpls_add_del_encap_reply_t_handler (vl_api_mpls_add_del_encap_reply_t *
238 fformat (stdout, "add del mpls label reply %d\n", ntohl (mp->retval));
242 vl_api_mpls_add_del_decap_reply_t_handler (vl_api_mpls_add_del_decap_reply_t *
245 fformat (stdout, "add del mpls decap label reply %d\n", ntohl (mp->retval));
248 static void vl_api_proxy_arp_add_del_reply_t_handler
249 (vl_api_proxy_arp_add_del_reply_t * mp)
251 fformat (stdout, "add del proxy arp reply %d\n", ntohl (mp->retval));
254 static void vl_api_proxy_arp_intfc_enable_disable_reply_t_handler
255 (vl_api_proxy_arp_intfc_enable_disable_reply_t * mp)
257 fformat (stdout, "proxy arp intfc ena/dis reply %d\n", ntohl (mp->retval));
260 static void vl_api_ip_neighbor_add_del_reply_t_handler
261 (vl_api_ip_neighbor_add_del_reply_t * mp)
263 fformat (stdout, "ip neighbor add del reply %d\n", ntohl (mp->retval));
267 vl_api_vnet_interface_counters_t_handler (vl_api_vnet_interface_counters_t *
271 u32 count, sw_if_index;
274 count = ntohl (mp->count);
275 sw_if_index = ntohl (mp->first_sw_if_index);
276 if (mp->is_combined == 0)
279 vp = (u64 *) mp->data;
281 switch (mp->vnet_counter_type)
283 case VNET_INTERFACE_COUNTER_DROP:
284 counter_name = "drop";
286 case VNET_INTERFACE_COUNTER_PUNT:
287 counter_name = "punt";
289 case VNET_INTERFACE_COUNTER_IP4:
290 counter_name = "ip4";
292 case VNET_INTERFACE_COUNTER_IP6:
293 counter_name = "ip6";
295 case VNET_INTERFACE_COUNTER_RX_NO_BUF:
296 counter_name = "rx-no-buf";
298 case VNET_INTERFACE_COUNTER_RX_MISS:
299 counter_name = "rx-miss";
301 case VNET_INTERFACE_COUNTER_RX_ERROR:
302 counter_name = "rx-error";
304 case VNET_INTERFACE_COUNTER_TX_ERROR:
305 counter_name = "tx-error (fifo-full)";
308 counter_name = "bogus";
311 for (i = 0; i < count; i++)
313 v = clib_mem_unaligned (vp, u64);
314 v = clib_net_to_host_u64 (v);
316 fformat (stdout, "%d.%s %lld\n", sw_if_index, counter_name, v);
324 vp = (vlib_counter_t *) mp->data;
326 switch (mp->vnet_counter_type)
328 case VNET_INTERFACE_COUNTER_RX:
331 case VNET_INTERFACE_COUNTER_TX:
335 counter_name = "bogus";
338 for (i = 0; i < count; i++)
340 packets = clib_mem_unaligned (&vp->packets, u64);
341 packets = clib_net_to_host_u64 (packets);
342 bytes = clib_mem_unaligned (&vp->bytes, u64);
343 bytes = clib_net_to_host_u64 (bytes);
345 fformat (stdout, "%d.%s.packets %lld\n",
346 sw_if_index, counter_name, packets);
347 fformat (stdout, "%d.%s.bytes %lld\n",
348 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));
556 vl_api_sr_tunnel_add_del_reply_t_handler (vl_api_sr_tunnel_add_del_reply_t *
559 fformat (stdout, "sr tunnel add/del reply %d\n", ntohl (mp->retval));
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_INTERFACE_COUNTERS, vnet_interface_counters) \
600 _(VNET_IP4_FIB_COUNTERS, vnet_ip4_fib_counters) \
601 _(VNET_IP6_FIB_COUNTERS, vnet_ip6_fib_counters) \
602 _(IP_ADD_DEL_ROUTE_REPLY, ip_add_del_route_reply) \
603 _(SW_INTERFACE_ADD_DEL_ADDRESS_REPLY, sw_interface_add_del_address_reply) \
604 _(SW_INTERFACE_SET_TABLE_REPLY, sw_interface_set_table_reply) \
605 _(TAP_CONNECT_REPLY, tap_connect_reply) \
606 _(CREATE_VLAN_SUBIF_REPLY, create_vlan_subif_reply) \
607 _(MPLS_GRE_ADD_DEL_TUNNEL_REPLY, mpls_gre_add_del_tunnel_reply) \
608 _(MPLS_ADD_DEL_ENCAP_REPLY, mpls_add_del_encap_reply) \
609 _(MPLS_ADD_DEL_DECAP_REPLY, mpls_add_del_decap_reply) \
610 _(PROXY_ARP_ADD_DEL_REPLY, proxy_arp_add_del_reply) \
611 _(PROXY_ARP_INTFC_ENABLE_DISABLE_REPLY, proxy_arp_intfc_enable_disable_reply) \
612 _(IP_NEIGHBOR_ADD_DEL_REPLY, ip_neighbor_add_del_reply) \
613 _(RESET_FIB_REPLY, reset_fib_reply) \
614 _(DHCP_PROXY_CONFIG_REPLY, dhcp_proxy_config_reply) \
615 _(DHCP_PROXY_SET_VSS_REPLY, dhcp_proxy_set_vss_reply) \
616 _(SET_IP_FLOW_HASH_REPLY, set_ip_flow_hash_reply) \
617 _(SW_INTERFACE_IP6ND_RA_CONFIG_REPLY, sw_interface_ip6nd_ra_config_reply) \
618 _(SW_INTERFACE_IP6ND_RA_PREFIX_REPLY, sw_interface_ip6nd_ra_prefix_reply) \
619 _(SW_INTERFACE_IP6_ENABLE_DISABLE_REPLY, sw_interface_ip6_enable_disable_reply) \
620 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS_REPLY, sw_interface_ip6_set_link_local_address_reply) \
621 _(CREATE_LOOPBACK_REPLY, create_loopback_reply) \
622 _(L2_PATCH_ADD_DEL_REPLY, l2_patch_add_del_reply) \
623 _(SR_TUNNEL_ADD_DEL_REPLY,sr_tunnel_add_del_reply) \
624 _(SW_INTERFACE_SET_L2_XCONNECT_REPLY, sw_interface_set_l2_xconnect_reply) \
625 _(SW_INTERFACE_SET_L2_BRIDGE_REPLY, sw_interface_set_l2_bridge_reply)
628 connect_to_vpe (char *name)
632 rv = vl_client_connect_to_vlib ("/vpe-api", name, 32);
635 vl_msg_api_set_handlers(VL_API_##N, #n, \
636 vl_api_##n##_t_handler, \
638 vl_api_##n##_t_endian, \
639 vl_api_##n##_t_print, \
640 sizeof(vl_api_##n##_t), 1);
644 shmem_hdr = api_main.shmem_hdr;
650 disconnect_from_vpe (void)
652 vl_client_disconnect_from_vlib ();
657 link_up_down_enable_disable (test_main_t * tm, int enable)
659 vl_api_want_interface_events_t *mp;
661 /* Request admin / link up down messages */
662 mp = vl_msg_api_alloc (sizeof (*mp));
663 memset (mp, 0, sizeof (*mp));
664 mp->_vl_msg_id = ntohs (VL_API_WANT_INTERFACE_EVENTS);
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->link_events_on = enable;
674 stats_enable_disable (test_main_t * tm, int enable)
676 vl_api_want_stats_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_STATS);
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->stats_on = enable;
690 oam_events_enable_disable (test_main_t * tm, int enable)
692 vl_api_want_oam_events_t *mp;
694 mp = vl_msg_api_alloc (sizeof (*mp));
695 memset (mp, 0, sizeof (*mp));
696 mp->_vl_msg_id = ntohs (VL_API_WANT_OAM_EVENTS);
697 mp->client_index = tm->my_client_index;
698 mp->context = 0xdeadbeef;
699 mp->enable_disable = enable;
701 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
702 tm->oam_events_on = enable;
706 oam_add_del (test_main_t * tm, int is_add)
708 vl_api_oam_add_del_t *mp;
711 mp = vl_msg_api_alloc (sizeof (*mp));
712 memset (mp, 0, sizeof (*mp));
713 mp->_vl_msg_id = ntohs (VL_API_OAM_ADD_DEL);
714 mp->client_index = tm->my_client_index;
715 mp->context = 0xdeadbeef;
718 tmp.as_u32 = ntohl (0xc0a80101); /* 192.168.1.1 */
719 clib_memcpy (mp->src_address, tmp.as_u8, 4);
721 tmp.as_u32 = ntohl (0xc0a80103); /* 192.168.1.3 */
722 clib_memcpy (mp->dst_address, tmp.as_u8, 4);
725 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
729 dump (test_main_t * tm)
731 vl_api_sw_interface_dump_t *mp;
733 mp = vl_msg_api_alloc (sizeof (*mp));
734 memset (mp, 0, sizeof (*mp));
735 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_DUMP);
736 mp->client_index = tm->my_client_index;
737 mp->name_filter_valid = 1;
738 strncpy ((char *) mp->name_filter, "eth", sizeof (mp->name_filter) - 1);
740 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
744 add_del_ip4_route (test_main_t * tm, int enable_disable)
746 vl_api_ip_add_del_route_t *mp;
749 mp = vl_msg_api_alloc (sizeof (*mp));
750 memset (mp, 0, sizeof (*mp));
751 mp->_vl_msg_id = ntohs (VL_API_IP_ADD_DEL_ROUTE);
752 mp->client_index = tm->my_client_index;
753 mp->context = 0xdeadbeef;
754 mp->vrf_id = ntohl (0);
755 mp->create_vrf_if_needed = 1;
756 /* Arp, please, if needed */
757 mp->resolve_if_needed = 1;
758 mp->resolve_attempts = ntohl (10);
760 mp->next_hop_sw_if_index = ntohl (5);
761 mp->is_add = enable_disable;
762 mp->next_hop_weight = 1;
764 /* Next hop: 6.0.0.1 */
765 tmp = ntohl (0x06000001);
766 clib_memcpy (mp->next_hop_address, &tmp, sizeof (tmp));
768 /* Destination: 10.0.0.1/32 */
770 clib_memcpy (mp->dst_address, &tmp, sizeof (tmp));
771 mp->dst_address_length = 0;
773 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
777 add_del_ip6_route (test_main_t * tm, int enable_disable)
779 vl_api_ip_add_del_route_t *mp;
782 mp = vl_msg_api_alloc (sizeof (*mp));
783 memset (mp, 0, sizeof (*mp));
784 mp->_vl_msg_id = ntohs (VL_API_IP_ADD_DEL_ROUTE);
785 mp->client_index = tm->my_client_index;
786 mp->context = 0xdeadbeef;
787 mp->next_hop_sw_if_index = ntohl (5);
788 mp->is_add = enable_disable;
790 mp->next_hop_weight = 1;
791 mp->dst_address_length = 64;
793 /* add/del dabe::/64 via db01::11 */
795 tmp[0] = clib_host_to_net_u64 (0xdabe000000000000ULL);
796 tmp[1] = clib_host_to_net_u64 (0x0ULL);
797 clib_memcpy (mp->dst_address, &tmp[0], 8);
798 clib_memcpy (&mp->dst_address[8], &tmp[1], 8);
800 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
801 tmp[1] = clib_host_to_net_u64 (0x11ULL);
802 clib_memcpy (mp->next_hop_address, &tmp[0], 8);
803 clib_memcpy (&mp->next_hop_address[8], &tmp[1], 8);
805 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
809 add_del_interface_address (test_main_t * tm, int enable_disable)
811 vl_api_sw_interface_add_del_address_t *mp;
814 mp = vl_msg_api_alloc (sizeof (*mp));
815 memset (mp, 0, sizeof (*mp));
816 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
817 mp->client_index = tm->my_client_index;
818 mp->context = 0xdeadbeef;
819 mp->sw_if_index = ntohl (5);
820 mp->is_add = enable_disable;
821 mp->address_length = 8;
823 tmp = ntohl (0x01020304);
824 clib_memcpy (mp->address, &tmp, 4);
826 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
830 add_del_v6_interface_address (test_main_t * tm, int enable_disable)
832 vl_api_sw_interface_add_del_address_t *mp;
835 mp = vl_msg_api_alloc (sizeof (*mp));
836 memset (mp, 0, sizeof (*mp));
837 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_ADD_DEL_ADDRESS);
838 mp->client_index = tm->my_client_index;
839 mp->context = 0xdeadbeef;
841 mp->sw_if_index = ntohl (5);
842 mp->is_add = enable_disable;
843 mp->address_length = 64;
845 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
846 tmp[1] = clib_host_to_net_u64 (0x11ULL);
848 clib_memcpy (mp->address, &tmp[0], 8);
849 clib_memcpy (&mp->address[8], &tmp[1], 8);
851 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
855 del_all_interface_addresses (test_main_t * tm)
857 vl_api_sw_interface_add_del_address_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_ADD_DEL_ADDRESS);
862 mp->client_index = tm->my_client_index;
863 mp->context = 0xdeadbeef;
864 mp->sw_if_index = ntohl (5);
867 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
871 set_interface_table (test_main_t * tm, int is_ipv6, u32 vrf_id)
873 vl_api_sw_interface_set_table_t *mp;
875 mp = vl_msg_api_alloc (sizeof (*mp));
876 memset (mp, 0, sizeof (*mp));
877 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_TABLE);
878 mp->client_index = tm->my_client_index;
879 mp->context = 0xdeadbeef;
880 mp->sw_if_index = ntohl (5);
881 mp->is_ipv6 = is_ipv6;
882 mp->vrf_id = ntohl (vrf_id);
884 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
888 connect_unix_tap (test_main_t * tm, char *name)
890 vl_api_tap_connect_t *mp;
892 mp = vl_msg_api_alloc (sizeof (*mp));
893 memset (mp, 0, sizeof (*mp));
894 mp->_vl_msg_id = ntohs (VL_API_TAP_CONNECT);
895 mp->client_index = tm->my_client_index;
896 mp->context = 0xdeadbeef;
897 clib_memcpy (mp->tap_name, name, strlen (name));
898 mp->use_random_mac = 1;
899 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
903 create_vlan_subif (test_main_t * tm, u32 vlan_id)
905 vl_api_create_vlan_subif_t *mp;
907 mp = vl_msg_api_alloc (sizeof (*mp));
908 memset (mp, 0, sizeof (*mp));
909 mp->_vl_msg_id = ntohs (VL_API_CREATE_VLAN_SUBIF);
910 mp->client_index = tm->my_client_index;
911 mp->context = 0xdeadbeef;
912 mp->sw_if_index = ntohl (5);
913 mp->vlan_id = ntohl (vlan_id);
915 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
919 create_mpls_gre_tunnel (test_main_t * tm, u32 vrf_id, u32 label, u8 is_add)
921 vl_api_mpls_add_del_encap_t *lp;
922 vl_api_mpls_add_del_decap_t *dlp;
923 vl_api_mpls_gre_add_del_tunnel_t *mp;
926 dlp = vl_msg_api_alloc (sizeof (*dlp));
927 memset (dlp, 0, sizeof (*dlp));
928 dlp->_vl_msg_id = ntohs (VL_API_MPLS_ADD_DEL_DECAP);
929 dlp->client_index = tm->my_client_index;
930 dlp->context = 0xdeadbeef;
931 dlp->tx_vrf_id = ntohl (vrf_id);
932 dlp->label = ntohl (label);
934 dlp->is_add = is_add;
935 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & dlp);
937 lp = vl_msg_api_alloc (sizeof (*lp) + sizeof (u32));
938 memset (lp, 0, sizeof (*lp) + sizeof (u32));
939 lp->_vl_msg_id = ntohs (VL_API_MPLS_ADD_DEL_ENCAP);
940 lp->client_index = tm->my_client_index;
941 lp->context = 0xdeadbeef;
942 lp->vrf_id = ntohl (vrf_id);
943 lp->labels[0] = ntohl (label);
947 tmp = ntohl (0x05000001);
948 clib_memcpy (lp->dst_address, &tmp, 4);
950 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & lp);
952 mp = vl_msg_api_alloc (sizeof (*mp));
953 memset (mp, 0, sizeof (*mp));
954 mp->_vl_msg_id = ntohs (VL_API_MPLS_GRE_ADD_DEL_TUNNEL);
955 mp->client_index = tm->my_client_index;
956 mp->context = 0xdeadbeef;
957 mp->inner_vrf_id = ntohl (vrf_id);
958 mp->outer_vrf_id = 0;
962 tmp = ntohl (0x06000001);
963 clib_memcpy (mp->src_address, &tmp, 4);
965 tmp = ntohl (0x05000001);
966 clib_memcpy (mp->dst_address, &tmp, 4);
967 /* intfc: 5.0.0.1/24 */
968 tmp = ntohl (0x05000001);
969 clib_memcpy (mp->intfc_address, &tmp, 4);
970 mp->intfc_address_length = 24;
972 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
976 add_del_proxy_arp (test_main_t * tm, int is_add)
978 vl_api_proxy_arp_add_del_t *mp;
981 mp = vl_msg_api_alloc (sizeof (*mp));
982 memset (mp, 0, sizeof (*mp));
983 mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_ADD_DEL);
984 mp->client_index = tm->my_client_index;
985 mp->context = 0xdeadbeef;
986 mp->vrf_id = ntohl (11);
989 /* proxy fib 11, 1.1.1.1 -> 1.1.1.10 */
990 tmp = ntohl (0x01010101);
991 clib_memcpy (mp->low_address, &tmp, 4);
993 tmp = ntohl (0x0101010a);
994 clib_memcpy (mp->hi_address, &tmp, 4);
996 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1000 proxy_arp_intfc_enable_disable (test_main_t * tm, int enable_disable)
1002 vl_api_proxy_arp_intfc_enable_disable_t *mp;
1004 mp = vl_msg_api_alloc (sizeof (*mp));
1005 memset (mp, 0, sizeof (*mp));
1006 mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_INTFC_ENABLE_DISABLE);
1007 mp->client_index = tm->my_client_index;
1008 mp->context = 0xdeadbeef;
1009 mp->sw_if_index = ntohl (6);
1010 mp->enable_disable = enable_disable;
1012 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1016 add_ip4_neighbor (test_main_t * tm, int add_del)
1018 vl_api_ip_neighbor_add_del_t *mp;
1021 mp = vl_msg_api_alloc (sizeof (*mp));
1022 memset (mp, 0, sizeof (*mp));
1023 mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_ADD_DEL);
1024 mp->client_index = tm->my_client_index;
1025 mp->context = 0xdeadbeef;
1026 mp->vrf_id = ntohl (11);
1027 mp->sw_if_index = ntohl (6);
1028 mp->is_add = add_del;
1030 memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
1032 tmp = ntohl (0x0101010a);
1033 clib_memcpy (mp->dst_address, &tmp, 4);
1035 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1039 add_ip6_neighbor (test_main_t * tm, int add_del)
1041 vl_api_ip_neighbor_add_del_t *mp;
1044 mp = vl_msg_api_alloc (sizeof (*mp));
1045 memset (mp, 0, sizeof (*mp));
1046 mp->_vl_msg_id = ntohs (VL_API_IP_NEIGHBOR_ADD_DEL);
1047 mp->client_index = tm->my_client_index;
1048 mp->context = 0xdeadbeef;
1049 mp->vrf_id = ntohl (11);
1050 mp->sw_if_index = ntohl (6);
1051 mp->is_add = add_del;
1054 memset (mp->mac_address, 0xbe, sizeof (mp->mac_address));
1056 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
1057 tmp[1] = clib_host_to_net_u64 (0x11ULL);
1059 clib_memcpy (mp->dst_address, &tmp[0], 8);
1060 clib_memcpy (&mp->dst_address[8], &tmp[1], 8);
1062 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1066 reset_fib (test_main_t * tm, u8 is_ip6)
1068 vl_api_reset_fib_t *mp;
1070 mp = vl_msg_api_alloc (sizeof (*mp));
1071 memset (mp, 0, sizeof (*mp));
1072 mp->_vl_msg_id = ntohs (VL_API_RESET_FIB);
1073 mp->client_index = tm->my_client_index;
1074 mp->context = 0xdeadbeef;
1075 mp->vrf_id = ntohl (11);
1076 mp->is_ipv6 = is_ip6;
1078 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1082 dhcpv6_set_vss (test_main_t * tm)
1084 vl_api_dhcp_proxy_set_vss_t *mp;
1086 mp = vl_msg_api_alloc (sizeof (*mp));
1087 memset (mp, 0, sizeof (*mp));
1088 mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_SET_VSS);
1089 mp->client_index = tm->my_client_index;
1090 mp->context = 0xdeadbeef;
1091 mp->oui = ntohl (6);
1092 mp->fib_id = ntohl (60);
1095 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1099 dhcpv4_set_vss (test_main_t * tm)
1101 vl_api_dhcp_proxy_set_vss_t *mp;
1103 mp = vl_msg_api_alloc (sizeof (*mp));
1104 memset (mp, 0, sizeof (*mp));
1105 mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_SET_VSS);
1106 mp->client_index = tm->my_client_index;
1107 mp->context = 0xdeadbeef;
1108 mp->oui = ntohl (4);
1109 mp->fib_id = ntohl (40);
1112 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1116 dhcp_set_vss (test_main_t * tm)
1118 dhcpv4_set_vss (tm);
1119 dhcpv6_set_vss (tm);
1123 dhcp_set_proxy (test_main_t * tm, int ipv6)
1125 vl_api_dhcp_proxy_config_t *mp;
1127 mp = vl_msg_api_alloc (sizeof (*mp));
1128 memset (mp, 0, sizeof (*mp));
1129 mp->_vl_msg_id = ntohs (VL_API_DHCP_PROXY_CONFIG);
1130 mp->client_index = tm->my_client_index;
1131 mp->context = 0xdeadbeef;
1132 mp->vrf_id = ntohl (0);
1134 mp->insert_circuit_id = 1;
1136 mp->dhcp_server[0] = 0x20;
1137 mp->dhcp_server[1] = 0x01;
1138 mp->dhcp_server[2] = 0xab;
1139 mp->dhcp_server[3] = 0xcd;
1140 mp->dhcp_server[4] = 0x12;
1141 mp->dhcp_server[5] = 0x34;
1142 mp->dhcp_server[6] = 0xfe;
1143 mp->dhcp_server[7] = 0xdc;
1144 mp->dhcp_server[14] = 0;
1145 mp->dhcp_server[15] = 0x2;
1147 mp->dhcp_src_address[0] = 0x20;
1148 mp->dhcp_src_address[1] = 0x01;
1149 mp->dhcp_src_address[2] = 0xab;
1150 mp->dhcp_src_address[3] = 0xcd;
1151 mp->dhcp_src_address[4] = 0x12;
1152 mp->dhcp_src_address[5] = 0x34;
1153 mp->dhcp_src_address[6] = 0x56;
1154 mp->dhcp_src_address[7] = 0x78;
1155 mp->dhcp_src_address[14] = 0;
1156 mp->dhcp_src_address[15] = 0x2;
1158 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1162 set_ip_flow_hash (test_main_t * tm, u8 is_ip6)
1164 vl_api_set_ip_flow_hash_t *mp;
1166 mp = vl_msg_api_alloc (sizeof (*mp));
1167 memset (mp, 0, sizeof (*mp));
1168 mp->_vl_msg_id = ntohs (VL_API_SET_IP_FLOW_HASH);
1169 mp->client_index = tm->my_client_index;
1170 mp->context = 0xdeadbeef;
1172 mp->is_ipv6 = is_ip6;
1176 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1180 ip6nd_ra_config (test_main_t * tm, int is_no)
1182 vl_api_sw_interface_ip6nd_ra_config_t *mp;
1184 mp = vl_msg_api_alloc (sizeof (*mp));
1185 memset (mp, 0, sizeof (*mp));
1187 mp->client_index = tm->my_client_index;
1188 mp->context = 0xdeadbeef;
1189 mp->sw_if_index = ntohl (5);
1195 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6ND_RA_CONFIG);
1196 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1200 ip6nd_ra_prefix (test_main_t * tm, int is_no)
1202 vl_api_sw_interface_ip6nd_ra_prefix_t *mp;
1205 mp = vl_msg_api_alloc (sizeof (*mp));
1206 memset (mp, 0, sizeof (*mp));
1208 mp->client_index = tm->my_client_index;
1209 mp->context = 0xdeadbeef;
1210 mp->sw_if_index = ntohl (5);
1213 mp->use_default = 1;
1216 tmp[0] = clib_host_to_net_u64 (0xdb01000000000000ULL);
1217 tmp[1] = clib_host_to_net_u64 (0x11ULL);
1220 clib_memcpy (mp->address, &tmp[0], 8);
1221 clib_memcpy (&mp->address[8], &tmp[1], 8);
1223 mp->address_length = 64;
1226 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6ND_RA_PREFIX);
1227 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1231 ip6_enable_disable (test_main_t * tm, int enable)
1233 vl_api_sw_interface_ip6_enable_disable_t *mp;
1235 mp = vl_msg_api_alloc (sizeof (*mp));
1236 memset (mp, 0, sizeof (*mp));
1238 mp->client_index = tm->my_client_index;
1239 mp->context = 0xdeadbeef;
1240 mp->sw_if_index = ntohl (5);
1241 mp->enable = (enable == 1);;
1243 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6_ENABLE_DISABLE);
1244 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1248 loop_create (test_main_t * tm)
1250 vl_api_create_loopback_t *mp;
1252 mp = vl_msg_api_alloc (sizeof (*mp));
1253 memset (mp, 0, sizeof (*mp));
1255 mp->_vl_msg_id = ntohs (VL_API_CREATE_LOOPBACK);
1256 mp->client_index = tm->my_client_index;
1257 mp->context = 0xdeadbeef;
1258 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1262 ip6_set_link_local_address (test_main_t * tm)
1264 vl_api_sw_interface_ip6_set_link_local_address_t *mp;
1267 mp = vl_msg_api_alloc (sizeof (*mp));
1268 memset (mp, 0, sizeof (*mp));
1270 mp->client_index = tm->my_client_index;
1271 mp->context = 0xdeadbeef;
1272 mp->sw_if_index = ntohl (5);
1274 tmp[0] = clib_host_to_net_u64 (0xfe80000000000000ULL);
1275 tmp[1] = clib_host_to_net_u64 (0x11ULL);
1277 clib_memcpy (mp->address, &tmp[0], 8);
1278 clib_memcpy (&mp->address[8], &tmp[1], 8);
1280 mp->address_length = 64;
1282 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS);
1284 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1289 set_flags (test_main_t * tm, int up_down)
1291 vl_api_sw_interface_set_flags_t *mp;
1293 mp = vl_msg_api_alloc (sizeof (*mp));
1294 memset (mp, 0, sizeof (*mp));
1296 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_FLAGS);
1297 mp->client_index = tm->my_client_index;
1298 mp->context = 0xdeadbeef;
1299 mp->sw_if_index = ntohl (5);
1300 mp->admin_up_down = up_down;
1301 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1306 l2_patch_add_del (test_main_t * tm, int is_add)
1308 vl_api_l2_patch_add_del_t *mp;
1310 mp = vl_msg_api_alloc (sizeof (*mp));
1311 memset (mp, 0, sizeof (*mp));
1312 mp->_vl_msg_id = ntohs (VL_API_L2_PATCH_ADD_DEL);
1313 mp->client_index = tm->my_client_index;
1314 mp->context = 0xdeadbeef;
1315 mp->is_add = is_add;
1316 mp->rx_sw_if_index = ntohl (1);
1317 mp->tx_sw_if_index = ntohl (2);
1319 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1323 l2_xconnect (test_main_t * tm)
1325 vl_api_sw_interface_set_l2_xconnect_t *mp;
1327 mp = vl_msg_api_alloc (sizeof (*mp));
1328 memset (mp, 0, sizeof (*mp));
1329 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_L2_XCONNECT);
1330 mp->client_index = tm->my_client_index;
1331 mp->context = 0xdeadbeef;
1332 mp->rx_sw_if_index = ntohl (5);
1333 mp->tx_sw_if_index = ntohl (6);
1336 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1340 l2_bridge (test_main_t * tm)
1342 vl_api_sw_interface_set_l2_bridge_t *mp;
1344 mp = vl_msg_api_alloc (sizeof (*mp));
1345 memset (mp, 0, sizeof (*mp));
1346 mp->_vl_msg_id = ntohs (VL_API_SW_INTERFACE_SET_L2_BRIDGE);
1347 mp->client_index = tm->my_client_index;
1348 mp->context = 0xdeadbeef;
1349 mp->rx_sw_if_index = ntohl (5);
1350 mp->bd_id = ntohl (6);
1351 mp->bvi = ntohl (1);
1352 mp->shg = ntohl (0);
1355 vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp);
1359 main (int argc, char **argv)
1361 api_main_t *am = &api_main;
1362 test_main_t *tm = &test_main;
1365 connect_to_vpe ("test_client");
1367 tm->vl_input_queue = shmem_hdr->vl_input_queue;
1368 tm->my_client_index = am->my_client_index;
1370 fformat (stdout, "Type 'h' for help, 'q' to quit...\n");
1383 link_up_down_enable_disable (tm, 1 /* enable_disable */ );
1386 link_up_down_enable_disable (tm, 0 /* enable_disable */ );
1389 stats_enable_disable (tm, 1 /* enable_disable */ );
1392 stats_enable_disable (tm, 0 /* enable_disable */ );
1395 add_del_ip4_route (tm, 0 /* add */ );
1398 add_del_ip4_route (tm, 1 /* add */ );
1401 add_del_ip6_route (tm, 0 /* add */ );
1404 add_del_ip6_route (tm, 1 /* add */ );
1407 add_del_interface_address (tm, 1 /* add */ );
1410 add_del_interface_address (tm, 0 /* add */ );
1413 add_del_v6_interface_address (tm, 1 /* add */ );
1416 add_del_v6_interface_address (tm, 0 /* add */ );
1419 l2_patch_add_del (tm, 1 /* is_add */ );
1422 l2_patch_add_del (tm, 0 /* is_add */ );
1425 del_all_interface_addresses (tm);
1428 set_interface_table (tm, 0 /* is_ipv6 */ ,
1429 11 /* my amp goes to 11 */ );
1432 set_interface_table (tm, 1 /* is_ipv6 */ ,
1433 12 /* my amp goes to 12 */ );
1437 create_vlan_subif (tm, 123);
1441 connect_unix_tap (tm, "foo");
1445 create_mpls_gre_tunnel (tm, 11 /* fib */ , 123 /* label */ ,
1450 create_mpls_gre_tunnel (tm, 11 /* fib */ , 123 /* label */ ,
1455 add_ip4_neighbor (tm, 1 /* is_add */ );
1456 add_ip6_neighbor (tm, 1 /* is_add */ );
1460 add_ip4_neighbor (tm, 0 /* is_add */ );
1461 add_ip6_neighbor (tm, 0 /* is_add */ );
1465 add_del_proxy_arp (tm, 1 /* add */ );
1469 proxy_arp_intfc_enable_disable (tm, 1 /* enable */ );
1473 oam_events_enable_disable (tm, 0 /* enable */ );
1477 oam_events_enable_disable (tm, 1 /* enable */ );
1481 oam_add_del (tm, 0 /* is_add */ );
1485 oam_add_del (tm, 1 /* is_add */ );
1489 reset_fib (tm, 0 /* is_ip6 */ );
1493 reset_fib (tm, 1 /* is_ip6 */ );
1501 dhcp_set_proxy (tm, 0);
1505 dhcp_set_proxy (tm, 1 /*ipv6 */ );
1509 set_ip_flow_hash (tm, 0 /* is_ip6 */ );
1513 ip6_set_link_local_address (tm);
1517 ip6_enable_disable (tm, 1 /* enable */ );
1521 ip6_enable_disable (tm, 0 /* disable */ );
1525 ip6nd_ra_config (tm, 0 /* is_no */ );
1528 ip6nd_ra_config (tm, 1 /* is_no */ );
1531 ip6nd_ra_prefix (tm, 0 /* is_no */ );
1534 ip6nd_ra_prefix (tm, 1 /* is_no */ );
1542 set_flags (tm, 1 /* up_down */ );
1546 set_flags (tm, 0 /* up_down */ );
1558 fformat (stdout, "q=quit,d=dump,L=link evts on,l=link evts off\n");
1559 fformat (stdout, "S=stats on,s=stats off\n");
1560 fformat (stdout, "4=add v4 route, 3=del v4 route\n");
1561 fformat (stdout, "6=add v6 route, 5=del v6 route\n");
1562 fformat (stdout, "A=add v4 intfc route, a=del v4 intfc route\n");
1563 fformat (stdout, "B=add v6 intfc route, b=del v6 intfc route\n");
1564 fformat (stdout, "z=del all intfc routes\n");
1565 fformat (stdout, "t=set v4 intfc table, T=set v6 intfc table\n");
1566 fformat (stdout, "c=connect unix tap\n");
1568 "j=set dhcpv4 and v6 link-address/option-82 params\n");
1569 fformat (stdout, "k=set dhcpv4 relay agent params\n");
1570 fformat (stdout, "K=set dhcpv6 relay agent params\n");
1571 fformat (stdout, "E=add l2 patch, e=del l2 patch\n");
1572 fformat (stdout, "V=ip6 set link-local address \n");
1573 fformat (stdout, "w=ip6 enable \n");
1574 fformat (stdout, "W=ip6 disable \n");
1575 fformat (stdout, "x=ip6 nd config \n");
1576 fformat (stdout, "X=no ip6 nd config\n");
1577 fformat (stdout, "y=ip6 nd prefix \n");
1578 fformat (stdout, "Y=no ip6 nd prefix\n");
1579 fformat (stdout, "@=l2 xconnect\n");
1580 fformat (stdout, "#=l2 bridge\n");
1590 if (tm->link_events_on)
1591 link_up_down_enable_disable (tm, 0 /* enable */ );
1593 stats_enable_disable (tm, 0 /* enable */ );
1594 if (tm->oam_events_on)
1595 oam_events_enable_disable (tm, 0 /* enable */ );
1597 disconnect_from_vpe ();
1601 #undef vl_api_version
1602 #define vl_api_version(n,v) static u32 vpe_api_version = v;
1603 #include <vpp-api/vpe.api.h>
1604 #undef vl_api_version
1607 vl_client_add_api_signatures (vl_api_memclnt_create_t * mp)
1610 * Send the main API signature in slot 0. This bit of code must
1611 * match the checks in ../vpe/api/api.c: vl_msg_api_version_check().
1613 mp->api_versions[0] = clib_host_to_net_u32 (vpe_api_version);
1617 * fd.io coding-style-patch-verification: ON
1620 * eval: (c-set-style "gnu")