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 ");
111 if (mp->link_up_down)
112 s = format (s, "link-up");
114 s = format (s, "link-down");
119 static void *vl_api_sw_interface_add_del_address_t_print
120 (vl_api_sw_interface_add_del_address_t * mp, void *handle)
124 s = format (0, "SCRIPT: sw_interface_add_del_address ");
126 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
129 s = format (s, "%U/%d ", format_ip6_address,
130 (ip6_address_t *) mp->address, mp->address_length);
132 s = format (s, "%U/%d ", format_ip4_address,
133 (ip4_address_t *) mp->address, mp->address_length);
136 s = format (s, "del ");
138 s = format (s, "del-all ");
143 static void *vl_api_sw_interface_set_table_t_print
144 (vl_api_sw_interface_set_table_t * mp, void *handle)
148 s = format (0, "SCRIPT: sw_interface_set_table ");
150 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
153 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
156 s = format (s, "ipv6 ");
161 static void *vl_api_sw_interface_set_mpls_enable_t_print
162 (vl_api_sw_interface_set_mpls_enable_t * mp, void *handle)
166 s = format (0, "SCRIPT: sw_interface_set_mpls_enable ");
168 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
171 s = format (s, "disable");
176 static void *vl_api_sw_interface_set_vpath_t_print
177 (vl_api_sw_interface_set_vpath_t * mp, void *handle)
181 s = format (0, "SCRIPT: sw_interface_set_vpath ");
183 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
186 s = format (s, "enable ");
188 s = format (s, "disable ");
193 static void *vl_api_sw_interface_set_vxlan_bypass_t_print
194 (vl_api_sw_interface_set_vxlan_bypass_t * mp, void *handle)
198 s = format (0, "SCRIPT: sw_interface_set_vxlan_bypass ");
200 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
203 s = format (s, "ip6 ");
206 s = format (s, "enable ");
208 s = format (s, "disable ");
213 static void *vl_api_sw_interface_set_l2_xconnect_t_print
214 (vl_api_sw_interface_set_l2_xconnect_t * mp, void *handle)
218 s = format (0, "SCRIPT: sw_interface_set_l2_xconnect ");
220 s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
224 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
227 s = format (s, "delete ");
232 static void *vl_api_sw_interface_set_l2_bridge_t_print
233 (vl_api_sw_interface_set_l2_bridge_t * mp, void *handle)
237 s = format (0, "SCRIPT: sw_interface_set_l2_bridge ");
239 s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
243 s = format (s, "bd_id %d shg %d %senable ", ntohl (mp->bd_id),
244 mp->shg, ((mp->bvi) ? "bvi " : " "));
247 s = format (s, "disable ");
252 static void *vl_api_bridge_domain_add_del_t_print
253 (vl_api_bridge_domain_add_del_t * mp, void *handle)
257 s = format (0, "SCRIPT: bridge_domain_add_del ");
259 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
263 s = format (s, "flood %d uu-flood %d ", mp->flood, mp->uu_flood);
264 s = format (s, "forward %d learn %d ", mp->forward, mp->learn);
265 s = format (s, "arp-term %d mac-age %d", mp->arp_term, mp->mac_age);
268 s = format (s, "del ");
273 static void *vl_api_bridge_domain_set_mac_age_t_print
274 (vl_api_bridge_domain_set_mac_age_t * mp, void *handle)
278 s = format (0, "SCRIPT: bridge_domain_set_mac_age ");
280 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
282 s = format (s, "mac-age %d", mp->mac_age);
287 static void *vl_api_bridge_domain_dump_t_print
288 (vl_api_bridge_domain_dump_t * mp, void *handle)
291 u32 bd_id = ntohl (mp->bd_id);
293 s = format (0, "SCRIPT: bridge_domain_dump ");
296 s = format (s, "bd_id %d ", bd_id);
301 static void *vl_api_l2fib_flush_all_t_print
302 (vl_api_l2fib_flush_all_t * mp, void *handle)
306 s = format (0, "SCRIPT: l2fib_flush_all ");
312 static void *vl_api_l2fib_flush_bd_t_print
313 (vl_api_l2fib_flush_bd_t * mp, void *handle)
316 u32 bd_id = ntohl (mp->bd_id);
318 s = format (0, "SCRIPT: l2fib_flush_bd ");
319 s = format (s, "bd_id %d ", bd_id);
324 static void *vl_api_l2fib_flush_int_t_print
325 (vl_api_l2fib_flush_int_t * mp, void *handle)
328 u32 sw_if_index = ntohl (mp->sw_if_index);
330 s = format (0, "SCRIPT: l2fib_flush_int ");
331 s = format (s, "sw_if_index %d ", sw_if_index);
336 static void *vl_api_l2fib_add_del_t_print
337 (vl_api_l2fib_add_del_t * mp, void *handle)
341 s = format (0, "SCRIPT: l2fib_add_del ");
343 s = format (s, "mac %U ", format_ethernet_address, &mp->mac);
345 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
350 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
352 s = format (s, "%s", "static ");
354 s = format (s, "%s", "filter ");
356 s = format (s, "%s", "bvi ");
360 s = format (s, "del ");
367 vl_api_l2_flags_t_print (vl_api_l2_flags_t * mp, void *handle)
370 u32 flags = ntohl (mp->feature_bitmap);
372 s = format (0, "SCRIPT: l2_flags ");
374 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
377 if (flags & L2INPUT_FEAT_ ## a) s = format (s, #a " ");
378 foreach_l2input_feat;
384 static void *vl_api_bridge_flags_t_print
385 (vl_api_bridge_flags_t * mp, void *handle)
388 u32 flags = ntohl (mp->feature_bitmap);
390 s = format (0, "SCRIPT: bridge_flags ");
392 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
394 if (flags & L2_LEARN)
395 s = format (s, "learn ");
397 s = format (s, "forward ");
398 if (flags & L2_FLOOD)
399 s = format (s, "flood ");
400 if (flags & L2_UU_FLOOD)
401 s = format (s, "uu-flood ");
402 if (flags & L2_ARP_TERM)
403 s = format (s, "arp-term ");
406 s = format (s, "clear ");
411 static void *vl_api_bd_ip_mac_add_del_t_print
412 (vl_api_bd_ip_mac_add_del_t * mp, void *handle)
416 s = format (0, "SCRIPT: bd_ip_mac_add_del ");
417 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
420 s = format (s, "%U ", format_ip6_address,
421 (ip6_address_t *) mp->ip_address);
423 s = format (s, "%U ", format_ip4_address,
424 (ip4_address_t *) mp->ip_address);
426 s = format (s, "%U ", format_ethernet_address, mp->mac_address);
428 s = format (s, "del ");
433 static void *vl_api_tap_connect_t_print
434 (vl_api_tap_connect_t * mp, void *handle)
439 memset (null_mac, 0, sizeof (null_mac));
441 s = format (0, "SCRIPT: tap_connect ");
442 s = format (s, "tapname %s ", mp->tap_name);
443 if (mp->use_random_mac)
444 s = format (s, "random-mac ");
446 s = format (s, "tag %s ", mp->tag);
447 if (memcmp (mp->mac_address, null_mac, 6))
448 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
449 if (mp->ip4_address_set)
450 s = format (s, "address %U/%d ", format_ip4_address, mp->ip4_address,
452 if (mp->ip6_address_set)
453 s = format (s, "address %U/%d ", format_ip6_address, mp->ip6_address,
458 static void *vl_api_tap_modify_t_print
459 (vl_api_tap_modify_t * mp, void *handle)
464 memset (null_mac, 0, sizeof (null_mac));
466 s = format (0, "SCRIPT: tap_modify ");
467 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
468 s = format (s, "tapname %s ", mp->tap_name);
469 if (mp->use_random_mac)
470 s = format (s, "random-mac ");
472 if (memcmp (mp->mac_address, null_mac, 6))
473 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
478 static void *vl_api_tap_delete_t_print
479 (vl_api_tap_delete_t * mp, void *handle)
483 s = format (0, "SCRIPT: tap_delete ");
484 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
489 static void *vl_api_sw_interface_tap_dump_t_print
490 (vl_api_sw_interface_tap_dump_t * mp, void *handle)
494 s = format (0, "SCRIPT: sw_interface_tap_dump ");
500 static void *vl_api_ip_add_del_route_t_print
501 (vl_api_ip_add_del_route_t * mp, void *handle)
505 s = format (0, "SCRIPT: ip_add_del_route ");
507 s = format (s, "del ");
509 if (mp->next_hop_sw_if_index)
510 s = format (s, "sw_if_index %d ", ntohl (mp->next_hop_sw_if_index));
513 s = format (s, "%U/%d ", format_ip6_address, mp->dst_address,
514 mp->dst_address_length);
516 s = format (s, "%U/%d ", format_ip4_address, mp->dst_address,
517 mp->dst_address_length);
519 s = format (s, "local ");
520 else if (mp->is_drop)
521 s = format (s, "drop ");
522 else if (mp->is_classify)
523 s = format (s, "classify %d", ntohl (mp->classify_table_index));
527 s = format (s, "via %U ", format_ip6_address, mp->next_hop_address);
529 s = format (s, "via %U ", format_ip4_address, mp->next_hop_address);
532 if (mp->table_id != 0)
533 s = format (s, "vrf %d ", ntohl (mp->table_id));
535 if (mp->create_vrf_if_needed)
536 s = format (s, "create-vrf ");
538 if (mp->next_hop_weight != 1)
539 s = format (s, "weight %d ", mp->next_hop_weight);
542 s = format (s, "not-last ");
544 if (mp->is_multipath)
545 s = format (s, "multipath ");
547 if (mp->is_multipath)
548 s = format (s, "multipath ");
550 if (mp->next_hop_table_id)
551 s = format (s, "lookup-in-vrf %d ", ntohl (mp->next_hop_table_id));
556 static void *vl_api_proxy_arp_add_del_t_print
557 (vl_api_proxy_arp_add_del_t * mp, void *handle)
561 s = format (0, "SCRIPT: proxy_arp_add_del ");
563 s = format (s, "%U - %U ", format_ip4_address, mp->low_address,
564 format_ip4_address, mp->hi_address);
567 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
570 s = format (s, "del ");
575 static void *vl_api_proxy_arp_intfc_enable_disable_t_print
576 (vl_api_proxy_arp_intfc_enable_disable_t * mp, void *handle)
580 s = format (0, "SCRIPT: proxy_arp_intfc_enable_disable ");
582 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
584 s = format (s, "enable %d ", mp->enable_disable);
589 static void *vl_api_mpls_tunnel_add_del_t_print
590 (vl_api_mpls_tunnel_add_del_t * mp, void *handle)
594 s = format (0, "SCRIPT: mpls_tunnel_add_del ");
596 if (mp->mt_next_hop_sw_if_index)
597 s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index));
599 if (mp->mt_next_hop_proto_is_ip4)
600 s = format (s, "%U ", format_ip4_address, mp->mt_next_hop);
602 s = format (s, "%U ", format_ip6_address, mp->mt_next_hop);
605 s = format (s, "l2-only ");
607 if (mp->mt_is_add == 0)
608 s = format (s, "del ");
613 static void *vl_api_sw_interface_set_unnumbered_t_print
614 (vl_api_sw_interface_set_unnumbered_t * mp, void *handle)
618 s = format (0, "SCRIPT: sw_interface_set_unnumbered ");
620 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
622 s = format (s, "unnum_if_index %d ", ntohl (mp->unnumbered_sw_if_index));
625 s = format (s, "del ");
630 static void *vl_api_ip_neighbor_add_del_t_print
631 (vl_api_ip_neighbor_add_del_t * mp, void *handle)
636 memset (null_mac, 0, sizeof (null_mac));
638 s = format (0, "SCRIPT: ip_neighbor_add_del ");
640 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
643 s = format (s, "is_static ");
645 if (mp->is_no_adj_fib)
646 s = format (s, "is_no_fib_entry ");
648 if (memcmp (mp->mac_address, null_mac, 6))
649 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
653 format (s, "dst %U ", format_ip6_address,
654 (ip6_address_t *) mp->dst_address);
657 format (s, "dst %U ", format_ip4_address,
658 (ip4_address_t *) mp->dst_address);
661 s = format (s, "del ");
667 vl_api_reset_vrf_t_print (vl_api_reset_vrf_t * mp, void *handle)
671 s = format (0, "SCRIPT: reset_vrf ");
674 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
676 if (mp->is_ipv6 != 0)
677 s = format (s, "ipv6 ");
682 static void *vl_api_create_vlan_subif_t_print
683 (vl_api_create_vlan_subif_t * mp, void *handle)
687 s = format (0, "SCRIPT: create_vlan_subif ");
690 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
693 s = format (s, "vlan_id %d ", ntohl (mp->vlan_id));
698 #define foreach_create_subif_bit \
705 _(outer_vlan_id_any) \
708 static void *vl_api_create_subif_t_print
709 (vl_api_create_subif_t * mp, void *handle)
713 s = format (0, "SCRIPT: create_subif ");
715 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
717 s = format (s, "sub_id %d ", ntohl (mp->sub_id));
719 if (mp->outer_vlan_id)
720 s = format (s, "outer_vlan_id %d ", ntohs (mp->outer_vlan_id));
722 if (mp->inner_vlan_id)
723 s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
725 #define _(a) if (mp->a) s = format (s, "%s ", #a);
726 foreach_create_subif_bit;
732 static void *vl_api_delete_subif_t_print
733 (vl_api_delete_subif_t * mp, void *handle)
737 s = format (0, "SCRIPT: delete_subif ");
738 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
743 static void *vl_api_oam_add_del_t_print
744 (vl_api_oam_add_del_t * mp, void *handle)
748 s = format (0, "SCRIPT: oam_add_del ");
751 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
753 s = format (s, "src %U ", format_ip4_address, mp->src_address);
755 s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
758 s = format (s, "del ");
764 vl_api_reset_fib_t_print (vl_api_reset_fib_t * mp, void *handle)
768 s = format (0, "SCRIPT: reset_fib ");
771 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
773 if (mp->is_ipv6 != 0)
774 s = format (s, "ipv6 ");
779 static void *vl_api_dhcp_proxy_config_t_print
780 (vl_api_dhcp_proxy_config_t * mp, void *handle)
784 s = format (0, "SCRIPT: dhcp_proxy_config_2 ");
786 s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id));
787 s = format (s, "server_vrf_id %d ", ntohl (mp->server_vrf_id));
791 s = format (s, "svr %U ", format_ip6_address,
792 (ip6_address_t *) mp->dhcp_server);
793 s = format (s, "src %U ", format_ip6_address,
794 (ip6_address_t *) mp->dhcp_src_address);
798 s = format (s, "svr %U ", format_ip4_address,
799 (ip4_address_t *) mp->dhcp_server);
800 s = format (s, "src %U ", format_ip4_address,
801 (ip4_address_t *) mp->dhcp_src_address);
804 s = format (s, "del ");
809 static void *vl_api_dhcp_proxy_set_vss_t_print
810 (vl_api_dhcp_proxy_set_vss_t * mp, void *handle)
814 s = format (0, "SCRIPT: dhcp_proxy_set_vss ");
816 s = format (s, "tbl_id %d ", ntohl (mp->tbl_id));
818 s = format (s, "fib_id %d ", ntohl (mp->fib_id));
820 s = format (s, "oui %d ", ntohl (mp->oui));
822 if (mp->is_ipv6 != 0)
823 s = format (s, "ipv6 ");
826 s = format (s, "del ");
831 static void *vl_api_dhcp_client_config_t_print
832 (vl_api_dhcp_client_config_t * mp, void *handle)
836 s = format (0, "SCRIPT: dhcp_client_config ");
838 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
840 s = format (s, "hostname %s ", mp->hostname);
842 s = format (s, "want_dhcp_event %d ", mp->want_dhcp_event);
844 s = format (s, "pid %d ", ntohl (mp->pid));
847 s = format (s, "del ");
853 static void *vl_api_set_ip_flow_hash_t_print
854 (vl_api_set_ip_flow_hash_t * mp, void *handle)
858 s = format (0, "SCRIPT: set_ip_flow_hash ");
860 s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
863 s = format (s, "src ");
866 s = format (s, "dst ");
869 s = format (s, "sport ");
872 s = format (s, "dport ");
875 s = format (s, "proto ");
878 s = format (s, "reverse ");
880 if (mp->is_ipv6 != 0)
881 s = format (s, "ipv6 ");
886 static void *vl_api_sw_interface_ip6_set_link_local_address_t_print
887 (vl_api_sw_interface_ip6_set_link_local_address_t * mp, void *handle)
891 s = format (0, "SCRIPT: sw_interface_ip6_set_link_local_address ");
893 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
895 s = format (s, "%U ", format_ip6_address, mp->address);
900 static void *vl_api_sw_interface_ip6nd_ra_prefix_t_print
901 (vl_api_sw_interface_ip6nd_ra_prefix_t * mp, void *handle)
905 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_prefix ");
907 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
909 s = format (s, "%U/%d ", format_ip6_address, mp->address,
912 s = format (s, "val_life %d ", ntohl (mp->val_lifetime));
914 s = format (s, "pref_life %d ", ntohl (mp->pref_lifetime));
917 s = format (s, "def ");
919 if (mp->no_advertise)
920 s = format (s, "noadv ");
923 s = format (s, "offl ");
925 if (mp->no_autoconfig)
926 s = format (s, "noauto ");
929 s = format (s, "nolink ");
932 s = format (s, "isno ");
937 static void *vl_api_sw_interface_ip6nd_ra_config_t_print
938 (vl_api_sw_interface_ip6nd_ra_config_t * mp, void *handle)
942 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_config ");
944 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
946 s = format (s, "maxint %d ", ntohl (mp->max_interval));
948 s = format (s, "minint %d ", ntohl (mp->min_interval));
950 s = format (s, "life %d ", ntohl (mp->lifetime));
952 s = format (s, "count %d ", ntohl (mp->initial_count));
954 s = format (s, "interval %d ", ntohl (mp->initial_interval));
957 s = format (s, "suppress ");
960 s = format (s, "managed ");
963 s = format (s, "other ");
966 s = format (s, "ll ");
968 if (mp->send_unicast)
969 s = format (s, "send ");
972 s = format (s, "cease ");
975 s = format (s, "isno ");
977 if (mp->default_router)
978 s = format (s, "def ");
983 static void *vl_api_set_arp_neighbor_limit_t_print
984 (vl_api_set_arp_neighbor_limit_t * mp, void *handle)
988 s = format (0, "SCRIPT: set_arp_neighbor_limit ");
990 s = format (s, "arp_nbr_limit %d ", ntohl (mp->arp_neighbor_limit));
992 if (mp->is_ipv6 != 0)
993 s = format (s, "ipv6 ");
998 static void *vl_api_l2_patch_add_del_t_print
999 (vl_api_l2_patch_add_del_t * mp, void *handle)
1003 s = format (0, "SCRIPT: l2_patch_add_del ");
1005 s = format (s, "rx_sw_if_index %d ", ntohl (mp->rx_sw_if_index));
1007 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
1009 if (mp->is_add == 0)
1010 s = format (s, "del ");
1015 static void *vl_api_sr_localsid_add_del_t_print
1016 (vl_api_sr_localsid_add_del_t * mp, void *handle)
1018 vnet_main_t *vnm = vnet_get_main ();
1021 s = format (0, "SCRIPT: sr_localsid_add_del ");
1023 switch (mp->behavior)
1025 case SR_BEHAVIOR_END:
1026 s = format (s, "Address: %U\nBehavior: End",
1027 format_ip6_address, (ip6_address_t *) mp->localsid_addr);
1028 s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1033 "Address: %U\nBehavior: X (Endpoint with Layer-3 cross-connect)"
1034 "\nIface: %U\nNext hop: %U", format_ip6_address,
1035 (ip6_address_t *) mp->localsid_addr,
1036 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1037 format_ip6_address, (ip6_address_t *) mp->nh_addr);
1038 s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1040 case SR_BEHAVIOR_DX4:
1043 "Address: %U\nBehavior: DX4 (Endpoint with decapsulation with IPv4 cross-connect)"
1044 "\nIface: %U\nNext hop: %U", format_ip6_address,
1045 (ip6_address_t *) mp->localsid_addr,
1046 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1047 format_ip4_address, (ip4_address_t *) mp->nh_addr);
1049 case SR_BEHAVIOR_DX6:
1052 "Address: %U\nBehavior: DX6 (Endpoint with decapsulation with IPv6 cross-connect)"
1053 "\nIface: %UNext hop: %U", format_ip6_address,
1054 (ip6_address_t *) mp->localsid_addr,
1055 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1056 format_ip6_address, (ip6_address_t *) mp->nh_addr);
1058 case SR_BEHAVIOR_DX2:
1061 "Address: %U\nBehavior: DX2 (Endpoint with decapulation and Layer-2 cross-connect)"
1062 "\nIface: %U", format_ip6_address,
1063 (ip6_address_t *) mp->localsid_addr,
1064 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index));
1066 case SR_BEHAVIOR_DT6:
1069 "Address: %U\nBehavior: DT6 (Endpoint with decapsulation and specific IPv6 table lookup)"
1070 "\nTable: %u", format_ip6_address,
1071 (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table));
1073 case SR_BEHAVIOR_DT4:
1076 "Address: %U\nBehavior: DT4 (Endpoint with decapsulation and specific IPv4 table lookup)"
1077 "\nTable: %u", format_ip6_address,
1078 (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table));
1081 if (mp->behavior >= SR_BEHAVIOR_LAST)
1083 s = format (s, "Address: %U\n Behavior: %u",
1084 format_ip6_address, (ip6_address_t *) mp->localsid_addr,
1088 //Should never get here...
1089 s = format (s, "Internal error");
1095 static void *vl_api_sr_steering_add_del_t_print
1096 (vl_api_sr_steering_add_del_t * mp, void *handle)
1100 s = format (0, "SCRIPT: sr_steering_add_del ");
1102 s = format (s, (mp->is_del ? "Del: True" : "Del: False"));
1104 switch (mp->traffic_type)
1107 s = format (s, "Traffic type: L2 iface: %u", ntohl (mp->sw_if_index));
1110 s = format (s, "Traffic type: IPv4 %U/%u", format_ip4_address,
1111 (ip4_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1114 s = format (s, "Traffic type: IPv6 %U/%u", format_ip6_address,
1115 (ip6_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1118 s = format (s, "Traffic type: Unknown(%u)", mp->traffic_type);
1121 s = format (s, "BindingSID: %U", format_ip6_address,
1122 (ip6_address_t *) mp->bsid_addr);
1124 s = format (s, "SR Policy Index: %u", ntohl (mp->sr_policy_index));
1126 s = format (s, "FIB_table: %u", ntohl (mp->table_id));
1131 static void *vl_api_sr_policy_add_t_print
1132 (vl_api_sr_policy_add_t * mp, void *handle)
1136 ip6_address_t *segments = 0, *seg;
1137 ip6_address_t *this_address = (ip6_address_t *) mp->segments;
1140 for (i = 0; i < mp->n_segments; i++)
1142 vec_add2 (segments, seg, 1);
1143 clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1147 s = format (0, "SCRIPT: sr_policy_add ");
1149 s = format (s, "BSID: %U", format_ip6_address,
1150 (ip6_address_t *) mp->bsid_addr);
1154 (mp->is_encap ? "Behavior: Encapsulation" :
1155 "Behavior: SRH insertion"));
1157 s = format (s, "FIB_table: %u", ntohl (mp->fib_table));
1159 s = format (s, (mp->type ? "Type: Default" : "Type: Spray"));
1161 s = format (s, "SID list weight: %u", ntohl (mp->weight));
1163 s = format (s, "{");
1164 vec_foreach (seg, segments)
1166 s = format (s, "%U, ", format_ip6_address, seg);
1168 s = format (s, "\b\b } ");
1173 static void *vl_api_sr_policy_mod_t_print
1174 (vl_api_sr_policy_mod_t * mp, void *handle)
1179 ip6_address_t *segments = 0, *seg;
1180 ip6_address_t *this_address = (ip6_address_t *) mp->segments;
1183 for (i = 0; i < mp->n_segments; i++)
1185 vec_add2 (segments, seg, 1);
1186 clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1190 s = format (0, "SCRIPT: sr_policy_mod ");
1192 s = format (s, "BSID: %U", format_ip6_address,
1193 (ip6_address_t *) mp->bsid_addr);
1195 s = format (s, "SR Policy index: %u", ntohl (mp->sr_policy_index));
1197 s = format (s, "Operation: %u", mp->operation);
1199 s = format (s, "SID list index: %u", ntohl (mp->sl_index));
1201 s = format (s, "SID list weight: %u", ntohl (mp->weight));
1203 s = format (s, "{");
1204 vec_foreach (seg, segments)
1206 s = format (s, "%U, ", format_ip6_address, seg);
1208 s = format (s, "\b\b } ");
1213 static void *vl_api_sr_policy_del_t_print
1214 (vl_api_sr_policy_del_t * mp, void *handle)
1218 s = format (0, "SCRIPT: sr_policy_del ");
1220 u32 sr_policy_index;
1221 s = format (s, "To be delivered. Good luck.");
1225 static void *vl_api_classify_add_del_table_t_print
1226 (vl_api_classify_add_del_table_t * mp, void *handle)
1231 s = format (0, "SCRIPT: classify_add_del_table ");
1233 if (mp->is_add == 0)
1235 s = format (s, "table %d ", ntohl (mp->table_index));
1236 s = format (s, "%s ", mp->del_chain ? "del-chain" : "del");
1240 s = format (s, "nbuckets %d ", ntohl (mp->nbuckets));
1241 s = format (s, "memory_size %d ", ntohl (mp->memory_size));
1242 s = format (s, "skip %d ", ntohl (mp->skip_n_vectors));
1243 s = format (s, "match %d ", ntohl (mp->match_n_vectors));
1244 s = format (s, "next-table %d ", ntohl (mp->next_table_index));
1245 s = format (s, "miss-next %d ", ntohl (mp->miss_next_index));
1246 s = format (s, "current-data-flag %d ", ntohl (mp->current_data_flag));
1247 if (mp->current_data_flag)
1248 s = format (s, "current-data-offset %d ",
1249 ntohl (mp->current_data_offset));
1250 s = format (s, "mask hex ");
1251 for (i = 0; i < ntohl (mp->match_n_vectors) * sizeof (u32x4); i++)
1252 s = format (s, "%02x", mp->mask[i]);
1259 static void *vl_api_classify_add_del_session_t_print
1260 (vl_api_classify_add_del_session_t * mp, void *handle)
1265 s = format (0, "SCRIPT: classify_add_del_session ");
1267 s = format (s, "table_index %d ", ntohl (mp->table_index));
1268 s = format (s, "hit_next_index %d ", ntohl (mp->hit_next_index));
1269 s = format (s, "opaque_index %d ", ntohl (mp->opaque_index));
1270 s = format (s, "advance %d ", ntohl (mp->advance));
1271 s = format (s, "action %d ", mp->action);
1273 s = format (s, "metadata %d ", ntohl (mp->metadata));
1274 if (mp->is_add == 0)
1275 s = format (s, "del ");
1277 s = format (s, "match hex ");
1278 for (i = 5 * sizeof (u32x4) - 1; i > 0; i--)
1280 if (mp->match[i] != 0)
1287 for (i = 0; i < limit; i++)
1288 s = format (s, "%02x", mp->match[i]);
1293 static void *vl_api_classify_set_interface_ip_table_t_print
1294 (vl_api_classify_set_interface_ip_table_t * mp, void *handle)
1298 s = format (0, "SCRIPT: classify_set_interface_ip_table ");
1301 s = format (s, "ipv6 ");
1303 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1304 s = format (s, "table %d ", ntohl (mp->table_index));
1309 static void *vl_api_classify_set_interface_l2_tables_t_print
1310 (vl_api_classify_set_interface_l2_tables_t * mp, void *handle)
1314 s = format (0, "SCRIPT: classify_set_interface_l2_tables ");
1316 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1317 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1318 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1319 s = format (s, "other-table %d ", ntohl (mp->other_table_index));
1320 s = format (s, "is-input %d ", mp->is_input);
1325 static void *vl_api_add_node_next_t_print
1326 (vl_api_add_node_next_t * mp, void *handle)
1330 s = format (0, "SCRIPT: add_node_next ");
1332 s = format (0, "node %s next %s ", mp->node_name, mp->next_name);
1337 static void *vl_api_l2tpv3_create_tunnel_t_print
1338 (vl_api_l2tpv3_create_tunnel_t * mp, void *handle)
1342 s = format (0, "SCRIPT: l2tpv3_create_tunnel ");
1344 s = format (s, "client_address %U our_address %U ",
1345 format_ip6_address, (ip6_address_t *) (mp->client_address),
1346 format_ip6_address, (ip6_address_t *) (mp->our_address));
1347 s = format (s, "local_session_id %d ", ntohl (mp->local_session_id));
1348 s = format (s, "remote_session_id %d ", ntohl (mp->remote_session_id));
1349 s = format (s, "local_cookie %lld ",
1350 clib_net_to_host_u64 (mp->local_cookie));
1351 s = format (s, "remote_cookie %lld ",
1352 clib_net_to_host_u64 (mp->remote_cookie));
1353 if (mp->l2_sublayer_present)
1354 s = format (s, "l2-sublayer-present ");
1359 static void *vl_api_l2tpv3_set_tunnel_cookies_t_print
1360 (vl_api_l2tpv3_set_tunnel_cookies_t * mp, void *handle)
1364 s = format (0, "SCRIPT: l2tpv3_set_tunnel_cookies ");
1366 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1368 s = format (s, "new_local_cookie %llu ",
1369 clib_net_to_host_u64 (mp->new_local_cookie));
1371 s = format (s, "new_remote_cookie %llu ",
1372 clib_net_to_host_u64 (mp->new_remote_cookie));
1377 static void *vl_api_l2tpv3_interface_enable_disable_t_print
1378 (vl_api_l2tpv3_interface_enable_disable_t * mp, void *handle)
1382 s = format (0, "SCRIPT: l2tpv3_interface_enable_disable ");
1384 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1386 if (mp->enable_disable == 0)
1387 s = format (s, "del ");
1392 static void *vl_api_l2tpv3_set_lookup_key_t_print
1393 (vl_api_l2tpv3_set_lookup_key_t * mp, void *handle)
1396 char *str = "unknown";
1398 s = format (0, "SCRIPT: l2tpv3_set_lookup_key ");
1402 case L2T_LOOKUP_SRC_ADDRESS:
1403 str = "lookup_v6_src";
1405 case L2T_LOOKUP_DST_ADDRESS:
1406 str = "lookup_v6_dst";
1408 case L2T_LOOKUP_SESSION_ID:
1409 str = "lookup_session_id";
1415 s = format (s, "%s ", str);
1420 static void *vl_api_sw_if_l2tpv3_tunnel_dump_t_print
1421 (vl_api_sw_if_l2tpv3_tunnel_dump_t * mp, void *handle)
1425 s = format (0, "SCRIPT: sw_if_l2tpv3_tunnel_dump ");
1430 static void *vl_api_vxlan_add_del_tunnel_t_print
1431 (vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
1434 s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
1436 ip46_address_t src = to_ip46 (mp->is_ipv6, mp->src_address);
1437 ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->dst_address);
1439 u8 is_grp = ip46_address_is_multicast (&dst);
1440 char *dst_name = is_grp ? "group" : "dst";
1442 s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY);
1443 s = format (s, "%s %U ", dst_name, format_ip46_address,
1444 &dst, IP46_TYPE_ANY);
1447 s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1449 if (mp->encap_vrf_id)
1450 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1452 s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1454 s = format (s, "vni %d ", ntohl (mp->vni));
1456 if (mp->is_add == 0)
1457 s = format (s, "del ");
1462 static void *vl_api_vxlan_tunnel_dump_t_print
1463 (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1467 s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1469 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1474 static void *vl_api_gre_add_del_tunnel_t_print
1475 (vl_api_gre_add_del_tunnel_t * mp, void *handle)
1479 s = format (0, "SCRIPT: gre_add_del_tunnel ");
1481 s = format (s, "dst %U ", format_ip46_address,
1482 (ip46_address_t *) & (mp->dst_address),
1483 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1485 s = format (s, "src %U ", format_ip46_address,
1486 (ip46_address_t *) & (mp->src_address),
1487 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1490 s = format (s, "teb ");
1492 if (mp->outer_fib_id)
1493 s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
1495 if (mp->is_add == 0)
1496 s = format (s, "del ");
1501 static void *vl_api_gre_tunnel_dump_t_print
1502 (vl_api_gre_tunnel_dump_t * mp, void *handle)
1506 s = format (0, "SCRIPT: gre_tunnel_dump ");
1508 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1513 static void *vl_api_l2_fib_clear_table_t_print
1514 (vl_api_l2_fib_clear_table_t * mp, void *handle)
1518 s = format (0, "SCRIPT: l2_fib_clear_table ");
1523 static void *vl_api_l2_interface_efp_filter_t_print
1524 (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1528 s = format (0, "SCRIPT: l2_interface_efp_filter ");
1530 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1531 if (mp->enable_disable)
1532 s = format (s, "enable ");
1534 s = format (s, "disable ");
1539 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1540 (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1544 s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1546 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1547 s = format (s, "vtr_op %d ", ntohl (mp->vtr_op));
1548 s = format (s, "push_dot1q %d ", ntohl (mp->push_dot1q));
1549 s = format (s, "tag1 %d ", ntohl (mp->tag1));
1550 s = format (s, "tag2 %d ", ntohl (mp->tag2));
1555 static void *vl_api_create_vhost_user_if_t_print
1556 (vl_api_create_vhost_user_if_t * mp, void *handle)
1560 s = format (0, "SCRIPT: create_vhost_user_if ");
1562 s = format (s, "socket %s ", mp->sock_filename);
1564 s = format (s, "server ");
1566 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1568 s = format (s, "tag %s", mp->tag);
1573 static void *vl_api_modify_vhost_user_if_t_print
1574 (vl_api_modify_vhost_user_if_t * mp, void *handle)
1578 s = format (0, "SCRIPT: modify_vhost_user_if ");
1580 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1581 s = format (s, "socket %s ", mp->sock_filename);
1583 s = format (s, "server ");
1585 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1590 static void *vl_api_delete_vhost_user_if_t_print
1591 (vl_api_delete_vhost_user_if_t * mp, void *handle)
1595 s = format (0, "SCRIPT: delete_vhost_user_if ");
1596 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1601 static void *vl_api_sw_interface_vhost_user_dump_t_print
1602 (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
1606 s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
1611 static void *vl_api_sw_interface_dump_t_print
1612 (vl_api_sw_interface_dump_t * mp, void *handle)
1616 s = format (0, "SCRIPT: sw_interface_dump ");
1618 if (mp->name_filter_valid)
1619 s = format (s, "name_filter %s ", mp->name_filter);
1621 s = format (s, "all ");
1626 static void *vl_api_l2_fib_table_dump_t_print
1627 (vl_api_l2_fib_table_dump_t * mp, void *handle)
1631 s = format (0, "SCRIPT: l2_fib_table_dump ");
1633 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
1638 static void *vl_api_control_ping_t_print
1639 (vl_api_control_ping_t * mp, void *handle)
1643 s = format (0, "SCRIPT: control_ping ");
1648 static void *vl_api_want_interface_events_t_print
1649 (vl_api_want_interface_events_t * mp, void *handle)
1653 s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
1654 ntohl (mp->pid), ntohl (mp->enable_disable));
1660 vl_api_cli_t_print (vl_api_cli_t * mp, void *handle)
1664 s = format (0, "SCRIPT: cli ");
1669 static void *vl_api_cli_inband_t_print
1670 (vl_api_cli_inband_t * mp, void *handle)
1674 s = format (0, "SCRIPT: cli_inband ");
1679 static void *vl_api_memclnt_create_t_print
1680 (vl_api_memclnt_create_t * mp, void *handle)
1684 s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
1689 static void *vl_api_show_version_t_print
1690 (vl_api_show_version_t * mp, void *handle)
1694 s = format (0, "SCRIPT: show_version ");
1699 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
1700 (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
1704 s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
1706 ip46_address_t local = to_ip46 (mp->is_ipv6, mp->local);
1707 ip46_address_t remote = to_ip46 (mp->is_ipv6, mp->remote);
1709 u8 is_grp = ip46_address_is_multicast (&remote);
1710 char *remote_name = is_grp ? "group" : "remote";
1712 s = format (s, "local %U ", format_ip46_address, &local, IP46_TYPE_ANY);
1713 s = format (s, "%s %U ", remote_name, format_ip46_address,
1714 &remote, IP46_TYPE_ANY);
1717 s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1718 s = format (s, "protocol %d ", ntohl (mp->protocol));
1720 s = format (s, "vni %d ", ntohl (mp->vni));
1722 if (mp->is_add == 0)
1723 s = format (s, "del ");
1725 if (mp->encap_vrf_id)
1726 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1728 if (mp->decap_vrf_id)
1729 s = format (s, "decap-vrf-id %d ", ntohl (mp->decap_vrf_id));
1734 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
1735 (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
1739 s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
1741 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1746 static void *vl_api_interface_name_renumber_t_print
1747 (vl_api_interface_name_renumber_t * mp, void *handle)
1751 s = format (0, "SCRIPT: interface_renumber ");
1753 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1755 s = format (s, "new_show_dev_instance %d ",
1756 ntohl (mp->new_show_dev_instance));
1761 static void *vl_api_want_ip4_arp_events_t_print
1762 (vl_api_want_ip4_arp_events_t * mp, void *handle)
1766 s = format (0, "SCRIPT: want_ip4_arp_events ");
1767 s = format (s, "pid %d address %U ", ntohl (mp->pid),
1768 format_ip4_address, &mp->address);
1769 if (mp->enable_disable == 0)
1770 s = format (s, "del ");
1775 static void *vl_api_want_ip6_nd_events_t_print
1776 (vl_api_want_ip6_nd_events_t * mp, void *handle)
1780 s = format (0, "SCRIPT: want_ip6_nd_events ");
1781 s = format (s, "pid %d address %U ", ntohl (mp->pid),
1782 format_ip6_address, mp->address);
1783 if (mp->enable_disable == 0)
1784 s = format (s, "del ");
1789 static void *vl_api_input_acl_set_interface_t_print
1790 (vl_api_input_acl_set_interface_t * mp, void *handle)
1794 s = format (0, "SCRIPT: input_acl_set_interface ");
1796 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1797 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1798 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1799 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
1801 if (mp->is_add == 0)
1802 s = format (s, "del ");
1807 static void *vl_api_ip_address_dump_t_print
1808 (vl_api_ip_address_dump_t * mp, void *handle)
1812 s = format (0, "SCRIPT: ip6_address_dump ");
1813 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1814 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1820 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
1824 s = format (0, "SCRIPT: ip_dump ");
1825 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1830 static void *vl_api_cop_interface_enable_disable_t_print
1831 (vl_api_cop_interface_enable_disable_t * mp, void *handle)
1835 s = format (0, "SCRIPT: cop_interface_enable_disable ");
1836 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1837 if (mp->enable_disable)
1838 s = format (s, "enable ");
1840 s = format (s, "disable ");
1845 static void *vl_api_cop_whitelist_enable_disable_t_print
1846 (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
1850 s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
1851 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1852 s = format (s, "fib-id %d ", ntohl (mp->fib_id));
1854 s = format (s, "ip4 ");
1856 s = format (s, "ip6 ");
1857 if (mp->default_cop)
1858 s = format (s, "default ");
1863 static void *vl_api_af_packet_create_t_print
1864 (vl_api_af_packet_create_t * mp, void *handle)
1868 s = format (0, "SCRIPT: af_packet_create ");
1869 s = format (s, "host_if_name %s ", mp->host_if_name);
1870 if (mp->use_random_hw_addr)
1871 s = format (s, "hw_addr random ");
1873 s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
1878 static void *vl_api_af_packet_delete_t_print
1879 (vl_api_af_packet_delete_t * mp, void *handle)
1883 s = format (0, "SCRIPT: af_packet_delete ");
1884 s = format (s, "host_if_name %s ", mp->host_if_name);
1890 format_policer_action (u8 * s, va_list * va)
1892 u32 action = va_arg (*va, u32);
1893 u32 dscp = va_arg (*va, u32);
1896 if (action == SSE2_QOS_ACTION_DROP)
1897 s = format (s, "drop");
1898 else if (action == SSE2_QOS_ACTION_TRANSMIT)
1899 s = format (s, "transmit");
1900 else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
1902 s = format (s, "mark-and-transmit ");
1905 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
1911 s = format (s, "%s", t);
1917 static void *vl_api_policer_add_del_t_print
1918 (vl_api_policer_add_del_t * mp, void *handle)
1922 s = format (0, "SCRIPT: policer_add_del ");
1923 s = format (s, "name %s ", mp->name);
1924 s = format (s, "cir %d ", mp->cir);
1925 s = format (s, "eir %d ", mp->eir);
1926 s = format (s, "cb %d ", mp->cb);
1927 s = format (s, "eb %d ", mp->eb);
1929 switch (mp->rate_type)
1931 case SSE2_QOS_RATE_KBPS:
1932 s = format (s, "rate_type kbps ");
1934 case SSE2_QOS_RATE_PPS:
1935 s = format (s, "rate_type pps ");
1941 switch (mp->round_type)
1943 case SSE2_QOS_ROUND_TO_CLOSEST:
1944 s = format (s, "round_type closest ");
1946 case SSE2_QOS_ROUND_TO_UP:
1947 s = format (s, "round_type up ");
1949 case SSE2_QOS_ROUND_TO_DOWN:
1950 s = format (s, "round_type down ");
1958 case SSE2_QOS_POLICER_TYPE_1R2C:
1959 s = format (s, "type 1r2c ");
1961 case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
1962 s = format (s, "type 1r3c ");
1964 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
1965 s = format (s, "type 2r3c-2698 ");
1967 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
1968 s = format (s, "type 2r3c-4115 ");
1970 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
1971 s = format (s, "type 2r3c-mef5cf1 ");
1977 s = format (s, "conform_action %U ", format_policer_action,
1978 mp->conform_action_type, mp->conform_dscp);
1979 s = format (s, "exceed_action %U ", format_policer_action,
1980 mp->exceed_action_type, mp->exceed_dscp);
1981 s = format (s, "violate_action %U ", format_policer_action,
1982 mp->violate_action_type, mp->violate_dscp);
1984 if (mp->color_aware)
1985 s = format (s, "color-aware ");
1986 if (mp->is_add == 0)
1987 s = format (s, "del ");
1992 static void *vl_api_policer_dump_t_print
1993 (vl_api_policer_dump_t * mp, void *handle)
1997 s = format (0, "SCRIPT: policer_dump ");
1998 if (mp->match_name_valid)
1999 s = format (s, "name %s ", mp->match_name);
2004 static void *vl_api_policer_classify_set_interface_t_print
2005 (vl_api_policer_classify_set_interface_t * mp, void *handle)
2009 s = format (0, "SCRIPT: policer_classify_set_interface ");
2010 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2011 if (mp->ip4_table_index != ~0)
2012 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2013 if (mp->ip6_table_index != ~0)
2014 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2015 if (mp->l2_table_index != ~0)
2016 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2017 if (mp->is_add == 0)
2018 s = format (s, "del ");
2023 static void *vl_api_policer_classify_dump_t_print
2024 (vl_api_policer_classify_dump_t * mp, void *handle)
2028 s = format (0, "SCRIPT: policer_classify_dump ");
2031 case POLICER_CLASSIFY_TABLE_IP4:
2032 s = format (s, "type ip4 ");
2034 case POLICER_CLASSIFY_TABLE_IP6:
2035 s = format (s, "type ip6 ");
2037 case POLICER_CLASSIFY_TABLE_L2:
2038 s = format (s, "type l2 ");
2047 static void *vl_api_sw_interface_clear_stats_t_print
2048 (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2052 s = format (0, "SCRIPT: sw_interface_clear_stats ");
2053 if (mp->sw_if_index != ~0)
2054 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2059 static void *vl_api_mpls_tunnel_dump_t_print
2060 (vl_api_mpls_tunnel_dump_t * mp, void *handle)
2064 s = format (0, "SCRIPT: mpls_tunnel_dump ");
2066 s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
2071 static void *vl_api_mpls_fib_dump_t_print
2072 (vl_api_mpls_fib_dump_t * mp, void *handle)
2076 s = format (0, "SCRIPT: mpls_fib_decap_dump ");
2081 static void *vl_api_ip_fib_dump_t_print
2082 (vl_api_ip_fib_dump_t * mp, void *handle)
2086 s = format (0, "SCRIPT: ip_fib_dump ");
2091 static void *vl_api_ip6_fib_dump_t_print
2092 (vl_api_ip6_fib_dump_t * mp, void *handle)
2096 s = format (0, "SCRIPT: ip6_fib_dump ");
2101 static void *vl_api_classify_table_ids_t_print
2102 (vl_api_classify_table_ids_t * mp, void *handle)
2106 s = format (0, "SCRIPT: classify_table_ids ");
2111 static void *vl_api_classify_table_by_interface_t_print
2112 (vl_api_classify_table_by_interface_t * mp, void *handle)
2116 s = format (0, "SCRIPT: classify_table_by_interface ");
2117 if (mp->sw_if_index != ~0)
2118 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2123 static void *vl_api_classify_table_info_t_print
2124 (vl_api_classify_table_info_t * mp, void *handle)
2128 s = format (0, "SCRIPT: classify_table_info ");
2129 if (mp->table_id != ~0)
2130 s = format (s, "table_id %d ", ntohl (mp->table_id));
2135 static void *vl_api_classify_session_dump_t_print
2136 (vl_api_classify_session_dump_t * mp, void *handle)
2140 s = format (0, "SCRIPT: classify_session_dump ");
2141 if (mp->table_id != ~0)
2142 s = format (s, "table_id %d ", ntohl (mp->table_id));
2147 static void *vl_api_set_ipfix_exporter_t_print
2148 (vl_api_set_ipfix_exporter_t * mp, void *handle)
2152 s = format (0, "SCRIPT: set_ipfix_exporter ");
2154 s = format (s, "collector-address %U ", format_ip4_address,
2155 (ip4_address_t *) mp->collector_address);
2156 s = format (s, "collector-port %d ", ntohs (mp->collector_port));
2157 s = format (s, "src-address %U ", format_ip4_address,
2158 (ip4_address_t *) mp->src_address);
2159 s = format (s, "vrf-id %d ", ntohl (mp->vrf_id));
2160 s = format (s, "path-mtu %d ", ntohl (mp->path_mtu));
2161 s = format (s, "template-interval %d ", ntohl (mp->template_interval));
2162 s = format (s, "udp-checksum %d ", mp->udp_checksum);
2167 static void *vl_api_ipfix_exporter_dump_t_print
2168 (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2172 s = format (0, "SCRIPT: ipfix_exporter_dump ");
2177 static void *vl_api_set_ipfix_classify_stream_t_print
2178 (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2182 s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2184 s = format (s, "domain-id %d ", ntohl (mp->domain_id));
2185 s = format (s, "src-port %d ", ntohs (mp->src_port));
2190 static void *vl_api_ipfix_classify_stream_dump_t_print
2191 (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2195 s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2200 static void *vl_api_ipfix_classify_table_add_del_t_print
2201 (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2205 s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2207 s = format (s, "table-id %d ", ntohl (mp->table_id));
2208 s = format (s, "ip-version %d ", mp->ip_version);
2209 s = format (s, "transport-protocol %d ", mp->transport_protocol);
2214 static void *vl_api_ipfix_classify_table_dump_t_print
2215 (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2219 s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2224 static void *vl_api_sw_interface_span_enable_disable_t_print
2225 (vl_api_sw_interface_span_enable_disable_t * mp, void *handle)
2229 s = format (0, "SCRIPT: sw_interface_span_enable_disable ");
2230 s = format (s, "src_sw_if_index %u ", ntohl (mp->sw_if_index_from));
2231 s = format (s, "dst_sw_if_index %u ", ntohl (mp->sw_if_index_to));
2236 s = format (s, "disable ");
2239 s = format (s, "rx ");
2242 s = format (s, "tx ");
2246 s = format (s, "both ");
2254 vl_api_sw_interface_span_dump_t_print (vl_api_sw_interface_span_dump_t * mp,
2259 s = format (0, "SCRIPT: sw_interface_span_dump ");
2264 static void *vl_api_get_next_index_t_print
2265 (vl_api_get_next_index_t * mp, void *handle)
2269 s = format (0, "SCRIPT: get_next_index ");
2270 s = format (s, "node-name %s ", mp->node_name);
2271 s = format (s, "next-node-name %s ", mp->next_name);
2276 static void *vl_api_pg_create_interface_t_print
2277 (vl_api_pg_create_interface_t * mp, void *handle)
2281 s = format (0, "SCRIPT: pg_create_interface ");
2282 s = format (0, "if_id %d", ntohl (mp->interface_id));
2287 static void *vl_api_pg_capture_t_print
2288 (vl_api_pg_capture_t * mp, void *handle)
2292 s = format (0, "SCRIPT: pg_capture ");
2293 s = format (0, "if_id %d ", ntohl (mp->interface_id));
2294 s = format (0, "pcap %s", mp->pcap_file_name);
2295 if (mp->count != ~0)
2296 s = format (s, "count %d ", ntohl (mp->count));
2297 if (!mp->is_enabled)
2298 s = format (s, "disable");
2303 static void *vl_api_pg_enable_disable_t_print
2304 (vl_api_pg_enable_disable_t * mp, void *handle)
2308 s = format (0, "SCRIPT: pg_enable_disable ");
2309 if (ntohl (mp->stream_name_length) > 0)
2310 s = format (s, "stream %s", mp->stream_name);
2311 if (!mp->is_enabled)
2312 s = format (s, "disable");
2317 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2318 (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2323 s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2325 s = format (s, "%U/%d ", format_ip6_address, mp->address,
2328 s = format (s, "%U/%d ", format_ip4_address, mp->address,
2331 for (i = 0; i < mp->number_of_ranges; i++)
2333 s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2336 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
2338 if (mp->is_add == 0)
2339 s = format (s, "del ");
2344 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2345 (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2350 s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2352 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2354 if (mp->tcp_out_vrf_id != ~0)
2355 s = format (s, "tcp-out-vrf %d ", ntohl (mp->tcp_out_vrf_id));
2357 if (mp->udp_out_vrf_id != ~0)
2358 s = format (s, "udp-out-vrf %d ", ntohl (mp->udp_out_vrf_id));
2360 if (mp->tcp_in_vrf_id != ~0)
2361 s = format (s, "tcp-in-vrf %d ", ntohl (mp->tcp_in_vrf_id));
2363 if (mp->udp_in_vrf_id != ~0)
2364 s = format (s, "udp-in-vrf %d ", ntohl (mp->udp_in_vrf_id));
2366 if (mp->is_add == 0)
2367 s = format (s, "del ");
2372 static void *vl_api_lisp_enable_disable_t_print
2373 (vl_api_lisp_enable_disable_t * mp, void *handle)
2377 s = format (0, "SCRIPT: lisp_enable_disable %s",
2378 mp->is_en ? "enable" : "disable");
2383 static void *vl_api_gpe_add_del_iface_t_print
2384 (vl_api_gpe_add_del_iface_t * mp, void *handle)
2388 s = format (0, "SCRIPT: gpe_add_del_iface ");
2390 s = format (s, "%s ", mp->is_add ? "up" : "down");
2391 s = format (s, "vni %d ", mp->vni);
2392 s = format (s, "%s %d ", mp->is_l2 ? "bd_id" : "table_id", mp->dp_table);
2397 static void *vl_api_lisp_pitr_set_locator_set_t_print
2398 (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
2402 s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
2405 s = format (s, "locator-set %s ", mp->ls_name);
2407 s = format (s, "del");
2413 format_lisp_flat_eid (u8 * s, va_list * args)
2415 u32 type = va_arg (*args, u32);
2416 u8 *eid = va_arg (*args, u8 *);
2417 u32 eid_len = va_arg (*args, u32);
2422 return format (s, "%U/%d", format_ip4_address, eid, eid_len);
2424 return format (s, "%U/%d", format_ip6_address, eid, eid_len);
2426 return format (s, "%U", format_ethernet_address, eid);
2431 static void *vl_api_lisp_add_del_remote_mapping_t_print
2432 (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
2435 u32 i, rloc_num = 0;
2437 s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
2440 s = format (s, "del-all ");
2442 s = format (s, "%s ", mp->is_add ? "add" : "del");
2443 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2445 s = format (s, "eid %U ", format_lisp_flat_eid,
2446 mp->eid_type, mp->eid, mp->eid_len);
2450 s = format (s, "seid %U ", format_lisp_flat_eid,
2451 mp->eid_type, mp->seid, mp->seid_len);
2454 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
2457 s = format (s, "action %d", mp->action);
2462 static void *vl_api_lisp_add_del_adjacency_t_print
2463 (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
2467 s = format (0, "SCRIPT: lisp_add_del_adjacency ");
2469 s = format (s, "%s ", mp->is_add ? "add" : "del");
2470 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2471 s = format (s, "reid %U leid %U ",
2472 format_lisp_flat_eid, mp->eid_type, mp->reid, mp->reid_len,
2473 format_lisp_flat_eid, mp->eid_type, mp->leid, mp->leid_len);
2478 static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
2479 (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
2483 s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
2486 s = format (s, "%s", mp->locator_set_name);
2488 s = format (s, "del");
2493 static void *vl_api_lisp_eid_table_add_del_map_t_print
2494 (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
2498 s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
2501 s = format (s, "del ");
2503 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2504 s = format (s, "%s %d ",
2505 mp->is_l2 ? "bd_index" : "vrf",
2506 clib_net_to_host_u32 (mp->dp_table));
2510 static void *vl_api_lisp_add_del_local_eid_t_print
2511 (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
2515 s = format (0, "SCRIPT: lisp_add_del_local_eid ");
2518 s = format (s, "del ");
2520 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2521 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
2523 s = format (s, "locator-set %s ", mp->locator_set_name);
2526 u32 key_id = mp->key_id;
2527 s = format (s, "key-id %U", format_hmac_key_id, key_id);
2528 s = format (s, "secret-key %s", mp->key);
2533 static void *vl_api_gpe_add_del_fwd_entry_t_print
2534 (vl_api_gpe_add_del_fwd_entry_t * mp, void *handle)
2538 s = format (0, "SCRIPT: gpe_add_del_fwd_entry TODO");
2543 static void *vl_api_lisp_add_del_map_resolver_t_print
2544 (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
2548 s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
2551 s = format (s, "del ");
2554 s = format (s, "%U ", format_ip6_address, mp->ip_address);
2556 s = format (s, "%U ", format_ip4_address, mp->ip_address);
2561 static void *vl_api_gpe_enable_disable_t_print
2562 (vl_api_gpe_enable_disable_t * mp, void *handle)
2566 s = format (0, "SCRIPT: gpe_enable_disable ");
2568 s = format (s, "%s ", mp->is_en ? "enable" : "disable");
2573 static void *vl_api_lisp_add_del_locator_set_t_print
2574 (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
2579 s = format (0, "SCRIPT: lisp_add_del_locator_set ");
2582 s = format (s, "del ");
2584 s = format (s, "locator-set %s ", mp->locator_set_name);
2586 loc_num = clib_net_to_host_u32 (mp->locator_num);
2591 static void *vl_api_lisp_add_del_locator_t_print
2592 (vl_api_lisp_add_del_locator_t * mp, void *handle)
2596 s = format (0, "SCRIPT: lisp_add_del_locator ");
2599 s = format (s, "del ");
2601 s = format (s, "locator-set %s ", mp->locator_set_name);
2602 s = format (s, "sw_if_index %d ", mp->sw_if_index);
2603 s = format (s, "p %d w %d ", mp->priority, mp->weight);
2608 static void *vl_api_lisp_locator_set_dump_t_print
2609 (vl_api_lisp_locator_set_dump_t * mp, void *handle)
2613 s = format (0, "SCRIPT: lisp_locator_set_dump ");
2614 if (mp->filter == 1)
2615 s = format (s, "local");
2616 else if (mp->filter == 2)
2617 s = format (s, "remote");
2622 static void *vl_api_lisp_locator_dump_t_print
2623 (vl_api_lisp_locator_dump_t * mp, void *handle)
2627 s = format (0, "SCRIPT: lisp_locator_dump ");
2628 if (mp->is_index_set)
2629 s = format (s, "ls_index %d", clib_net_to_host_u32 (mp->ls_index));
2631 s = format (s, "ls_name %s", mp->ls_name);
2636 static void *vl_api_lisp_map_request_mode_t_print
2637 (vl_api_lisp_map_request_mode_t * mp, void *handle)
2641 s = format (0, "SCRIPT: lisp_map_request_mode ");
2646 s = format (s, "dst-only");
2649 s = format (s, "src-dst");
2657 static void *vl_api_lisp_eid_table_dump_t_print
2658 (vl_api_lisp_eid_table_dump_t * mp, void *handle)
2662 s = format (0, "SCRIPT: lisp_eid_table_dump ");
2666 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2667 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
2668 mp->eid, mp->prefix_length);
2672 s = format (s, "local ");
2675 s = format (s, "remote ");
2683 static void *vl_api_lisp_rloc_probe_enable_disable_t_print
2684 (vl_api_lisp_rloc_probe_enable_disable_t * mp, void *handle)
2688 s = format (0, "SCRIPT: lisp_rloc_probe_enable_disable ");
2690 s = format (s, "enable");
2692 s = format (s, "disable");
2697 static void *vl_api_lisp_map_register_enable_disable_t_print
2698 (vl_api_lisp_map_register_enable_disable_t * mp, void *handle)
2702 s = format (0, "SCRIPT: lisp_map_register_enable_disable ");
2704 s = format (s, "enable");
2706 s = format (s, "disable");
2711 static void *vl_api_lisp_adjacencies_get_t_print
2712 (vl_api_lisp_adjacencies_get_t * mp, void *handle)
2716 s = format (0, "SCRIPT: lisp_adjacencies_get ");
2717 s = format (s, "vni %d", clib_net_to_host_u32 (mp->vni));
2722 static void *vl_api_lisp_eid_table_map_dump_t_print
2723 (vl_api_lisp_eid_table_map_dump_t * mp, void *handle)
2727 s = format (0, "SCRIPT: lisp_eid_table_map_dump ");
2730 s = format (s, "l2");
2732 s = format (s, "l3");
2737 static void *vl_api_ipsec_gre_add_del_tunnel_t_print
2738 (vl_api_ipsec_gre_add_del_tunnel_t * mp, void *handle)
2742 s = format (0, "SCRIPT: ipsec_gre_add_del_tunnel ");
2744 s = format (s, "dst %U ", format_ip4_address,
2745 (ip4_address_t *) & (mp->dst_address));
2747 s = format (s, "src %U ", format_ip4_address,
2748 (ip4_address_t *) & (mp->src_address));
2750 s = format (s, "local_sa %d ", ntohl (mp->local_sa_id));
2752 s = format (s, "remote_sa %d ", ntohl (mp->remote_sa_id));
2754 if (mp->is_add == 0)
2755 s = format (s, "del ");
2760 static void *vl_api_ipsec_gre_tunnel_dump_t_print
2761 (vl_api_ipsec_gre_tunnel_dump_t * mp, void *handle)
2765 s = format (0, "SCRIPT: ipsec_gre_tunnel_dump ");
2767 if (mp->sw_if_index != ~0)
2768 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2773 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
2774 (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
2777 u32 vtr_op = ntohl (mp->vtr_op);
2779 s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
2781 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2782 s = format (s, "vtr_op %d ", vtr_op);
2783 if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
2785 if (vtr_op == L2_VTR_TRANSLATE_2_2)
2786 s = format (s, "%d ", ntohs (mp->outer_tag));
2787 s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
2788 s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
2789 s = format (s, "sid %d ", ntohl (mp->i_sid));
2790 s = format (s, "vlanid %d ", ntohs (mp->b_vlanid));
2796 static void *vl_api_flow_classify_set_interface_t_print
2797 (vl_api_flow_classify_set_interface_t * mp, void *handle)
2801 s = format (0, "SCRIPT: flow_classify_set_interface ");
2802 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2803 if (mp->ip4_table_index != ~0)
2804 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2805 if (mp->ip6_table_index != ~0)
2806 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2807 if (mp->is_add == 0)
2808 s = format (s, "del ");
2814 vl_api_punt_t_print (vl_api_punt_t * mp, void *handle)
2818 s = format (0, "SCRIPT: punt ");
2820 if (mp->ipv != (u8) ~ 0)
2821 s = format (s, "ip %d ", mp->ipv);
2823 s = format (s, "protocol %d ", mp->l4_protocol);
2825 if (mp->l4_port != (u16) ~ 0)
2826 s = format (s, "port %d ", ntohs (mp->l4_port));
2829 s = format (s, "del ");
2834 static void *vl_api_flow_classify_dump_t_print
2835 (vl_api_flow_classify_dump_t * mp, void *handle)
2839 s = format (0, "SCRIPT: flow_classify_dump ");
2842 case FLOW_CLASSIFY_TABLE_IP4:
2843 s = format (s, "type ip4 ");
2845 case FLOW_CLASSIFY_TABLE_IP6:
2846 s = format (s, "type ip6 ");
2855 static void *vl_api_get_first_msg_id_t_print
2856 (vl_api_get_first_msg_id_t * mp, void *handle)
2860 s = format (0, "SCRIPT: get_first_msg_id %s ", mp->name);
2865 static void *vl_api_ioam_enable_t_print
2866 (vl_api_ioam_enable_t * mp, void *handle)
2870 s = format (0, "SCRIPT: ioam_enable ");
2872 if (mp->trace_enable)
2873 s = format (s, "trace enabled");
2876 s = format (s, "POT enabled");
2879 s = format (s, "Seqno enabled");
2882 s = format (s, "Analyse enabled");
2887 static void *vl_api_ioam_disable_t_print
2888 (vl_api_ioam_disable_t * mp, void *handle)
2892 s = format (0, "SCRIPT: ioam_disable ");
2893 s = format (s, "trace disabled");
2894 s = format (s, "POT disabled");
2895 s = format (s, "Seqno disabled");
2896 s = format (s, "Analyse disabled");
2901 static void *vl_api_feature_enable_disable_t_print
2902 (vl_api_feature_enable_disable_t * mp, void *handle)
2906 s = format (0, "SCRIPT: feature_enable_disable ");
2907 s = format (s, "arc_name %s ", mp->arc_name);
2908 s = format (s, "feature_name %s ", mp->feature_name);
2909 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2911 s = format (s, "disable");
2916 static void *vl_api_sw_interface_tag_add_del_t_print
2917 (vl_api_sw_interface_tag_add_del_t * mp, void *handle)
2921 s = format (0, "SCRIPT: sw_interface_tag_add_del ");
2922 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2924 s = format (s, "tag %s ", mp->tag);
2926 s = format (s, "del ");
2931 static void *vl_api_sw_interface_set_mtu_t_print
2932 (vl_api_sw_interface_set_mtu_t * mp, void *handle)
2936 s = format (0, "SCRIPT: sw_interface_set_mtu ");
2937 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2938 s = format (s, "tag %d ", ntohs (mp->mtu));
2943 static void *vl_api_p2p_ethernet_add_t_print
2944 (vl_api_p2p_ethernet_add_t * mp, void *handle)
2948 s = format (0, "SCRIPT: p2p_ethernet_add ");
2949 s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
2950 s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
2955 static void *vl_api_p2p_ethernet_del_t_print
2956 (vl_api_p2p_ethernet_del_t * mp, void *handle)
2960 s = format (0, "SCRIPT: p2p_ethernet_del ");
2961 s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
2962 s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
2967 #define foreach_custom_print_no_arg_function \
2968 _(lisp_eid_table_vni_dump) \
2969 _(lisp_map_resolver_dump) \
2970 _(lisp_map_server_dump) \
2971 _(show_lisp_rloc_probe_state) \
2972 _(show_lisp_map_register_state) \
2973 _(show_lisp_map_request_mode)
2976 static void * vl_api_ ## f ## _t_print \
2977 (vl_api_ ## f ## _t * mp, void * handle) \
2980 s = format (0, "SCRIPT: " #f ); \
2983 foreach_custom_print_no_arg_function
2985 #define foreach_custom_print_function \
2986 _(CREATE_LOOPBACK, create_loopback) \
2987 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \
2988 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
2989 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \
2990 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \
2991 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \
2992 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \
2993 _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass) \
2994 _(TAP_CONNECT, tap_connect) \
2995 _(TAP_MODIFY, tap_modify) \
2996 _(TAP_DELETE, tap_delete) \
2997 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \
2998 _(IP_ADD_DEL_ROUTE, ip_add_del_route) \
2999 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
3000 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
3001 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \
3002 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered) \
3003 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \
3004 _(RESET_VRF, reset_vrf) \
3005 _(CREATE_VLAN_SUBIF, create_vlan_subif) \
3006 _(CREATE_SUBIF, create_subif) \
3007 _(OAM_ADD_DEL, oam_add_del) \
3008 _(RESET_FIB, reset_fib) \
3009 _(DHCP_PROXY_CONFIG, dhcp_proxy_config) \
3010 _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss) \
3011 _(SET_IP_FLOW_HASH, set_ip_flow_hash) \
3012 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \
3013 sw_interface_ip6_set_link_local_address) \
3014 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix) \
3015 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config) \
3016 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \
3017 _(L2_PATCH_ADD_DEL, l2_patch_add_del) \
3018 _(SR_LOCALSID_ADD_DEL, sr_localsid_add_del) \
3019 _(SR_STEERING_ADD_DEL, sr_steering_add_del) \
3020 _(SR_POLICY_ADD, sr_policy_add) \
3021 _(SR_POLICY_MOD, sr_policy_mod) \
3022 _(SR_POLICY_DEL, sr_policy_del) \
3023 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \
3024 _(L2FIB_ADD_DEL, l2fib_add_del) \
3025 _(L2FIB_FLUSH_ALL, l2fib_flush_all) \
3026 _(L2FIB_FLUSH_BD, l2fib_flush_bd) \
3027 _(L2FIB_FLUSH_INT, l2fib_flush_int) \
3028 _(L2_FLAGS, l2_flags) \
3029 _(BRIDGE_FLAGS, bridge_flags) \
3030 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table) \
3031 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session) \
3032 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \
3033 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
3034 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
3035 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) \
3036 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \
3037 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \
3038 _(ADD_NODE_NEXT, add_node_next) \
3039 _(DHCP_CLIENT_CONFIG, dhcp_client_config) \
3040 _(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel) \
3041 _(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies) \
3042 _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable) \
3043 _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \
3044 _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \
3045 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \
3046 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \
3047 _(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel) \
3048 _(GRE_TUNNEL_DUMP, gre_tunnel_dump) \
3049 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \
3050 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \
3051 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \
3052 _(CREATE_VHOST_USER_IF, create_vhost_user_if) \
3053 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if) \
3054 _(DELETE_VHOST_USER_IF, delete_vhost_user_if) \
3055 _(SW_INTERFACE_DUMP, sw_interface_dump) \
3056 _(CONTROL_PING, control_ping) \
3057 _(WANT_INTERFACE_EVENTS, want_interface_events) \
3059 _(CLI_INBAND, cli_inband) \
3060 _(MEMCLNT_CREATE, memclnt_create) \
3061 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump) \
3062 _(SHOW_VERSION, show_version) \
3063 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
3064 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel) \
3065 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump) \
3066 _(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
3067 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
3068 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events) \
3069 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
3070 _(IP_ADDRESS_DUMP, ip_address_dump) \
3071 _(IP_DUMP, ip_dump) \
3072 _(DELETE_LOOPBACK, delete_loopback) \
3073 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \
3074 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \
3075 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \
3076 _(AF_PACKET_CREATE, af_packet_create) \
3077 _(AF_PACKET_DELETE, af_packet_delete) \
3078 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) \
3079 _(MPLS_FIB_DUMP, mpls_fib_dump) \
3080 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \
3081 _(CLASSIFY_TABLE_IDS,classify_table_ids) \
3082 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface) \
3083 _(CLASSIFY_TABLE_INFO,classify_table_info) \
3084 _(CLASSIFY_SESSION_DUMP,classify_session_dump) \
3085 _(SET_IPFIX_EXPORTER, set_ipfix_exporter) \
3086 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump) \
3087 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream) \
3088 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump) \
3089 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del) \
3090 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump) \
3091 _(SW_INTERFACE_SPAN_ENABLE_DISABLE, sw_interface_span_enable_disable) \
3092 _(SW_INTERFACE_SPAN_DUMP, sw_interface_span_dump) \
3093 _(GET_NEXT_INDEX, get_next_index) \
3094 _(PG_CREATE_INTERFACE,pg_create_interface) \
3095 _(PG_CAPTURE, pg_capture) \
3096 _(PG_ENABLE_DISABLE, pg_enable_disable) \
3097 _(POLICER_ADD_DEL, policer_add_del) \
3098 _(POLICER_DUMP, policer_dump) \
3099 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface) \
3100 _(POLICER_CLASSIFY_DUMP, policer_classify_dump) \
3101 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \
3102 ip_source_and_port_range_check_add_del) \
3103 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \
3104 ip_source_and_port_range_check_interface_add_del) \
3105 _(LISP_ENABLE_DISABLE, lisp_enable_disable) \
3106 _(GPE_ENABLE_DISABLE, gpe_enable_disable) \
3107 _(GPE_ADD_DEL_IFACE, gpe_add_del_iface) \
3108 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
3109 _(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
3110 _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
3111 _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
3112 _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
3113 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
3114 lisp_add_del_map_request_itr_rlocs) \
3115 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
3116 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
3117 _(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry) \
3118 _(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
3119 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
3120 _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
3121 _(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
3122 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
3123 _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
3124 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
3125 _(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
3126 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
3127 _(LISP_LOCATOR_DUMP, lisp_locator_dump) \
3128 _(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \
3129 _(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \
3130 _(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \
3131 _(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \
3132 _(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \
3133 _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel) \
3134 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump) \
3135 _(DELETE_SUBIF, delete_subif) \
3136 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \
3138 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface) \
3139 _(FLOW_CLASSIFY_DUMP, flow_classify_dump) \
3140 _(GET_FIRST_MSG_ID, get_first_msg_id) \
3141 _(IOAM_ENABLE, ioam_enable) \
3142 _(IOAM_DISABLE, ioam_disable) \
3143 _(IP_FIB_DUMP, ip_fib_dump) \
3144 _(IP6_FIB_DUMP, ip6_fib_dump) \
3145 _(FEATURE_ENABLE_DISABLE, feature_enable_disable) \
3146 _(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del) \
3147 _(SW_INTERFACE_SET_MTU, sw_interface_set_mtu) \
3148 _(P2P_ETHERNET_ADD, p2p_ethernet_add) \
3149 _(P2P_ETHERNET_DEL, p2p_ethernet_del)
3151 vl_msg_api_custom_dump_configure (api_main_t * am)
3153 #define _(n,f) am->msg_print_handlers[VL_API_##n] \
3154 = (void *) vl_api_##f##_t_print;
3155 foreach_custom_print_function;
3160 * fd.io coding-style-patch-verification: ON
3163 * eval: (c-set-style "gnu")