2 *------------------------------------------------------------------
3 * custom_dump.c - pretty-print API messages for replay
5 * Copyright (c) 2014-2016 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 *------------------------------------------------------------------
20 #include <vnet/vnet.h>
21 #include <vnet/ip/ip.h>
22 #include <vnet/unix/tuntap.h>
23 #include <vnet/mpls/mpls.h>
24 #include <vnet/dhcp/dhcp_proxy.h>
25 #include <vnet/l2tp/l2tp.h>
26 #include <vnet/l2/l2_input.h>
27 #include <vnet/srv6/sr.h>
28 #include <vnet/vxlan-gpe/vxlan_gpe.h>
29 #include <vnet/classify/policer_classify.h>
30 #include <vnet/policer/xlate.h>
31 #include <vnet/policer/policer.h>
32 #include <vnet/classify/flow_classify.h>
33 #include <vlib/vlib.h>
34 #include <vlib/unix/unix.h>
35 #include <vlibapi/api.h>
36 #include <vlibmemory/api.h>
37 #include <vnet/lisp-cp/lisp_types.h>
39 #include <vpp/stats/stats.h>
40 #include <vpp/oam/oam.h>
42 #include <vnet/ethernet/ethernet.h>
43 #include <vnet/l2/l2_vtr.h>
45 #include <vpp/api/vpe_msg_enum.h>
47 #define vl_typedefs /* define message structures */
48 #include <vpp/api/vpe_all_api_h.h>
51 #define vl_endianfun /* define message structures */
52 #include <vpp/api/vpe_all_api_h.h>
55 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
59 vl_print (handle, (char *)s); \
64 static void *vl_api_create_loopback_t_print
65 (vl_api_create_loopback_t * mp, void *handle)
69 s = format (0, "SCRIPT: create_loopback ");
70 s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
75 static void *vl_api_create_loopback_instance_t_print
76 (vl_api_create_loopback_instance_t * mp, void *handle)
80 s = format (0, "SCRIPT: create_loopback ");
81 s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
82 s = format (s, "instance %d ", ntohl (mp->user_instance));
87 static void *vl_api_delete_loopback_t_print
88 (vl_api_delete_loopback_t * mp, void *handle)
92 s = format (0, "SCRIPT: delete_loopback ");
93 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
98 static void *vl_api_sw_interface_set_flags_t_print
99 (vl_api_sw_interface_set_flags_t * mp, void *handle)
102 s = format (0, "SCRIPT: sw_interface_set_flags ");
104 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
106 if (mp->admin_up_down)
107 s = format (s, "admin-up ");
109 s = format (s, "admin-down ");
114 static void *vl_api_sw_interface_event_t_print
115 (vl_api_sw_interface_event_t * mp, void *handle)
118 s = format (0, "SCRIPT: sw_interface_event ");
120 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
122 if (mp->admin_up_down)
123 s = format (s, "admin-up ");
125 s = format (s, "admin-down ");
127 if (mp->link_up_down)
128 s = format (s, "link-up");
130 s = format (s, "link-down");
133 s = format (s, " deleted");
138 static void *vl_api_sw_interface_add_del_address_t_print
139 (vl_api_sw_interface_add_del_address_t * mp, void *handle)
143 s = format (0, "SCRIPT: sw_interface_add_del_address ");
145 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
148 s = format (s, "%U/%d ", format_ip6_address,
149 (ip6_address_t *) mp->address, mp->address_length);
151 s = format (s, "%U/%d ", format_ip4_address,
152 (ip4_address_t *) mp->address, mp->address_length);
155 s = format (s, "del ");
157 s = format (s, "del-all ");
162 static void *vl_api_sw_interface_set_table_t_print
163 (vl_api_sw_interface_set_table_t * mp, void *handle)
167 s = format (0, "SCRIPT: sw_interface_set_table ");
169 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
172 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
175 s = format (s, "ipv6 ");
180 static void *vl_api_sw_interface_set_mpls_enable_t_print
181 (vl_api_sw_interface_set_mpls_enable_t * mp, void *handle)
185 s = format (0, "SCRIPT: sw_interface_set_mpls_enable ");
187 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
190 s = format (s, "disable");
195 static void *vl_api_sw_interface_set_vpath_t_print
196 (vl_api_sw_interface_set_vpath_t * mp, void *handle)
200 s = format (0, "SCRIPT: sw_interface_set_vpath ");
202 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
205 s = format (s, "enable ");
207 s = format (s, "disable ");
212 static void *vl_api_sw_interface_set_vxlan_bypass_t_print
213 (vl_api_sw_interface_set_vxlan_bypass_t * mp, void *handle)
217 s = format (0, "SCRIPT: sw_interface_set_vxlan_bypass ");
219 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
222 s = format (s, "ip6 ");
225 s = format (s, "enable ");
227 s = format (s, "disable ");
232 static void *vl_api_sw_interface_set_l2_xconnect_t_print
233 (vl_api_sw_interface_set_l2_xconnect_t * mp, void *handle)
237 s = format (0, "SCRIPT: sw_interface_set_l2_xconnect ");
239 s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
243 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
246 s = format (s, "delete ");
251 static void *vl_api_sw_interface_set_l2_bridge_t_print
252 (vl_api_sw_interface_set_l2_bridge_t * mp, void *handle)
256 s = format (0, "SCRIPT: sw_interface_set_l2_bridge ");
258 s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
262 s = format (s, "bd_id %d shg %d %senable ", ntohl (mp->bd_id),
263 mp->shg, ((mp->bvi) ? "bvi " : " "));
266 s = format (s, "disable ");
271 static void *vl_api_bridge_domain_add_del_t_print
272 (vl_api_bridge_domain_add_del_t * mp, void *handle)
276 s = format (0, "SCRIPT: bridge_domain_add_del ");
278 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
282 s = format (s, "flood %d uu-flood %d ", mp->flood, mp->uu_flood);
283 s = format (s, "forward %d learn %d ", mp->forward, mp->learn);
284 s = format (s, "arp-term %d mac-age %d", mp->arp_term, mp->mac_age);
287 s = format (s, "del ");
292 static void *vl_api_bridge_domain_set_mac_age_t_print
293 (vl_api_bridge_domain_set_mac_age_t * mp, void *handle)
297 s = format (0, "SCRIPT: bridge_domain_set_mac_age ");
299 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
301 s = format (s, "mac-age %d", mp->mac_age);
306 static void *vl_api_bridge_domain_dump_t_print
307 (vl_api_bridge_domain_dump_t * mp, void *handle)
310 u32 bd_id = ntohl (mp->bd_id);
312 s = format (0, "SCRIPT: bridge_domain_dump ");
315 s = format (s, "bd_id %d ", bd_id);
320 static void *vl_api_l2fib_flush_all_t_print
321 (vl_api_l2fib_flush_all_t * mp, void *handle)
325 s = format (0, "SCRIPT: l2fib_flush_all ");
331 static void *vl_api_l2fib_flush_bd_t_print
332 (vl_api_l2fib_flush_bd_t * mp, void *handle)
335 u32 bd_id = ntohl (mp->bd_id);
337 s = format (0, "SCRIPT: l2fib_flush_bd ");
338 s = format (s, "bd_id %d ", bd_id);
343 static void *vl_api_l2fib_flush_int_t_print
344 (vl_api_l2fib_flush_int_t * mp, void *handle)
347 u32 sw_if_index = ntohl (mp->sw_if_index);
349 s = format (0, "SCRIPT: l2fib_flush_int ");
350 s = format (s, "sw_if_index %d ", sw_if_index);
355 static void *vl_api_l2fib_add_del_t_print
356 (vl_api_l2fib_add_del_t * mp, void *handle)
360 s = format (0, "SCRIPT: l2fib_add_del ");
362 s = format (s, "mac %U ", format_ethernet_address, &mp->mac);
364 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
369 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
371 s = format (s, "%s", "static ");
373 s = format (s, "%s", "filter ");
375 s = format (s, "%s", "bvi ");
379 s = format (s, "del ");
386 vl_api_l2_flags_t_print (vl_api_l2_flags_t * mp, void *handle)
389 u32 flags = ntohl (mp->feature_bitmap);
391 s = format (0, "SCRIPT: l2_flags ");
393 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
395 if (flags & L2_LEARN)
396 s = format (s, "learn ");
398 s = format (s, "forward ");
399 if (flags & L2_FLOOD)
400 s = format (s, "flood ");
401 if (flags & L2_UU_FLOOD)
402 s = format (s, "uu-flood ");
403 if (flags & L2_ARP_TERM)
404 s = format (s, "arp-term ");
407 s = format (s, "clear ");
412 static void *vl_api_bridge_flags_t_print
413 (vl_api_bridge_flags_t * mp, void *handle)
416 u32 flags = ntohl (mp->feature_bitmap);
418 s = format (0, "SCRIPT: bridge_flags ");
420 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
422 if (flags & L2_LEARN)
423 s = format (s, "learn ");
425 s = format (s, "forward ");
426 if (flags & L2_FLOOD)
427 s = format (s, "flood ");
428 if (flags & L2_UU_FLOOD)
429 s = format (s, "uu-flood ");
430 if (flags & L2_ARP_TERM)
431 s = format (s, "arp-term ");
434 s = format (s, "clear ");
439 static void *vl_api_bd_ip_mac_add_del_t_print
440 (vl_api_bd_ip_mac_add_del_t * mp, void *handle)
444 s = format (0, "SCRIPT: bd_ip_mac_add_del ");
445 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
448 s = format (s, "%U ", format_ip6_address,
449 (ip6_address_t *) mp->ip_address);
451 s = format (s, "%U ", format_ip4_address,
452 (ip4_address_t *) mp->ip_address);
454 s = format (s, "%U ", format_ethernet_address, mp->mac_address);
456 s = format (s, "del ");
461 static void *vl_api_tap_connect_t_print
462 (vl_api_tap_connect_t * mp, void *handle)
467 memset (null_mac, 0, sizeof (null_mac));
469 s = format (0, "SCRIPT: tap_connect ");
470 s = format (s, "tapname %s ", mp->tap_name);
471 if (mp->use_random_mac)
472 s = format (s, "random-mac ");
474 s = format (s, "tag %s ", mp->tag);
475 if (memcmp (mp->mac_address, null_mac, 6))
476 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
477 if (mp->ip4_address_set)
478 s = format (s, "address %U/%d ", format_ip4_address, mp->ip4_address,
480 if (mp->ip6_address_set)
481 s = format (s, "address %U/%d ", format_ip6_address, mp->ip6_address,
486 static void *vl_api_tap_modify_t_print
487 (vl_api_tap_modify_t * mp, void *handle)
492 memset (null_mac, 0, sizeof (null_mac));
494 s = format (0, "SCRIPT: tap_modify ");
495 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
496 s = format (s, "tapname %s ", mp->tap_name);
497 if (mp->use_random_mac)
498 s = format (s, "random-mac ");
500 if (memcmp (mp->mac_address, null_mac, 6))
501 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
506 static void *vl_api_tap_delete_t_print
507 (vl_api_tap_delete_t * mp, void *handle)
511 s = format (0, "SCRIPT: tap_delete ");
512 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
517 static void *vl_api_sw_interface_tap_dump_t_print
518 (vl_api_sw_interface_tap_dump_t * mp, void *handle)
522 s = format (0, "SCRIPT: sw_interface_tap_dump ");
528 static void *vl_api_ip_add_del_route_t_print
529 (vl_api_ip_add_del_route_t * mp, void *handle)
533 s = format (0, "SCRIPT: ip_add_del_route ");
535 s = format (s, "del ");
537 if (mp->next_hop_sw_if_index)
538 s = format (s, "sw_if_index %d ", ntohl (mp->next_hop_sw_if_index));
541 s = format (s, "%U/%d ", format_ip6_address, mp->dst_address,
542 mp->dst_address_length);
544 s = format (s, "%U/%d ", format_ip4_address, mp->dst_address,
545 mp->dst_address_length);
547 s = format (s, "local ");
548 else if (mp->is_drop)
549 s = format (s, "drop ");
550 else if (mp->is_classify)
551 s = format (s, "classify %d", ntohl (mp->classify_table_index));
555 s = format (s, "via %U ", format_ip6_address, mp->next_hop_address);
557 s = format (s, "via %U ", format_ip4_address, mp->next_hop_address);
560 if (mp->table_id != 0)
561 s = format (s, "vrf %d ", ntohl (mp->table_id));
563 if (mp->create_vrf_if_needed)
564 s = format (s, "create-vrf ");
566 if (mp->next_hop_weight != 1)
567 s = format (s, "weight %d ", mp->next_hop_weight);
570 s = format (s, "not-last ");
572 if (mp->is_multipath)
573 s = format (s, "multipath ");
575 if (mp->is_multipath)
576 s = format (s, "multipath ");
578 if (mp->next_hop_table_id)
579 s = format (s, "lookup-in-vrf %d ", ntohl (mp->next_hop_table_id));
584 static void *vl_api_proxy_arp_add_del_t_print
585 (vl_api_proxy_arp_add_del_t * mp, void *handle)
589 s = format (0, "SCRIPT: proxy_arp_add_del ");
591 s = format (s, "%U - %U ", format_ip4_address, mp->low_address,
592 format_ip4_address, mp->hi_address);
595 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
598 s = format (s, "del ");
603 static void *vl_api_proxy_arp_intfc_enable_disable_t_print
604 (vl_api_proxy_arp_intfc_enable_disable_t * mp, void *handle)
608 s = format (0, "SCRIPT: proxy_arp_intfc_enable_disable ");
610 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
612 s = format (s, "enable %d ", mp->enable_disable);
617 static void *vl_api_mpls_tunnel_add_del_t_print
618 (vl_api_mpls_tunnel_add_del_t * mp, void *handle)
622 s = format (0, "SCRIPT: mpls_tunnel_add_del ");
624 if (mp->mt_next_hop_sw_if_index)
625 s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index));
627 if (mp->mt_next_hop_proto_is_ip4)
628 s = format (s, "%U ", format_ip4_address, mp->mt_next_hop);
630 s = format (s, "%U ", format_ip6_address, mp->mt_next_hop);
633 s = format (s, "l2-only ");
635 if (mp->mt_is_add == 0)
636 s = format (s, "del ");
641 static void *vl_api_sw_interface_set_unnumbered_t_print
642 (vl_api_sw_interface_set_unnumbered_t * mp, void *handle)
646 s = format (0, "SCRIPT: sw_interface_set_unnumbered ");
648 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
650 s = format (s, "unnum_if_index %d ", ntohl (mp->unnumbered_sw_if_index));
653 s = format (s, "del ");
658 static void *vl_api_ip_neighbor_add_del_t_print
659 (vl_api_ip_neighbor_add_del_t * mp, void *handle)
664 memset (null_mac, 0, sizeof (null_mac));
666 s = format (0, "SCRIPT: ip_neighbor_add_del ");
668 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
671 s = format (s, "is_static ");
673 if (mp->is_no_adj_fib)
674 s = format (s, "is_no_fib_entry ");
676 if (memcmp (mp->mac_address, null_mac, 6))
677 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
681 format (s, "dst %U ", format_ip6_address,
682 (ip6_address_t *) mp->dst_address);
685 format (s, "dst %U ", format_ip4_address,
686 (ip4_address_t *) mp->dst_address);
689 s = format (s, "del ");
695 vl_api_reset_vrf_t_print (vl_api_reset_vrf_t * mp, void *handle)
699 s = format (0, "SCRIPT: reset_vrf ");
702 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
704 if (mp->is_ipv6 != 0)
705 s = format (s, "ipv6 ");
710 static void *vl_api_create_vlan_subif_t_print
711 (vl_api_create_vlan_subif_t * mp, void *handle)
715 s = format (0, "SCRIPT: create_vlan_subif ");
718 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
721 s = format (s, "vlan_id %d ", ntohl (mp->vlan_id));
726 #define foreach_create_subif_bit \
733 _(outer_vlan_id_any) \
736 static void *vl_api_create_subif_t_print
737 (vl_api_create_subif_t * mp, void *handle)
741 s = format (0, "SCRIPT: create_subif ");
743 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
745 s = format (s, "sub_id %d ", ntohl (mp->sub_id));
747 if (mp->outer_vlan_id)
748 s = format (s, "outer_vlan_id %d ", ntohs (mp->outer_vlan_id));
750 if (mp->inner_vlan_id)
751 s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
753 #define _(a) if (mp->a) s = format (s, "%s ", #a);
754 foreach_create_subif_bit;
760 static void *vl_api_delete_subif_t_print
761 (vl_api_delete_subif_t * mp, void *handle)
765 s = format (0, "SCRIPT: delete_subif ");
766 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
771 static void *vl_api_oam_add_del_t_print
772 (vl_api_oam_add_del_t * mp, void *handle)
776 s = format (0, "SCRIPT: oam_add_del ");
779 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
781 s = format (s, "src %U ", format_ip4_address, mp->src_address);
783 s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
786 s = format (s, "del ");
792 vl_api_reset_fib_t_print (vl_api_reset_fib_t * mp, void *handle)
796 s = format (0, "SCRIPT: reset_fib ");
799 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
801 if (mp->is_ipv6 != 0)
802 s = format (s, "ipv6 ");
807 static void *vl_api_dhcp_proxy_config_t_print
808 (vl_api_dhcp_proxy_config_t * mp, void *handle)
812 s = format (0, "SCRIPT: dhcp_proxy_config_2 ");
814 s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id));
815 s = format (s, "server_vrf_id %d ", ntohl (mp->server_vrf_id));
819 s = format (s, "svr %U ", format_ip6_address,
820 (ip6_address_t *) mp->dhcp_server);
821 s = format (s, "src %U ", format_ip6_address,
822 (ip6_address_t *) mp->dhcp_src_address);
826 s = format (s, "svr %U ", format_ip4_address,
827 (ip4_address_t *) mp->dhcp_server);
828 s = format (s, "src %U ", format_ip4_address,
829 (ip4_address_t *) mp->dhcp_src_address);
832 s = format (s, "del ");
837 static void *vl_api_dhcp_proxy_set_vss_t_print
838 (vl_api_dhcp_proxy_set_vss_t * mp, void *handle)
842 s = format (0, "SCRIPT: dhcp_proxy_set_vss ");
844 s = format (s, "tbl_id %d ", ntohl (mp->tbl_id));
846 s = format (s, "fib_id %d ", ntohl (mp->fib_id));
848 s = format (s, "oui %d ", ntohl (mp->oui));
850 if (mp->is_ipv6 != 0)
851 s = format (s, "ipv6 ");
854 s = format (s, "del ");
859 static void *vl_api_dhcp_client_config_t_print
860 (vl_api_dhcp_client_config_t * mp, void *handle)
864 s = format (0, "SCRIPT: dhcp_client_config ");
866 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
868 s = format (s, "hostname %s ", mp->hostname);
870 s = format (s, "want_dhcp_event %d ", mp->want_dhcp_event);
872 s = format (s, "pid %d ", ntohl (mp->pid));
875 s = format (s, "del ");
881 static void *vl_api_set_ip_flow_hash_t_print
882 (vl_api_set_ip_flow_hash_t * mp, void *handle)
886 s = format (0, "SCRIPT: set_ip_flow_hash ");
888 s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
891 s = format (s, "src ");
894 s = format (s, "dst ");
897 s = format (s, "sport ");
900 s = format (s, "dport ");
903 s = format (s, "proto ");
906 s = format (s, "reverse ");
908 if (mp->is_ipv6 != 0)
909 s = format (s, "ipv6 ");
914 static void *vl_api_sw_interface_ip6_set_link_local_address_t_print
915 (vl_api_sw_interface_ip6_set_link_local_address_t * mp, void *handle)
919 s = format (0, "SCRIPT: sw_interface_ip6_set_link_local_address ");
921 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
923 s = format (s, "%U ", format_ip6_address, mp->address);
928 static void *vl_api_sw_interface_ip6nd_ra_prefix_t_print
929 (vl_api_sw_interface_ip6nd_ra_prefix_t * mp, void *handle)
933 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_prefix ");
935 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
937 s = format (s, "%U/%d ", format_ip6_address, mp->address,
940 s = format (s, "val_life %d ", ntohl (mp->val_lifetime));
942 s = format (s, "pref_life %d ", ntohl (mp->pref_lifetime));
945 s = format (s, "def ");
947 if (mp->no_advertise)
948 s = format (s, "noadv ");
951 s = format (s, "offl ");
953 if (mp->no_autoconfig)
954 s = format (s, "noauto ");
957 s = format (s, "nolink ");
960 s = format (s, "isno ");
965 static void *vl_api_sw_interface_ip6nd_ra_config_t_print
966 (vl_api_sw_interface_ip6nd_ra_config_t * mp, void *handle)
970 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_config ");
972 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
974 s = format (s, "maxint %d ", ntohl (mp->max_interval));
976 s = format (s, "minint %d ", ntohl (mp->min_interval));
978 s = format (s, "life %d ", ntohl (mp->lifetime));
980 s = format (s, "count %d ", ntohl (mp->initial_count));
982 s = format (s, "interval %d ", ntohl (mp->initial_interval));
985 s = format (s, "suppress ");
988 s = format (s, "managed ");
991 s = format (s, "other ");
994 s = format (s, "ll ");
996 if (mp->send_unicast)
997 s = format (s, "send ");
1000 s = format (s, "cease ");
1003 s = format (s, "isno ");
1005 if (mp->default_router)
1006 s = format (s, "def ");
1011 static void *vl_api_set_arp_neighbor_limit_t_print
1012 (vl_api_set_arp_neighbor_limit_t * mp, void *handle)
1016 s = format (0, "SCRIPT: set_arp_neighbor_limit ");
1018 s = format (s, "arp_nbr_limit %d ", ntohl (mp->arp_neighbor_limit));
1020 if (mp->is_ipv6 != 0)
1021 s = format (s, "ipv6 ");
1026 static void *vl_api_l2_patch_add_del_t_print
1027 (vl_api_l2_patch_add_del_t * mp, void *handle)
1031 s = format (0, "SCRIPT: l2_patch_add_del ");
1033 s = format (s, "rx_sw_if_index %d ", ntohl (mp->rx_sw_if_index));
1035 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
1037 if (mp->is_add == 0)
1038 s = format (s, "del ");
1043 static void *vl_api_sr_localsid_add_del_t_print
1044 (vl_api_sr_localsid_add_del_t * mp, void *handle)
1046 vnet_main_t *vnm = vnet_get_main ();
1049 s = format (0, "SCRIPT: sr_localsid_add_del ");
1051 switch (mp->behavior)
1053 case SR_BEHAVIOR_END:
1054 s = format (s, "Address: %U\nBehavior: End",
1055 format_ip6_address, (ip6_address_t *) mp->localsid_addr);
1056 s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1061 "Address: %U\nBehavior: X (Endpoint with Layer-3 cross-connect)"
1062 "\nIface: %U\nNext hop: %U", format_ip6_address,
1063 (ip6_address_t *) mp->localsid_addr,
1064 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1065 format_ip6_address, (ip6_address_t *) mp->nh_addr);
1066 s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1068 case SR_BEHAVIOR_DX4:
1071 "Address: %U\nBehavior: DX4 (Endpoint with decapsulation with IPv4 cross-connect)"
1072 "\nIface: %U\nNext hop: %U", format_ip6_address,
1073 (ip6_address_t *) mp->localsid_addr,
1074 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1075 format_ip4_address, (ip4_address_t *) mp->nh_addr);
1077 case SR_BEHAVIOR_DX6:
1080 "Address: %U\nBehavior: DX6 (Endpoint with decapsulation with IPv6 cross-connect)"
1081 "\nIface: %UNext hop: %U", format_ip6_address,
1082 (ip6_address_t *) mp->localsid_addr,
1083 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1084 format_ip6_address, (ip6_address_t *) mp->nh_addr);
1086 case SR_BEHAVIOR_DX2:
1089 "Address: %U\nBehavior: DX2 (Endpoint with decapulation and Layer-2 cross-connect)"
1090 "\nIface: %U", format_ip6_address,
1091 (ip6_address_t *) mp->localsid_addr,
1092 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index));
1094 case SR_BEHAVIOR_DT6:
1097 "Address: %U\nBehavior: DT6 (Endpoint with decapsulation and specific IPv6 table lookup)"
1098 "\nTable: %u", format_ip6_address,
1099 (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table));
1101 case SR_BEHAVIOR_DT4:
1104 "Address: %U\nBehavior: DT4 (Endpoint with decapsulation and specific IPv4 table lookup)"
1105 "\nTable: %u", format_ip6_address,
1106 (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table));
1109 if (mp->behavior >= SR_BEHAVIOR_LAST)
1111 s = format (s, "Address: %U\n Behavior: %u",
1112 format_ip6_address, (ip6_address_t *) mp->localsid_addr,
1116 //Should never get here...
1117 s = format (s, "Internal error");
1123 static void *vl_api_sr_steering_add_del_t_print
1124 (vl_api_sr_steering_add_del_t * mp, void *handle)
1128 s = format (0, "SCRIPT: sr_steering_add_del ");
1130 s = format (s, (mp->is_del ? "Del: True" : "Del: False"));
1132 switch (mp->traffic_type)
1135 s = format (s, "Traffic type: L2 iface: %u", ntohl (mp->sw_if_index));
1138 s = format (s, "Traffic type: IPv4 %U/%u", format_ip4_address,
1139 (ip4_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1142 s = format (s, "Traffic type: IPv6 %U/%u", format_ip6_address,
1143 (ip6_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1146 s = format (s, "Traffic type: Unknown(%u)", mp->traffic_type);
1149 s = format (s, "BindingSID: %U", format_ip6_address,
1150 (ip6_address_t *) mp->bsid_addr);
1152 s = format (s, "SR Policy Index: %u", ntohl (mp->sr_policy_index));
1154 s = format (s, "FIB_table: %u", ntohl (mp->table_id));
1159 static void *vl_api_sr_policy_add_t_print
1160 (vl_api_sr_policy_add_t * mp, void *handle)
1164 ip6_address_t *segments = 0, *seg;
1165 ip6_address_t *this_address = (ip6_address_t *) mp->segments;
1168 for (i = 0; i < mp->n_segments; i++)
1170 vec_add2 (segments, seg, 1);
1171 clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1175 s = format (0, "SCRIPT: sr_policy_add ");
1177 s = format (s, "BSID: %U", format_ip6_address,
1178 (ip6_address_t *) mp->bsid_addr);
1182 (mp->is_encap ? "Behavior: Encapsulation" :
1183 "Behavior: SRH insertion"));
1185 s = format (s, "FIB_table: %u", ntohl (mp->fib_table));
1187 s = format (s, (mp->type ? "Type: Default" : "Type: Spray"));
1189 s = format (s, "SID list weight: %u", ntohl (mp->weight));
1191 s = format (s, "{");
1192 vec_foreach (seg, segments)
1194 s = format (s, "%U, ", format_ip6_address, seg);
1196 s = format (s, "\b\b } ");
1201 static void *vl_api_sr_policy_mod_t_print
1202 (vl_api_sr_policy_mod_t * mp, void *handle)
1206 ip6_address_t *segments = 0, *seg;
1207 ip6_address_t *this_address = (ip6_address_t *) mp->segments;
1210 for (i = 0; i < mp->n_segments; i++)
1212 vec_add2 (segments, seg, 1);
1213 clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1217 s = format (0, "SCRIPT: sr_policy_mod ");
1219 s = format (s, "BSID: %U", format_ip6_address,
1220 (ip6_address_t *) mp->bsid_addr);
1222 s = format (s, "SR Policy index: %u", ntohl (mp->sr_policy_index));
1224 s = format (s, "Operation: %u", mp->operation);
1226 s = format (s, "SID list index: %u", ntohl (mp->sl_index));
1228 s = format (s, "SID list weight: %u", ntohl (mp->weight));
1230 s = format (s, "{");
1231 vec_foreach (seg, segments)
1233 s = format (s, "%U, ", format_ip6_address, seg);
1235 s = format (s, "\b\b } ");
1240 static void *vl_api_sr_policy_del_t_print
1241 (vl_api_sr_policy_del_t * mp, void *handle)
1245 s = format (0, "SCRIPT: sr_policy_del ");
1246 s = format (s, "To be delivered. Good luck.");
1250 static void *vl_api_classify_add_del_table_t_print
1251 (vl_api_classify_add_del_table_t * mp, void *handle)
1256 s = format (0, "SCRIPT: classify_add_del_table ");
1258 if (mp->is_add == 0)
1260 s = format (s, "table %d ", ntohl (mp->table_index));
1261 s = format (s, "%s ", mp->del_chain ? "del-chain" : "del");
1265 s = format (s, "nbuckets %d ", ntohl (mp->nbuckets));
1266 s = format (s, "memory_size %d ", ntohl (mp->memory_size));
1267 s = format (s, "skip %d ", ntohl (mp->skip_n_vectors));
1268 s = format (s, "match %d ", ntohl (mp->match_n_vectors));
1269 s = format (s, "next-table %d ", ntohl (mp->next_table_index));
1270 s = format (s, "miss-next %d ", ntohl (mp->miss_next_index));
1271 s = format (s, "current-data-flag %d ", ntohl (mp->current_data_flag));
1272 if (mp->current_data_flag)
1273 s = format (s, "current-data-offset %d ",
1274 ntohl (mp->current_data_offset));
1275 s = format (s, "mask hex ");
1276 for (i = 0; i < ntohl (mp->match_n_vectors) * sizeof (u32x4); i++)
1277 s = format (s, "%02x", mp->mask[i]);
1284 static void *vl_api_classify_add_del_session_t_print
1285 (vl_api_classify_add_del_session_t * mp, void *handle)
1290 s = format (0, "SCRIPT: classify_add_del_session ");
1292 s = format (s, "table_index %d ", ntohl (mp->table_index));
1293 s = format (s, "hit_next_index %d ", ntohl (mp->hit_next_index));
1294 s = format (s, "opaque_index %d ", ntohl (mp->opaque_index));
1295 s = format (s, "advance %d ", ntohl (mp->advance));
1296 s = format (s, "action %d ", mp->action);
1298 s = format (s, "metadata %d ", ntohl (mp->metadata));
1299 if (mp->is_add == 0)
1300 s = format (s, "del ");
1302 s = format (s, "match hex ");
1303 for (i = 5 * sizeof (u32x4) - 1; i > 0; i--)
1305 if (mp->match[i] != 0)
1312 for (i = 0; i < limit; i++)
1313 s = format (s, "%02x", mp->match[i]);
1318 static void *vl_api_classify_set_interface_ip_table_t_print
1319 (vl_api_classify_set_interface_ip_table_t * mp, void *handle)
1323 s = format (0, "SCRIPT: classify_set_interface_ip_table ");
1326 s = format (s, "ipv6 ");
1328 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1329 s = format (s, "table %d ", ntohl (mp->table_index));
1334 static void *vl_api_classify_set_interface_l2_tables_t_print
1335 (vl_api_classify_set_interface_l2_tables_t * mp, void *handle)
1339 s = format (0, "SCRIPT: classify_set_interface_l2_tables ");
1341 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1342 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1343 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1344 s = format (s, "other-table %d ", ntohl (mp->other_table_index));
1345 s = format (s, "is-input %d ", mp->is_input);
1350 static void *vl_api_add_node_next_t_print
1351 (vl_api_add_node_next_t * mp, void *handle)
1355 s = format (0, "SCRIPT: add_node_next ");
1357 s = format (0, "node %s next %s ", mp->node_name, mp->next_name);
1362 static void *vl_api_l2tpv3_create_tunnel_t_print
1363 (vl_api_l2tpv3_create_tunnel_t * mp, void *handle)
1367 s = format (0, "SCRIPT: l2tpv3_create_tunnel ");
1369 s = format (s, "client_address %U our_address %U ",
1370 format_ip6_address, (ip6_address_t *) (mp->client_address),
1371 format_ip6_address, (ip6_address_t *) (mp->our_address));
1372 s = format (s, "local_session_id %d ", ntohl (mp->local_session_id));
1373 s = format (s, "remote_session_id %d ", ntohl (mp->remote_session_id));
1374 s = format (s, "local_cookie %lld ",
1375 clib_net_to_host_u64 (mp->local_cookie));
1376 s = format (s, "remote_cookie %lld ",
1377 clib_net_to_host_u64 (mp->remote_cookie));
1378 if (mp->l2_sublayer_present)
1379 s = format (s, "l2-sublayer-present ");
1384 static void *vl_api_l2tpv3_set_tunnel_cookies_t_print
1385 (vl_api_l2tpv3_set_tunnel_cookies_t * mp, void *handle)
1389 s = format (0, "SCRIPT: l2tpv3_set_tunnel_cookies ");
1391 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1393 s = format (s, "new_local_cookie %llu ",
1394 clib_net_to_host_u64 (mp->new_local_cookie));
1396 s = format (s, "new_remote_cookie %llu ",
1397 clib_net_to_host_u64 (mp->new_remote_cookie));
1402 static void *vl_api_l2tpv3_interface_enable_disable_t_print
1403 (vl_api_l2tpv3_interface_enable_disable_t * mp, void *handle)
1407 s = format (0, "SCRIPT: l2tpv3_interface_enable_disable ");
1409 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1411 if (mp->enable_disable == 0)
1412 s = format (s, "del ");
1417 static void *vl_api_l2tpv3_set_lookup_key_t_print
1418 (vl_api_l2tpv3_set_lookup_key_t * mp, void *handle)
1421 char *str = "unknown";
1423 s = format (0, "SCRIPT: l2tpv3_set_lookup_key ");
1427 case L2T_LOOKUP_SRC_ADDRESS:
1428 str = "lookup_v6_src";
1430 case L2T_LOOKUP_DST_ADDRESS:
1431 str = "lookup_v6_dst";
1433 case L2T_LOOKUP_SESSION_ID:
1434 str = "lookup_session_id";
1440 s = format (s, "%s ", str);
1445 static void *vl_api_sw_if_l2tpv3_tunnel_dump_t_print
1446 (vl_api_sw_if_l2tpv3_tunnel_dump_t * mp, void *handle)
1450 s = format (0, "SCRIPT: sw_if_l2tpv3_tunnel_dump ");
1455 static void *vl_api_vxlan_add_del_tunnel_t_print
1456 (vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
1459 s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
1461 ip46_address_t src = to_ip46 (mp->is_ipv6, mp->src_address);
1462 ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->dst_address);
1464 u8 is_grp = ip46_address_is_multicast (&dst);
1465 char *dst_name = is_grp ? "group" : "dst";
1467 s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY);
1468 s = format (s, "%s %U ", dst_name, format_ip46_address,
1469 &dst, IP46_TYPE_ANY);
1472 s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1474 if (mp->encap_vrf_id)
1475 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1477 s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1479 s = format (s, "vni %d ", ntohl (mp->vni));
1481 if (mp->is_add == 0)
1482 s = format (s, "del ");
1487 static void *vl_api_vxlan_tunnel_dump_t_print
1488 (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1492 s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1494 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1499 static void *vl_api_gre_add_del_tunnel_t_print
1500 (vl_api_gre_add_del_tunnel_t * mp, void *handle)
1504 s = format (0, "SCRIPT: gre_add_del_tunnel ");
1506 s = format (s, "dst %U ", format_ip46_address,
1507 (ip46_address_t *) & (mp->dst_address),
1508 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1510 s = format (s, "src %U ", format_ip46_address,
1511 (ip46_address_t *) & (mp->src_address),
1512 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1515 s = format (s, "teb ");
1517 if (mp->outer_fib_id)
1518 s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
1520 if (mp->is_add == 0)
1521 s = format (s, "del ");
1526 static void *vl_api_gre_tunnel_dump_t_print
1527 (vl_api_gre_tunnel_dump_t * mp, void *handle)
1531 s = format (0, "SCRIPT: gre_tunnel_dump ");
1533 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1538 static void *vl_api_l2_fib_clear_table_t_print
1539 (vl_api_l2_fib_clear_table_t * mp, void *handle)
1543 s = format (0, "SCRIPT: l2_fib_clear_table ");
1548 static void *vl_api_l2_interface_efp_filter_t_print
1549 (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1553 s = format (0, "SCRIPT: l2_interface_efp_filter ");
1555 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1556 if (mp->enable_disable)
1557 s = format (s, "enable ");
1559 s = format (s, "disable ");
1564 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1565 (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1569 s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1571 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1572 s = format (s, "vtr_op %d ", ntohl (mp->vtr_op));
1573 s = format (s, "push_dot1q %d ", ntohl (mp->push_dot1q));
1574 s = format (s, "tag1 %d ", ntohl (mp->tag1));
1575 s = format (s, "tag2 %d ", ntohl (mp->tag2));
1580 static void *vl_api_create_vhost_user_if_t_print
1581 (vl_api_create_vhost_user_if_t * mp, void *handle)
1585 s = format (0, "SCRIPT: create_vhost_user_if ");
1587 s = format (s, "socket %s ", mp->sock_filename);
1589 s = format (s, "server ");
1591 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1593 s = format (s, "tag %s", mp->tag);
1598 static void *vl_api_modify_vhost_user_if_t_print
1599 (vl_api_modify_vhost_user_if_t * mp, void *handle)
1603 s = format (0, "SCRIPT: modify_vhost_user_if ");
1605 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1606 s = format (s, "socket %s ", mp->sock_filename);
1608 s = format (s, "server ");
1610 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1615 static void *vl_api_delete_vhost_user_if_t_print
1616 (vl_api_delete_vhost_user_if_t * mp, void *handle)
1620 s = format (0, "SCRIPT: delete_vhost_user_if ");
1621 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1626 static void *vl_api_sw_interface_vhost_user_dump_t_print
1627 (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
1631 s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
1636 static void *vl_api_sw_interface_dump_t_print
1637 (vl_api_sw_interface_dump_t * mp, void *handle)
1641 s = format (0, "SCRIPT: sw_interface_dump ");
1643 if (mp->name_filter_valid)
1644 s = format (s, "name_filter %s ", mp->name_filter);
1646 s = format (s, "all ");
1651 static void *vl_api_l2_fib_table_dump_t_print
1652 (vl_api_l2_fib_table_dump_t * mp, void *handle)
1656 s = format (0, "SCRIPT: l2_fib_table_dump ");
1658 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
1663 static void *vl_api_control_ping_t_print
1664 (vl_api_control_ping_t * mp, void *handle)
1668 s = format (0, "SCRIPT: control_ping ");
1673 static void *vl_api_want_interface_events_t_print
1674 (vl_api_want_interface_events_t * mp, void *handle)
1678 s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
1679 ntohl (mp->pid), ntohl (mp->enable_disable));
1685 vl_api_cli_t_print (vl_api_cli_t * mp, void *handle)
1689 s = format (0, "SCRIPT: cli ");
1694 static void *vl_api_cli_inband_t_print
1695 (vl_api_cli_inband_t * mp, void *handle)
1699 s = format (0, "SCRIPT: cli_inband ");
1704 static void *vl_api_memclnt_create_t_print
1705 (vl_api_memclnt_create_t * mp, void *handle)
1709 s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
1714 static void *vl_api_show_version_t_print
1715 (vl_api_show_version_t * mp, void *handle)
1719 s = format (0, "SCRIPT: show_version ");
1724 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
1725 (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
1729 s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
1731 ip46_address_t local = to_ip46 (mp->is_ipv6, mp->local);
1732 ip46_address_t remote = to_ip46 (mp->is_ipv6, mp->remote);
1734 u8 is_grp = ip46_address_is_multicast (&remote);
1735 char *remote_name = is_grp ? "group" : "remote";
1737 s = format (s, "local %U ", format_ip46_address, &local, IP46_TYPE_ANY);
1738 s = format (s, "%s %U ", remote_name, format_ip46_address,
1739 &remote, IP46_TYPE_ANY);
1742 s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1743 s = format (s, "protocol %d ", ntohl (mp->protocol));
1745 s = format (s, "vni %d ", ntohl (mp->vni));
1747 if (mp->is_add == 0)
1748 s = format (s, "del ");
1750 if (mp->encap_vrf_id)
1751 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1753 if (mp->decap_vrf_id)
1754 s = format (s, "decap-vrf-id %d ", ntohl (mp->decap_vrf_id));
1759 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
1760 (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
1764 s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
1766 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1771 static void *vl_api_interface_name_renumber_t_print
1772 (vl_api_interface_name_renumber_t * mp, void *handle)
1776 s = format (0, "SCRIPT: interface_renumber ");
1778 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1780 s = format (s, "new_show_dev_instance %d ",
1781 ntohl (mp->new_show_dev_instance));
1786 static void *vl_api_want_ip4_arp_events_t_print
1787 (vl_api_want_ip4_arp_events_t * mp, void *handle)
1791 s = format (0, "SCRIPT: want_ip4_arp_events ");
1792 s = format (s, "pid %d address %U ", ntohl (mp->pid),
1793 format_ip4_address, &mp->address);
1794 if (mp->enable_disable == 0)
1795 s = format (s, "del ");
1800 static void *vl_api_want_ip6_nd_events_t_print
1801 (vl_api_want_ip6_nd_events_t * mp, void *handle)
1805 s = format (0, "SCRIPT: want_ip6_nd_events ");
1806 s = format (s, "pid %d address %U ", ntohl (mp->pid),
1807 format_ip6_address, mp->address);
1808 if (mp->enable_disable == 0)
1809 s = format (s, "del ");
1814 static void *vl_api_want_l2_macs_events_t_print
1815 (vl_api_want_l2_macs_events_t * mp, void *handle)
1819 s = format (0, "SCRIPT: want_l2_macs_events ");
1820 s = format (s, "learn-limit %d ", ntohl (mp->learn_limit));
1821 s = format (s, "scan-delay %d ", (u32) mp->scan_delay);
1822 s = format (s, "max-entries %d ", (u32) mp->max_macs_in_event * 10);
1823 if (mp->enable_disable == 0)
1824 s = format (s, "disable");
1829 static void *vl_api_input_acl_set_interface_t_print
1830 (vl_api_input_acl_set_interface_t * mp, void *handle)
1834 s = format (0, "SCRIPT: input_acl_set_interface ");
1836 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1837 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1838 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1839 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
1841 if (mp->is_add == 0)
1842 s = format (s, "del ");
1847 static void *vl_api_ip_address_dump_t_print
1848 (vl_api_ip_address_dump_t * mp, void *handle)
1852 s = format (0, "SCRIPT: ip6_address_dump ");
1853 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1854 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1860 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
1864 s = format (0, "SCRIPT: ip_dump ");
1865 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1870 static void *vl_api_cop_interface_enable_disable_t_print
1871 (vl_api_cop_interface_enable_disable_t * mp, void *handle)
1875 s = format (0, "SCRIPT: cop_interface_enable_disable ");
1876 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1877 if (mp->enable_disable)
1878 s = format (s, "enable ");
1880 s = format (s, "disable ");
1885 static void *vl_api_cop_whitelist_enable_disable_t_print
1886 (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
1890 s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
1891 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1892 s = format (s, "fib-id %d ", ntohl (mp->fib_id));
1894 s = format (s, "ip4 ");
1896 s = format (s, "ip6 ");
1897 if (mp->default_cop)
1898 s = format (s, "default ");
1903 static void *vl_api_af_packet_create_t_print
1904 (vl_api_af_packet_create_t * mp, void *handle)
1908 s = format (0, "SCRIPT: af_packet_create ");
1909 s = format (s, "host_if_name %s ", mp->host_if_name);
1910 if (mp->use_random_hw_addr)
1911 s = format (s, "hw_addr random ");
1913 s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
1918 static void *vl_api_af_packet_delete_t_print
1919 (vl_api_af_packet_delete_t * mp, void *handle)
1923 s = format (0, "SCRIPT: af_packet_delete ");
1924 s = format (s, "host_if_name %s ", mp->host_if_name);
1930 format_policer_action (u8 * s, va_list * va)
1932 u32 action = va_arg (*va, u32);
1933 u32 dscp = va_arg (*va, u32);
1936 if (action == SSE2_QOS_ACTION_DROP)
1937 s = format (s, "drop");
1938 else if (action == SSE2_QOS_ACTION_TRANSMIT)
1939 s = format (s, "transmit");
1940 else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
1942 s = format (s, "mark-and-transmit ");
1945 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
1951 s = format (s, "%s", t);
1957 static void *vl_api_policer_add_del_t_print
1958 (vl_api_policer_add_del_t * mp, void *handle)
1962 s = format (0, "SCRIPT: policer_add_del ");
1963 s = format (s, "name %s ", mp->name);
1964 s = format (s, "cir %d ", mp->cir);
1965 s = format (s, "eir %d ", mp->eir);
1966 s = format (s, "cb %d ", mp->cb);
1967 s = format (s, "eb %d ", mp->eb);
1969 switch (mp->rate_type)
1971 case SSE2_QOS_RATE_KBPS:
1972 s = format (s, "rate_type kbps ");
1974 case SSE2_QOS_RATE_PPS:
1975 s = format (s, "rate_type pps ");
1981 switch (mp->round_type)
1983 case SSE2_QOS_ROUND_TO_CLOSEST:
1984 s = format (s, "round_type closest ");
1986 case SSE2_QOS_ROUND_TO_UP:
1987 s = format (s, "round_type up ");
1989 case SSE2_QOS_ROUND_TO_DOWN:
1990 s = format (s, "round_type down ");
1998 case SSE2_QOS_POLICER_TYPE_1R2C:
1999 s = format (s, "type 1r2c ");
2001 case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
2002 s = format (s, "type 1r3c ");
2004 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
2005 s = format (s, "type 2r3c-2698 ");
2007 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
2008 s = format (s, "type 2r3c-4115 ");
2010 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
2011 s = format (s, "type 2r3c-mef5cf1 ");
2017 s = format (s, "conform_action %U ", format_policer_action,
2018 mp->conform_action_type, mp->conform_dscp);
2019 s = format (s, "exceed_action %U ", format_policer_action,
2020 mp->exceed_action_type, mp->exceed_dscp);
2021 s = format (s, "violate_action %U ", format_policer_action,
2022 mp->violate_action_type, mp->violate_dscp);
2024 if (mp->color_aware)
2025 s = format (s, "color-aware ");
2026 if (mp->is_add == 0)
2027 s = format (s, "del ");
2032 static void *vl_api_policer_dump_t_print
2033 (vl_api_policer_dump_t * mp, void *handle)
2037 s = format (0, "SCRIPT: policer_dump ");
2038 if (mp->match_name_valid)
2039 s = format (s, "name %s ", mp->match_name);
2044 static void *vl_api_policer_classify_set_interface_t_print
2045 (vl_api_policer_classify_set_interface_t * mp, void *handle)
2049 s = format (0, "SCRIPT: policer_classify_set_interface ");
2050 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2051 if (mp->ip4_table_index != ~0)
2052 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2053 if (mp->ip6_table_index != ~0)
2054 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2055 if (mp->l2_table_index != ~0)
2056 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2057 if (mp->is_add == 0)
2058 s = format (s, "del ");
2063 static void *vl_api_policer_classify_dump_t_print
2064 (vl_api_policer_classify_dump_t * mp, void *handle)
2068 s = format (0, "SCRIPT: policer_classify_dump ");
2071 case POLICER_CLASSIFY_TABLE_IP4:
2072 s = format (s, "type ip4 ");
2074 case POLICER_CLASSIFY_TABLE_IP6:
2075 s = format (s, "type ip6 ");
2077 case POLICER_CLASSIFY_TABLE_L2:
2078 s = format (s, "type l2 ");
2087 static void *vl_api_sw_interface_clear_stats_t_print
2088 (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2092 s = format (0, "SCRIPT: sw_interface_clear_stats ");
2093 if (mp->sw_if_index != ~0)
2094 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2099 static void *vl_api_mpls_tunnel_dump_t_print
2100 (vl_api_mpls_tunnel_dump_t * mp, void *handle)
2104 s = format (0, "SCRIPT: mpls_tunnel_dump ");
2106 s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
2111 static void *vl_api_mpls_fib_dump_t_print
2112 (vl_api_mpls_fib_dump_t * mp, void *handle)
2116 s = format (0, "SCRIPT: mpls_fib_decap_dump ");
2121 static void *vl_api_ip_fib_dump_t_print
2122 (vl_api_ip_fib_dump_t * mp, void *handle)
2126 s = format (0, "SCRIPT: ip_fib_dump ");
2131 static void *vl_api_ip6_fib_dump_t_print
2132 (vl_api_ip6_fib_dump_t * mp, void *handle)
2136 s = format (0, "SCRIPT: ip6_fib_dump ");
2141 static void *vl_api_classify_table_ids_t_print
2142 (vl_api_classify_table_ids_t * mp, void *handle)
2146 s = format (0, "SCRIPT: classify_table_ids ");
2151 static void *vl_api_classify_table_by_interface_t_print
2152 (vl_api_classify_table_by_interface_t * mp, void *handle)
2156 s = format (0, "SCRIPT: classify_table_by_interface ");
2157 if (mp->sw_if_index != ~0)
2158 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2163 static void *vl_api_classify_table_info_t_print
2164 (vl_api_classify_table_info_t * mp, void *handle)
2168 s = format (0, "SCRIPT: classify_table_info ");
2169 if (mp->table_id != ~0)
2170 s = format (s, "table_id %d ", ntohl (mp->table_id));
2175 static void *vl_api_classify_session_dump_t_print
2176 (vl_api_classify_session_dump_t * mp, void *handle)
2180 s = format (0, "SCRIPT: classify_session_dump ");
2181 if (mp->table_id != ~0)
2182 s = format (s, "table_id %d ", ntohl (mp->table_id));
2187 static void *vl_api_set_ipfix_exporter_t_print
2188 (vl_api_set_ipfix_exporter_t * mp, void *handle)
2192 s = format (0, "SCRIPT: set_ipfix_exporter ");
2194 s = format (s, "collector-address %U ", format_ip4_address,
2195 (ip4_address_t *) mp->collector_address);
2196 s = format (s, "collector-port %d ", ntohs (mp->collector_port));
2197 s = format (s, "src-address %U ", format_ip4_address,
2198 (ip4_address_t *) mp->src_address);
2199 s = format (s, "vrf-id %d ", ntohl (mp->vrf_id));
2200 s = format (s, "path-mtu %d ", ntohl (mp->path_mtu));
2201 s = format (s, "template-interval %d ", ntohl (mp->template_interval));
2202 s = format (s, "udp-checksum %d ", mp->udp_checksum);
2207 static void *vl_api_ipfix_exporter_dump_t_print
2208 (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2212 s = format (0, "SCRIPT: ipfix_exporter_dump ");
2217 static void *vl_api_set_ipfix_classify_stream_t_print
2218 (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2222 s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2224 s = format (s, "domain-id %d ", ntohl (mp->domain_id));
2225 s = format (s, "src-port %d ", ntohs (mp->src_port));
2230 static void *vl_api_ipfix_classify_stream_dump_t_print
2231 (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2235 s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2240 static void *vl_api_ipfix_classify_table_add_del_t_print
2241 (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2245 s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2247 s = format (s, "table-id %d ", ntohl (mp->table_id));
2248 s = format (s, "ip-version %d ", mp->ip_version);
2249 s = format (s, "transport-protocol %d ", mp->transport_protocol);
2254 static void *vl_api_ipfix_classify_table_dump_t_print
2255 (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2259 s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2264 static void *vl_api_sw_interface_span_enable_disable_t_print
2265 (vl_api_sw_interface_span_enable_disable_t * mp, void *handle)
2269 s = format (0, "SCRIPT: sw_interface_span_enable_disable ");
2270 s = format (s, "src_sw_if_index %u ", ntohl (mp->sw_if_index_from));
2271 s = format (s, "dst_sw_if_index %u ", ntohl (mp->sw_if_index_to));
2274 s = format (s, "l2 ");
2279 s = format (s, "disable ");
2282 s = format (s, "rx ");
2285 s = format (s, "tx ");
2289 s = format (s, "both ");
2297 vl_api_sw_interface_span_dump_t_print (vl_api_sw_interface_span_dump_t * mp,
2302 s = format (0, "SCRIPT: sw_interface_span_dump ");
2305 s = format (s, "l2 ");
2310 static void *vl_api_get_next_index_t_print
2311 (vl_api_get_next_index_t * mp, void *handle)
2315 s = format (0, "SCRIPT: get_next_index ");
2316 s = format (s, "node-name %s ", mp->node_name);
2317 s = format (s, "next-node-name %s ", mp->next_name);
2322 static void *vl_api_pg_create_interface_t_print
2323 (vl_api_pg_create_interface_t * mp, void *handle)
2327 s = format (0, "SCRIPT: pg_create_interface ");
2328 s = format (0, "if_id %d", ntohl (mp->interface_id));
2333 static void *vl_api_pg_capture_t_print
2334 (vl_api_pg_capture_t * mp, void *handle)
2338 s = format (0, "SCRIPT: pg_capture ");
2339 s = format (0, "if_id %d ", ntohl (mp->interface_id));
2340 s = format (0, "pcap %s", mp->pcap_file_name);
2341 if (mp->count != ~0)
2342 s = format (s, "count %d ", ntohl (mp->count));
2343 if (!mp->is_enabled)
2344 s = format (s, "disable");
2349 static void *vl_api_pg_enable_disable_t_print
2350 (vl_api_pg_enable_disable_t * mp, void *handle)
2354 s = format (0, "SCRIPT: pg_enable_disable ");
2355 if (ntohl (mp->stream_name_length) > 0)
2356 s = format (s, "stream %s", mp->stream_name);
2357 if (!mp->is_enabled)
2358 s = format (s, "disable");
2363 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2364 (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2369 s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2371 s = format (s, "%U/%d ", format_ip6_address, mp->address,
2374 s = format (s, "%U/%d ", format_ip4_address, mp->address,
2377 for (i = 0; i < mp->number_of_ranges; i++)
2379 s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2382 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
2384 if (mp->is_add == 0)
2385 s = format (s, "del ");
2390 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2391 (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2396 s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2398 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2400 if (mp->tcp_out_vrf_id != ~0)
2401 s = format (s, "tcp-out-vrf %d ", ntohl (mp->tcp_out_vrf_id));
2403 if (mp->udp_out_vrf_id != ~0)
2404 s = format (s, "udp-out-vrf %d ", ntohl (mp->udp_out_vrf_id));
2406 if (mp->tcp_in_vrf_id != ~0)
2407 s = format (s, "tcp-in-vrf %d ", ntohl (mp->tcp_in_vrf_id));
2409 if (mp->udp_in_vrf_id != ~0)
2410 s = format (s, "udp-in-vrf %d ", ntohl (mp->udp_in_vrf_id));
2412 if (mp->is_add == 0)
2413 s = format (s, "del ");
2418 static void *vl_api_lisp_enable_disable_t_print
2419 (vl_api_lisp_enable_disable_t * mp, void *handle)
2423 s = format (0, "SCRIPT: lisp_enable_disable %s",
2424 mp->is_en ? "enable" : "disable");
2429 static void *vl_api_gpe_add_del_iface_t_print
2430 (vl_api_gpe_add_del_iface_t * mp, void *handle)
2434 s = format (0, "SCRIPT: gpe_add_del_iface ");
2436 s = format (s, "%s ", mp->is_add ? "up" : "down");
2437 s = format (s, "vni %d ", mp->vni);
2438 s = format (s, "%s %d ", mp->is_l2 ? "bd_id" : "table_id", mp->dp_table);
2443 static void *vl_api_lisp_pitr_set_locator_set_t_print
2444 (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
2448 s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
2451 s = format (s, "locator-set %s ", mp->ls_name);
2453 s = format (s, "del");
2459 format_lisp_flat_eid (u8 * s, va_list * args)
2461 u32 type = va_arg (*args, u32);
2462 u8 *eid = va_arg (*args, u8 *);
2463 u32 eid_len = va_arg (*args, u32);
2468 return format (s, "%U/%d", format_ip4_address, eid, eid_len);
2470 return format (s, "%U/%d", format_ip6_address, eid, eid_len);
2472 return format (s, "%U", format_ethernet_address, eid);
2477 static void *vl_api_lisp_add_del_remote_mapping_t_print
2478 (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
2483 s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
2486 s = format (s, "del-all ");
2488 s = format (s, "%s ", mp->is_add ? "add" : "del");
2489 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2491 s = format (s, "eid %U ", format_lisp_flat_eid,
2492 mp->eid_type, mp->eid, mp->eid_len);
2496 s = format (s, "seid %U ", format_lisp_flat_eid,
2497 mp->eid_type, mp->seid, mp->seid_len);
2500 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
2503 s = format (s, "action %d", mp->action);
2508 static void *vl_api_lisp_add_del_adjacency_t_print
2509 (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
2513 s = format (0, "SCRIPT: lisp_add_del_adjacency ");
2515 s = format (s, "%s ", mp->is_add ? "add" : "del");
2516 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2517 s = format (s, "reid %U leid %U ",
2518 format_lisp_flat_eid, mp->eid_type, mp->reid, mp->reid_len,
2519 format_lisp_flat_eid, mp->eid_type, mp->leid, mp->leid_len);
2524 static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
2525 (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
2529 s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
2532 s = format (s, "%s", mp->locator_set_name);
2534 s = format (s, "del");
2539 static void *vl_api_lisp_eid_table_add_del_map_t_print
2540 (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
2544 s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
2547 s = format (s, "del ");
2549 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2550 s = format (s, "%s %d ",
2551 mp->is_l2 ? "bd_index" : "vrf",
2552 clib_net_to_host_u32 (mp->dp_table));
2556 static void *vl_api_lisp_add_del_local_eid_t_print
2557 (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
2561 s = format (0, "SCRIPT: lisp_add_del_local_eid ");
2564 s = format (s, "del ");
2566 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2567 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
2569 s = format (s, "locator-set %s ", mp->locator_set_name);
2572 u32 key_id = mp->key_id;
2573 s = format (s, "key-id %U", format_hmac_key_id, key_id);
2574 s = format (s, "secret-key %s", mp->key);
2579 static void *vl_api_gpe_add_del_fwd_entry_t_print
2580 (vl_api_gpe_add_del_fwd_entry_t * mp, void *handle)
2584 s = format (0, "SCRIPT: gpe_add_del_fwd_entry TODO");
2589 static void *vl_api_lisp_add_del_map_resolver_t_print
2590 (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
2594 s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
2597 s = format (s, "del ");
2600 s = format (s, "%U ", format_ip6_address, mp->ip_address);
2602 s = format (s, "%U ", format_ip4_address, mp->ip_address);
2607 static void *vl_api_gpe_enable_disable_t_print
2608 (vl_api_gpe_enable_disable_t * mp, void *handle)
2612 s = format (0, "SCRIPT: gpe_enable_disable ");
2614 s = format (s, "%s ", mp->is_en ? "enable" : "disable");
2619 static void *vl_api_lisp_add_del_locator_set_t_print
2620 (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
2624 s = format (0, "SCRIPT: lisp_add_del_locator_set ");
2627 s = format (s, "del ");
2629 s = format (s, "locator-set %s ", mp->locator_set_name);
2634 static void *vl_api_lisp_add_del_locator_t_print
2635 (vl_api_lisp_add_del_locator_t * mp, void *handle)
2639 s = format (0, "SCRIPT: lisp_add_del_locator ");
2642 s = format (s, "del ");
2644 s = format (s, "locator-set %s ", mp->locator_set_name);
2645 s = format (s, "sw_if_index %d ", mp->sw_if_index);
2646 s = format (s, "p %d w %d ", mp->priority, mp->weight);
2651 static void *vl_api_lisp_locator_set_dump_t_print
2652 (vl_api_lisp_locator_set_dump_t * mp, void *handle)
2656 s = format (0, "SCRIPT: lisp_locator_set_dump ");
2657 if (mp->filter == 1)
2658 s = format (s, "local");
2659 else if (mp->filter == 2)
2660 s = format (s, "remote");
2665 static void *vl_api_lisp_locator_dump_t_print
2666 (vl_api_lisp_locator_dump_t * mp, void *handle)
2670 s = format (0, "SCRIPT: lisp_locator_dump ");
2671 if (mp->is_index_set)
2672 s = format (s, "ls_index %d", clib_net_to_host_u32 (mp->ls_index));
2674 s = format (s, "ls_name %s", mp->ls_name);
2679 static void *vl_api_lisp_map_request_mode_t_print
2680 (vl_api_lisp_map_request_mode_t * mp, void *handle)
2684 s = format (0, "SCRIPT: lisp_map_request_mode ");
2689 s = format (s, "dst-only");
2692 s = format (s, "src-dst");
2700 static void *vl_api_lisp_eid_table_dump_t_print
2701 (vl_api_lisp_eid_table_dump_t * mp, void *handle)
2705 s = format (0, "SCRIPT: lisp_eid_table_dump ");
2709 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2710 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
2711 mp->eid, mp->prefix_length);
2715 s = format (s, "local ");
2718 s = format (s, "remote ");
2726 static void *vl_api_lisp_rloc_probe_enable_disable_t_print
2727 (vl_api_lisp_rloc_probe_enable_disable_t * mp, void *handle)
2731 s = format (0, "SCRIPT: lisp_rloc_probe_enable_disable ");
2733 s = format (s, "enable");
2735 s = format (s, "disable");
2740 static void *vl_api_lisp_map_register_enable_disable_t_print
2741 (vl_api_lisp_map_register_enable_disable_t * mp, void *handle)
2745 s = format (0, "SCRIPT: lisp_map_register_enable_disable ");
2747 s = format (s, "enable");
2749 s = format (s, "disable");
2754 static void *vl_api_lisp_adjacencies_get_t_print
2755 (vl_api_lisp_adjacencies_get_t * mp, void *handle)
2759 s = format (0, "SCRIPT: lisp_adjacencies_get ");
2760 s = format (s, "vni %d", clib_net_to_host_u32 (mp->vni));
2765 static void *vl_api_lisp_eid_table_map_dump_t_print
2766 (vl_api_lisp_eid_table_map_dump_t * mp, void *handle)
2770 s = format (0, "SCRIPT: lisp_eid_table_map_dump ");
2773 s = format (s, "l2");
2775 s = format (s, "l3");
2780 static void *vl_api_ipsec_gre_add_del_tunnel_t_print
2781 (vl_api_ipsec_gre_add_del_tunnel_t * mp, void *handle)
2785 s = format (0, "SCRIPT: ipsec_gre_add_del_tunnel ");
2787 s = format (s, "dst %U ", format_ip4_address,
2788 (ip4_address_t *) & (mp->dst_address));
2790 s = format (s, "src %U ", format_ip4_address,
2791 (ip4_address_t *) & (mp->src_address));
2793 s = format (s, "local_sa %d ", ntohl (mp->local_sa_id));
2795 s = format (s, "remote_sa %d ", ntohl (mp->remote_sa_id));
2797 if (mp->is_add == 0)
2798 s = format (s, "del ");
2803 static void *vl_api_ipsec_gre_tunnel_dump_t_print
2804 (vl_api_ipsec_gre_tunnel_dump_t * mp, void *handle)
2808 s = format (0, "SCRIPT: ipsec_gre_tunnel_dump ");
2810 if (mp->sw_if_index != ~0)
2811 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2816 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
2817 (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
2820 u32 vtr_op = ntohl (mp->vtr_op);
2822 s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
2824 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2825 s = format (s, "vtr_op %d ", vtr_op);
2826 if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
2828 if (vtr_op == L2_VTR_TRANSLATE_2_2)
2829 s = format (s, "%d ", ntohs (mp->outer_tag));
2830 s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
2831 s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
2832 s = format (s, "sid %d ", ntohl (mp->i_sid));
2833 s = format (s, "vlanid %d ", ntohs (mp->b_vlanid));
2839 static void *vl_api_flow_classify_set_interface_t_print
2840 (vl_api_flow_classify_set_interface_t * mp, void *handle)
2844 s = format (0, "SCRIPT: flow_classify_set_interface ");
2845 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2846 if (mp->ip4_table_index != ~0)
2847 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2848 if (mp->ip6_table_index != ~0)
2849 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2850 if (mp->is_add == 0)
2851 s = format (s, "del ");
2857 vl_api_punt_t_print (vl_api_punt_t * mp, void *handle)
2861 s = format (0, "SCRIPT: punt ");
2863 if (mp->ipv != (u8) ~ 0)
2864 s = format (s, "ip %d ", mp->ipv);
2866 s = format (s, "protocol %d ", mp->l4_protocol);
2868 if (mp->l4_port != (u16) ~ 0)
2869 s = format (s, "port %d ", ntohs (mp->l4_port));
2872 s = format (s, "del ");
2877 static void *vl_api_flow_classify_dump_t_print
2878 (vl_api_flow_classify_dump_t * mp, void *handle)
2882 s = format (0, "SCRIPT: flow_classify_dump ");
2885 case FLOW_CLASSIFY_TABLE_IP4:
2886 s = format (s, "type ip4 ");
2888 case FLOW_CLASSIFY_TABLE_IP6:
2889 s = format (s, "type ip6 ");
2898 static void *vl_api_get_first_msg_id_t_print
2899 (vl_api_get_first_msg_id_t * mp, void *handle)
2903 s = format (0, "SCRIPT: get_first_msg_id %s ", mp->name);
2908 static void *vl_api_ioam_enable_t_print
2909 (vl_api_ioam_enable_t * mp, void *handle)
2913 s = format (0, "SCRIPT: ioam_enable ");
2915 if (mp->trace_enable)
2916 s = format (s, "trace enabled");
2919 s = format (s, "POT enabled");
2922 s = format (s, "Seqno enabled");
2925 s = format (s, "Analyse enabled");
2930 static void *vl_api_ioam_disable_t_print
2931 (vl_api_ioam_disable_t * mp, void *handle)
2935 s = format (0, "SCRIPT: ioam_disable ");
2936 s = format (s, "trace disabled");
2937 s = format (s, "POT disabled");
2938 s = format (s, "Seqno disabled");
2939 s = format (s, "Analyse disabled");
2944 static void *vl_api_feature_enable_disable_t_print
2945 (vl_api_feature_enable_disable_t * mp, void *handle)
2949 s = format (0, "SCRIPT: feature_enable_disable ");
2950 s = format (s, "arc_name %s ", mp->arc_name);
2951 s = format (s, "feature_name %s ", mp->feature_name);
2952 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2954 s = format (s, "disable");
2959 static void *vl_api_sw_interface_tag_add_del_t_print
2960 (vl_api_sw_interface_tag_add_del_t * mp, void *handle)
2964 s = format (0, "SCRIPT: sw_interface_tag_add_del ");
2965 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2967 s = format (s, "tag %s ", mp->tag);
2969 s = format (s, "del ");
2974 static void *vl_api_sw_interface_set_mtu_t_print
2975 (vl_api_sw_interface_set_mtu_t * mp, void *handle)
2979 s = format (0, "SCRIPT: sw_interface_set_mtu ");
2980 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2981 s = format (s, "tag %d ", ntohs (mp->mtu));
2986 static void *vl_api_p2p_ethernet_add_t_print
2987 (vl_api_p2p_ethernet_add_t * mp, void *handle)
2991 s = format (0, "SCRIPT: p2p_ethernet_add ");
2992 s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
2993 s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
2998 static void *vl_api_p2p_ethernet_del_t_print
2999 (vl_api_p2p_ethernet_del_t * mp, void *handle)
3003 s = format (0, "SCRIPT: p2p_ethernet_del ");
3004 s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
3005 s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
3010 #define foreach_custom_print_no_arg_function \
3011 _(lisp_eid_table_vni_dump) \
3012 _(lisp_map_resolver_dump) \
3013 _(lisp_map_server_dump) \
3014 _(show_lisp_rloc_probe_state) \
3015 _(show_lisp_map_register_state) \
3016 _(show_lisp_map_request_mode)
3019 static void * vl_api_ ## f ## _t_print \
3020 (vl_api_ ## f ## _t * mp, void * handle) \
3023 s = format (0, "SCRIPT: " #f ); \
3026 foreach_custom_print_no_arg_function
3028 #define foreach_custom_print_function \
3029 _(CREATE_LOOPBACK, create_loopback) \
3030 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \
3031 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
3032 _(SW_INTERFACE_EVENT, sw_interface_event) \
3033 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \
3034 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \
3035 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \
3036 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \
3037 _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass) \
3038 _(TAP_CONNECT, tap_connect) \
3039 _(TAP_MODIFY, tap_modify) \
3040 _(TAP_DELETE, tap_delete) \
3041 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \
3042 _(IP_ADD_DEL_ROUTE, ip_add_del_route) \
3043 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
3044 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
3045 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \
3046 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered) \
3047 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \
3048 _(RESET_VRF, reset_vrf) \
3049 _(CREATE_VLAN_SUBIF, create_vlan_subif) \
3050 _(CREATE_SUBIF, create_subif) \
3051 _(OAM_ADD_DEL, oam_add_del) \
3052 _(RESET_FIB, reset_fib) \
3053 _(DHCP_PROXY_CONFIG, dhcp_proxy_config) \
3054 _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss) \
3055 _(SET_IP_FLOW_HASH, set_ip_flow_hash) \
3056 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \
3057 sw_interface_ip6_set_link_local_address) \
3058 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix) \
3059 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config) \
3060 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \
3061 _(L2_PATCH_ADD_DEL, l2_patch_add_del) \
3062 _(SR_LOCALSID_ADD_DEL, sr_localsid_add_del) \
3063 _(SR_STEERING_ADD_DEL, sr_steering_add_del) \
3064 _(SR_POLICY_ADD, sr_policy_add) \
3065 _(SR_POLICY_MOD, sr_policy_mod) \
3066 _(SR_POLICY_DEL, sr_policy_del) \
3067 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \
3068 _(L2FIB_ADD_DEL, l2fib_add_del) \
3069 _(L2FIB_FLUSH_ALL, l2fib_flush_all) \
3070 _(L2FIB_FLUSH_BD, l2fib_flush_bd) \
3071 _(L2FIB_FLUSH_INT, l2fib_flush_int) \
3072 _(L2_FLAGS, l2_flags) \
3073 _(BRIDGE_FLAGS, bridge_flags) \
3074 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table) \
3075 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session) \
3076 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \
3077 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
3078 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
3079 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) \
3080 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \
3081 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \
3082 _(ADD_NODE_NEXT, add_node_next) \
3083 _(DHCP_CLIENT_CONFIG, dhcp_client_config) \
3084 _(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel) \
3085 _(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies) \
3086 _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable) \
3087 _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \
3088 _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \
3089 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \
3090 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \
3091 _(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel) \
3092 _(GRE_TUNNEL_DUMP, gre_tunnel_dump) \
3093 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \
3094 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \
3095 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \
3096 _(CREATE_VHOST_USER_IF, create_vhost_user_if) \
3097 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if) \
3098 _(DELETE_VHOST_USER_IF, delete_vhost_user_if) \
3099 _(SW_INTERFACE_DUMP, sw_interface_dump) \
3100 _(CONTROL_PING, control_ping) \
3101 _(WANT_INTERFACE_EVENTS, want_interface_events) \
3103 _(CLI_INBAND, cli_inband) \
3104 _(MEMCLNT_CREATE, memclnt_create) \
3105 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump) \
3106 _(SHOW_VERSION, show_version) \
3107 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
3108 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel) \
3109 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump) \
3110 _(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
3111 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
3112 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events) \
3113 _(WANT_L2_MACS_EVENTS, want_l2_macs_events) \
3114 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
3115 _(IP_ADDRESS_DUMP, ip_address_dump) \
3116 _(IP_DUMP, ip_dump) \
3117 _(DELETE_LOOPBACK, delete_loopback) \
3118 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \
3119 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \
3120 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \
3121 _(AF_PACKET_CREATE, af_packet_create) \
3122 _(AF_PACKET_DELETE, af_packet_delete) \
3123 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) \
3124 _(MPLS_FIB_DUMP, mpls_fib_dump) \
3125 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \
3126 _(CLASSIFY_TABLE_IDS,classify_table_ids) \
3127 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface) \
3128 _(CLASSIFY_TABLE_INFO,classify_table_info) \
3129 _(CLASSIFY_SESSION_DUMP,classify_session_dump) \
3130 _(SET_IPFIX_EXPORTER, set_ipfix_exporter) \
3131 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump) \
3132 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream) \
3133 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump) \
3134 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del) \
3135 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump) \
3136 _(SW_INTERFACE_SPAN_ENABLE_DISABLE, sw_interface_span_enable_disable) \
3137 _(SW_INTERFACE_SPAN_DUMP, sw_interface_span_dump) \
3138 _(GET_NEXT_INDEX, get_next_index) \
3139 _(PG_CREATE_INTERFACE,pg_create_interface) \
3140 _(PG_CAPTURE, pg_capture) \
3141 _(PG_ENABLE_DISABLE, pg_enable_disable) \
3142 _(POLICER_ADD_DEL, policer_add_del) \
3143 _(POLICER_DUMP, policer_dump) \
3144 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface) \
3145 _(POLICER_CLASSIFY_DUMP, policer_classify_dump) \
3146 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \
3147 ip_source_and_port_range_check_add_del) \
3148 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \
3149 ip_source_and_port_range_check_interface_add_del) \
3150 _(LISP_ENABLE_DISABLE, lisp_enable_disable) \
3151 _(GPE_ENABLE_DISABLE, gpe_enable_disable) \
3152 _(GPE_ADD_DEL_IFACE, gpe_add_del_iface) \
3153 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
3154 _(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
3155 _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
3156 _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
3157 _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
3158 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
3159 lisp_add_del_map_request_itr_rlocs) \
3160 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
3161 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
3162 _(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry) \
3163 _(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
3164 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
3165 _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
3166 _(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
3167 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
3168 _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
3169 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
3170 _(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
3171 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
3172 _(LISP_LOCATOR_DUMP, lisp_locator_dump) \
3173 _(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \
3174 _(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \
3175 _(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \
3176 _(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \
3177 _(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \
3178 _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel) \
3179 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump) \
3180 _(DELETE_SUBIF, delete_subif) \
3181 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \
3183 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface) \
3184 _(FLOW_CLASSIFY_DUMP, flow_classify_dump) \
3185 _(GET_FIRST_MSG_ID, get_first_msg_id) \
3186 _(IOAM_ENABLE, ioam_enable) \
3187 _(IOAM_DISABLE, ioam_disable) \
3188 _(IP_FIB_DUMP, ip_fib_dump) \
3189 _(IP6_FIB_DUMP, ip6_fib_dump) \
3190 _(FEATURE_ENABLE_DISABLE, feature_enable_disable) \
3191 _(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del) \
3192 _(SW_INTERFACE_SET_MTU, sw_interface_set_mtu) \
3193 _(P2P_ETHERNET_ADD, p2p_ethernet_add) \
3194 _(P2P_ETHERNET_DEL, p2p_ethernet_del)
3196 vl_msg_api_custom_dump_configure (api_main_t * am)
3198 #define _(n,f) am->msg_print_handlers[VL_API_##n] \
3199 = (void *) vl_api_##f##_t_print;
3200 foreach_custom_print_function;
3205 * fd.io coding-style-patch-verification: ON
3208 * eval: (c-set-style "gnu")