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));
376 if (flags & L2_LEARN)
377 s = format (s, "learn ");
379 s = format (s, "forward ");
380 if (flags & L2_FLOOD)
381 s = format (s, "flood ");
382 if (flags & L2_UU_FLOOD)
383 s = format (s, "uu-flood ");
384 if (flags & L2_ARP_TERM)
385 s = format (s, "arp-term ");
388 s = format (s, "clear ");
393 static void *vl_api_bridge_flags_t_print
394 (vl_api_bridge_flags_t * mp, void *handle)
397 u32 flags = ntohl (mp->feature_bitmap);
399 s = format (0, "SCRIPT: bridge_flags ");
401 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
403 if (flags & L2_LEARN)
404 s = format (s, "learn ");
406 s = format (s, "forward ");
407 if (flags & L2_FLOOD)
408 s = format (s, "flood ");
409 if (flags & L2_UU_FLOOD)
410 s = format (s, "uu-flood ");
411 if (flags & L2_ARP_TERM)
412 s = format (s, "arp-term ");
415 s = format (s, "clear ");
420 static void *vl_api_bd_ip_mac_add_del_t_print
421 (vl_api_bd_ip_mac_add_del_t * mp, void *handle)
425 s = format (0, "SCRIPT: bd_ip_mac_add_del ");
426 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
429 s = format (s, "%U ", format_ip6_address,
430 (ip6_address_t *) mp->ip_address);
432 s = format (s, "%U ", format_ip4_address,
433 (ip4_address_t *) mp->ip_address);
435 s = format (s, "%U ", format_ethernet_address, mp->mac_address);
437 s = format (s, "del ");
442 static void *vl_api_tap_connect_t_print
443 (vl_api_tap_connect_t * mp, void *handle)
448 memset (null_mac, 0, sizeof (null_mac));
450 s = format (0, "SCRIPT: tap_connect ");
451 s = format (s, "tapname %s ", mp->tap_name);
452 if (mp->use_random_mac)
453 s = format (s, "random-mac ");
455 s = format (s, "tag %s ", mp->tag);
456 if (memcmp (mp->mac_address, null_mac, 6))
457 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
458 if (mp->ip4_address_set)
459 s = format (s, "address %U/%d ", format_ip4_address, mp->ip4_address,
461 if (mp->ip6_address_set)
462 s = format (s, "address %U/%d ", format_ip6_address, mp->ip6_address,
467 static void *vl_api_tap_modify_t_print
468 (vl_api_tap_modify_t * mp, void *handle)
473 memset (null_mac, 0, sizeof (null_mac));
475 s = format (0, "SCRIPT: tap_modify ");
476 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
477 s = format (s, "tapname %s ", mp->tap_name);
478 if (mp->use_random_mac)
479 s = format (s, "random-mac ");
481 if (memcmp (mp->mac_address, null_mac, 6))
482 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
487 static void *vl_api_tap_delete_t_print
488 (vl_api_tap_delete_t * mp, void *handle)
492 s = format (0, "SCRIPT: tap_delete ");
493 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
498 static void *vl_api_sw_interface_tap_dump_t_print
499 (vl_api_sw_interface_tap_dump_t * mp, void *handle)
503 s = format (0, "SCRIPT: sw_interface_tap_dump ");
509 static void *vl_api_ip_add_del_route_t_print
510 (vl_api_ip_add_del_route_t * mp, void *handle)
514 s = format (0, "SCRIPT: ip_add_del_route ");
516 s = format (s, "del ");
518 if (mp->next_hop_sw_if_index)
519 s = format (s, "sw_if_index %d ", ntohl (mp->next_hop_sw_if_index));
522 s = format (s, "%U/%d ", format_ip6_address, mp->dst_address,
523 mp->dst_address_length);
525 s = format (s, "%U/%d ", format_ip4_address, mp->dst_address,
526 mp->dst_address_length);
528 s = format (s, "local ");
529 else if (mp->is_drop)
530 s = format (s, "drop ");
531 else if (mp->is_classify)
532 s = format (s, "classify %d", ntohl (mp->classify_table_index));
536 s = format (s, "via %U ", format_ip6_address, mp->next_hop_address);
538 s = format (s, "via %U ", format_ip4_address, mp->next_hop_address);
541 if (mp->table_id != 0)
542 s = format (s, "vrf %d ", ntohl (mp->table_id));
544 if (mp->create_vrf_if_needed)
545 s = format (s, "create-vrf ");
547 if (mp->next_hop_weight != 1)
548 s = format (s, "weight %d ", mp->next_hop_weight);
551 s = format (s, "not-last ");
553 if (mp->is_multipath)
554 s = format (s, "multipath ");
556 if (mp->is_multipath)
557 s = format (s, "multipath ");
559 if (mp->next_hop_table_id)
560 s = format (s, "lookup-in-vrf %d ", ntohl (mp->next_hop_table_id));
565 static void *vl_api_proxy_arp_add_del_t_print
566 (vl_api_proxy_arp_add_del_t * mp, void *handle)
570 s = format (0, "SCRIPT: proxy_arp_add_del ");
572 s = format (s, "%U - %U ", format_ip4_address, mp->low_address,
573 format_ip4_address, mp->hi_address);
576 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
579 s = format (s, "del ");
584 static void *vl_api_proxy_arp_intfc_enable_disable_t_print
585 (vl_api_proxy_arp_intfc_enable_disable_t * mp, void *handle)
589 s = format (0, "SCRIPT: proxy_arp_intfc_enable_disable ");
591 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
593 s = format (s, "enable %d ", mp->enable_disable);
598 static void *vl_api_mpls_tunnel_add_del_t_print
599 (vl_api_mpls_tunnel_add_del_t * mp, void *handle)
603 s = format (0, "SCRIPT: mpls_tunnel_add_del ");
605 if (mp->mt_next_hop_sw_if_index)
606 s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index));
608 if (mp->mt_next_hop_proto_is_ip4)
609 s = format (s, "%U ", format_ip4_address, mp->mt_next_hop);
611 s = format (s, "%U ", format_ip6_address, mp->mt_next_hop);
614 s = format (s, "l2-only ");
616 if (mp->mt_is_add == 0)
617 s = format (s, "del ");
622 static void *vl_api_sw_interface_set_unnumbered_t_print
623 (vl_api_sw_interface_set_unnumbered_t * mp, void *handle)
627 s = format (0, "SCRIPT: sw_interface_set_unnumbered ");
629 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
631 s = format (s, "unnum_if_index %d ", ntohl (mp->unnumbered_sw_if_index));
634 s = format (s, "del ");
639 static void *vl_api_ip_neighbor_add_del_t_print
640 (vl_api_ip_neighbor_add_del_t * mp, void *handle)
645 memset (null_mac, 0, sizeof (null_mac));
647 s = format (0, "SCRIPT: ip_neighbor_add_del ");
649 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
652 s = format (s, "is_static ");
654 if (mp->is_no_adj_fib)
655 s = format (s, "is_no_fib_entry ");
657 if (memcmp (mp->mac_address, null_mac, 6))
658 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
662 format (s, "dst %U ", format_ip6_address,
663 (ip6_address_t *) mp->dst_address);
666 format (s, "dst %U ", format_ip4_address,
667 (ip4_address_t *) mp->dst_address);
670 s = format (s, "del ");
676 vl_api_reset_vrf_t_print (vl_api_reset_vrf_t * mp, void *handle)
680 s = format (0, "SCRIPT: reset_vrf ");
683 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
685 if (mp->is_ipv6 != 0)
686 s = format (s, "ipv6 ");
691 static void *vl_api_create_vlan_subif_t_print
692 (vl_api_create_vlan_subif_t * mp, void *handle)
696 s = format (0, "SCRIPT: create_vlan_subif ");
699 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
702 s = format (s, "vlan_id %d ", ntohl (mp->vlan_id));
707 #define foreach_create_subif_bit \
714 _(outer_vlan_id_any) \
717 static void *vl_api_create_subif_t_print
718 (vl_api_create_subif_t * mp, void *handle)
722 s = format (0, "SCRIPT: create_subif ");
724 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
726 s = format (s, "sub_id %d ", ntohl (mp->sub_id));
728 if (mp->outer_vlan_id)
729 s = format (s, "outer_vlan_id %d ", ntohs (mp->outer_vlan_id));
731 if (mp->inner_vlan_id)
732 s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
734 #define _(a) if (mp->a) s = format (s, "%s ", #a);
735 foreach_create_subif_bit;
741 static void *vl_api_delete_subif_t_print
742 (vl_api_delete_subif_t * mp, void *handle)
746 s = format (0, "SCRIPT: delete_subif ");
747 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
752 static void *vl_api_oam_add_del_t_print
753 (vl_api_oam_add_del_t * mp, void *handle)
757 s = format (0, "SCRIPT: oam_add_del ");
760 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
762 s = format (s, "src %U ", format_ip4_address, mp->src_address);
764 s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
767 s = format (s, "del ");
773 vl_api_reset_fib_t_print (vl_api_reset_fib_t * mp, void *handle)
777 s = format (0, "SCRIPT: reset_fib ");
780 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
782 if (mp->is_ipv6 != 0)
783 s = format (s, "ipv6 ");
788 static void *vl_api_dhcp_proxy_config_t_print
789 (vl_api_dhcp_proxy_config_t * mp, void *handle)
793 s = format (0, "SCRIPT: dhcp_proxy_config_2 ");
795 s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id));
796 s = format (s, "server_vrf_id %d ", ntohl (mp->server_vrf_id));
800 s = format (s, "svr %U ", format_ip6_address,
801 (ip6_address_t *) mp->dhcp_server);
802 s = format (s, "src %U ", format_ip6_address,
803 (ip6_address_t *) mp->dhcp_src_address);
807 s = format (s, "svr %U ", format_ip4_address,
808 (ip4_address_t *) mp->dhcp_server);
809 s = format (s, "src %U ", format_ip4_address,
810 (ip4_address_t *) mp->dhcp_src_address);
813 s = format (s, "del ");
818 static void *vl_api_dhcp_proxy_set_vss_t_print
819 (vl_api_dhcp_proxy_set_vss_t * mp, void *handle)
823 s = format (0, "SCRIPT: dhcp_proxy_set_vss ");
825 s = format (s, "tbl_id %d ", ntohl (mp->tbl_id));
827 s = format (s, "fib_id %d ", ntohl (mp->fib_id));
829 s = format (s, "oui %d ", ntohl (mp->oui));
831 if (mp->is_ipv6 != 0)
832 s = format (s, "ipv6 ");
835 s = format (s, "del ");
840 static void *vl_api_dhcp_client_config_t_print
841 (vl_api_dhcp_client_config_t * mp, void *handle)
845 s = format (0, "SCRIPT: dhcp_client_config ");
847 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
849 s = format (s, "hostname %s ", mp->hostname);
851 s = format (s, "want_dhcp_event %d ", mp->want_dhcp_event);
853 s = format (s, "pid %d ", ntohl (mp->pid));
856 s = format (s, "del ");
862 static void *vl_api_set_ip_flow_hash_t_print
863 (vl_api_set_ip_flow_hash_t * mp, void *handle)
867 s = format (0, "SCRIPT: set_ip_flow_hash ");
869 s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
872 s = format (s, "src ");
875 s = format (s, "dst ");
878 s = format (s, "sport ");
881 s = format (s, "dport ");
884 s = format (s, "proto ");
887 s = format (s, "reverse ");
889 if (mp->is_ipv6 != 0)
890 s = format (s, "ipv6 ");
895 static void *vl_api_sw_interface_ip6_set_link_local_address_t_print
896 (vl_api_sw_interface_ip6_set_link_local_address_t * mp, void *handle)
900 s = format (0, "SCRIPT: sw_interface_ip6_set_link_local_address ");
902 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
904 s = format (s, "%U ", format_ip6_address, mp->address);
909 static void *vl_api_sw_interface_ip6nd_ra_prefix_t_print
910 (vl_api_sw_interface_ip6nd_ra_prefix_t * mp, void *handle)
914 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_prefix ");
916 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
918 s = format (s, "%U/%d ", format_ip6_address, mp->address,
921 s = format (s, "val_life %d ", ntohl (mp->val_lifetime));
923 s = format (s, "pref_life %d ", ntohl (mp->pref_lifetime));
926 s = format (s, "def ");
928 if (mp->no_advertise)
929 s = format (s, "noadv ");
932 s = format (s, "offl ");
934 if (mp->no_autoconfig)
935 s = format (s, "noauto ");
938 s = format (s, "nolink ");
941 s = format (s, "isno ");
946 static void *vl_api_sw_interface_ip6nd_ra_config_t_print
947 (vl_api_sw_interface_ip6nd_ra_config_t * mp, void *handle)
951 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_config ");
953 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
955 s = format (s, "maxint %d ", ntohl (mp->max_interval));
957 s = format (s, "minint %d ", ntohl (mp->min_interval));
959 s = format (s, "life %d ", ntohl (mp->lifetime));
961 s = format (s, "count %d ", ntohl (mp->initial_count));
963 s = format (s, "interval %d ", ntohl (mp->initial_interval));
966 s = format (s, "suppress ");
969 s = format (s, "managed ");
972 s = format (s, "other ");
975 s = format (s, "ll ");
977 if (mp->send_unicast)
978 s = format (s, "send ");
981 s = format (s, "cease ");
984 s = format (s, "isno ");
986 if (mp->default_router)
987 s = format (s, "def ");
992 static void *vl_api_set_arp_neighbor_limit_t_print
993 (vl_api_set_arp_neighbor_limit_t * mp, void *handle)
997 s = format (0, "SCRIPT: set_arp_neighbor_limit ");
999 s = format (s, "arp_nbr_limit %d ", ntohl (mp->arp_neighbor_limit));
1001 if (mp->is_ipv6 != 0)
1002 s = format (s, "ipv6 ");
1007 static void *vl_api_l2_patch_add_del_t_print
1008 (vl_api_l2_patch_add_del_t * mp, void *handle)
1012 s = format (0, "SCRIPT: l2_patch_add_del ");
1014 s = format (s, "rx_sw_if_index %d ", ntohl (mp->rx_sw_if_index));
1016 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
1018 if (mp->is_add == 0)
1019 s = format (s, "del ");
1024 static void *vl_api_sr_localsid_add_del_t_print
1025 (vl_api_sr_localsid_add_del_t * mp, void *handle)
1027 vnet_main_t *vnm = vnet_get_main ();
1030 s = format (0, "SCRIPT: sr_localsid_add_del ");
1032 switch (mp->behavior)
1034 case SR_BEHAVIOR_END:
1035 s = format (s, "Address: %U\nBehavior: End",
1036 format_ip6_address, (ip6_address_t *) mp->localsid_addr);
1037 s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1042 "Address: %U\nBehavior: X (Endpoint with Layer-3 cross-connect)"
1043 "\nIface: %U\nNext hop: %U", format_ip6_address,
1044 (ip6_address_t *) mp->localsid_addr,
1045 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1046 format_ip6_address, (ip6_address_t *) mp->nh_addr);
1047 s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1049 case SR_BEHAVIOR_DX4:
1052 "Address: %U\nBehavior: DX4 (Endpoint with decapsulation with IPv4 cross-connect)"
1053 "\nIface: %U\nNext 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_ip4_address, (ip4_address_t *) mp->nh_addr);
1058 case SR_BEHAVIOR_DX6:
1061 "Address: %U\nBehavior: DX6 (Endpoint with decapsulation with IPv6 cross-connect)"
1062 "\nIface: %UNext 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);
1067 case SR_BEHAVIOR_DX2:
1070 "Address: %U\nBehavior: DX2 (Endpoint with decapulation and Layer-2 cross-connect)"
1071 "\nIface: %U", format_ip6_address,
1072 (ip6_address_t *) mp->localsid_addr,
1073 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index));
1075 case SR_BEHAVIOR_DT6:
1078 "Address: %U\nBehavior: DT6 (Endpoint with decapsulation and specific IPv6 table lookup)"
1079 "\nTable: %u", format_ip6_address,
1080 (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table));
1082 case SR_BEHAVIOR_DT4:
1085 "Address: %U\nBehavior: DT4 (Endpoint with decapsulation and specific IPv4 table lookup)"
1086 "\nTable: %u", format_ip6_address,
1087 (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table));
1090 if (mp->behavior >= SR_BEHAVIOR_LAST)
1092 s = format (s, "Address: %U\n Behavior: %u",
1093 format_ip6_address, (ip6_address_t *) mp->localsid_addr,
1097 //Should never get here...
1098 s = format (s, "Internal error");
1104 static void *vl_api_sr_steering_add_del_t_print
1105 (vl_api_sr_steering_add_del_t * mp, void *handle)
1109 s = format (0, "SCRIPT: sr_steering_add_del ");
1111 s = format (s, (mp->is_del ? "Del: True" : "Del: False"));
1113 switch (mp->traffic_type)
1116 s = format (s, "Traffic type: L2 iface: %u", ntohl (mp->sw_if_index));
1119 s = format (s, "Traffic type: IPv4 %U/%u", format_ip4_address,
1120 (ip4_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1123 s = format (s, "Traffic type: IPv6 %U/%u", format_ip6_address,
1124 (ip6_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1127 s = format (s, "Traffic type: Unknown(%u)", mp->traffic_type);
1130 s = format (s, "BindingSID: %U", format_ip6_address,
1131 (ip6_address_t *) mp->bsid_addr);
1133 s = format (s, "SR Policy Index: %u", ntohl (mp->sr_policy_index));
1135 s = format (s, "FIB_table: %u", ntohl (mp->table_id));
1140 static void *vl_api_sr_policy_add_t_print
1141 (vl_api_sr_policy_add_t * mp, void *handle)
1145 ip6_address_t *segments = 0, *seg;
1146 ip6_address_t *this_address = (ip6_address_t *) mp->segments;
1149 for (i = 0; i < mp->n_segments; i++)
1151 vec_add2 (segments, seg, 1);
1152 clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1156 s = format (0, "SCRIPT: sr_policy_add ");
1158 s = format (s, "BSID: %U", format_ip6_address,
1159 (ip6_address_t *) mp->bsid_addr);
1163 (mp->is_encap ? "Behavior: Encapsulation" :
1164 "Behavior: SRH insertion"));
1166 s = format (s, "FIB_table: %u", ntohl (mp->fib_table));
1168 s = format (s, (mp->type ? "Type: Default" : "Type: Spray"));
1170 s = format (s, "SID list weight: %u", ntohl (mp->weight));
1172 s = format (s, "{");
1173 vec_foreach (seg, segments)
1175 s = format (s, "%U, ", format_ip6_address, seg);
1177 s = format (s, "\b\b } ");
1182 static void *vl_api_sr_policy_mod_t_print
1183 (vl_api_sr_policy_mod_t * mp, void *handle)
1187 ip6_address_t *segments = 0, *seg;
1188 ip6_address_t *this_address = (ip6_address_t *) mp->segments;
1191 for (i = 0; i < mp->n_segments; i++)
1193 vec_add2 (segments, seg, 1);
1194 clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1198 s = format (0, "SCRIPT: sr_policy_mod ");
1200 s = format (s, "BSID: %U", format_ip6_address,
1201 (ip6_address_t *) mp->bsid_addr);
1203 s = format (s, "SR Policy index: %u", ntohl (mp->sr_policy_index));
1205 s = format (s, "Operation: %u", mp->operation);
1207 s = format (s, "SID list index: %u", ntohl (mp->sl_index));
1209 s = format (s, "SID list weight: %u", ntohl (mp->weight));
1211 s = format (s, "{");
1212 vec_foreach (seg, segments)
1214 s = format (s, "%U, ", format_ip6_address, seg);
1216 s = format (s, "\b\b } ");
1221 static void *vl_api_sr_policy_del_t_print
1222 (vl_api_sr_policy_del_t * mp, void *handle)
1226 s = format (0, "SCRIPT: sr_policy_del ");
1227 s = format (s, "To be delivered. Good luck.");
1231 static void *vl_api_classify_add_del_table_t_print
1232 (vl_api_classify_add_del_table_t * mp, void *handle)
1237 s = format (0, "SCRIPT: classify_add_del_table ");
1239 if (mp->is_add == 0)
1241 s = format (s, "table %d ", ntohl (mp->table_index));
1242 s = format (s, "%s ", mp->del_chain ? "del-chain" : "del");
1246 s = format (s, "nbuckets %d ", ntohl (mp->nbuckets));
1247 s = format (s, "memory_size %d ", ntohl (mp->memory_size));
1248 s = format (s, "skip %d ", ntohl (mp->skip_n_vectors));
1249 s = format (s, "match %d ", ntohl (mp->match_n_vectors));
1250 s = format (s, "next-table %d ", ntohl (mp->next_table_index));
1251 s = format (s, "miss-next %d ", ntohl (mp->miss_next_index));
1252 s = format (s, "current-data-flag %d ", ntohl (mp->current_data_flag));
1253 if (mp->current_data_flag)
1254 s = format (s, "current-data-offset %d ",
1255 ntohl (mp->current_data_offset));
1256 s = format (s, "mask hex ");
1257 for (i = 0; i < ntohl (mp->match_n_vectors) * sizeof (u32x4); i++)
1258 s = format (s, "%02x", mp->mask[i]);
1265 static void *vl_api_classify_add_del_session_t_print
1266 (vl_api_classify_add_del_session_t * mp, void *handle)
1271 s = format (0, "SCRIPT: classify_add_del_session ");
1273 s = format (s, "table_index %d ", ntohl (mp->table_index));
1274 s = format (s, "hit_next_index %d ", ntohl (mp->hit_next_index));
1275 s = format (s, "opaque_index %d ", ntohl (mp->opaque_index));
1276 s = format (s, "advance %d ", ntohl (mp->advance));
1277 s = format (s, "action %d ", mp->action);
1279 s = format (s, "metadata %d ", ntohl (mp->metadata));
1280 if (mp->is_add == 0)
1281 s = format (s, "del ");
1283 s = format (s, "match hex ");
1284 for (i = 5 * sizeof (u32x4) - 1; i > 0; i--)
1286 if (mp->match[i] != 0)
1293 for (i = 0; i < limit; i++)
1294 s = format (s, "%02x", mp->match[i]);
1299 static void *vl_api_classify_set_interface_ip_table_t_print
1300 (vl_api_classify_set_interface_ip_table_t * mp, void *handle)
1304 s = format (0, "SCRIPT: classify_set_interface_ip_table ");
1307 s = format (s, "ipv6 ");
1309 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1310 s = format (s, "table %d ", ntohl (mp->table_index));
1315 static void *vl_api_classify_set_interface_l2_tables_t_print
1316 (vl_api_classify_set_interface_l2_tables_t * mp, void *handle)
1320 s = format (0, "SCRIPT: classify_set_interface_l2_tables ");
1322 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1323 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1324 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1325 s = format (s, "other-table %d ", ntohl (mp->other_table_index));
1326 s = format (s, "is-input %d ", mp->is_input);
1331 static void *vl_api_add_node_next_t_print
1332 (vl_api_add_node_next_t * mp, void *handle)
1336 s = format (0, "SCRIPT: add_node_next ");
1338 s = format (0, "node %s next %s ", mp->node_name, mp->next_name);
1343 static void *vl_api_l2tpv3_create_tunnel_t_print
1344 (vl_api_l2tpv3_create_tunnel_t * mp, void *handle)
1348 s = format (0, "SCRIPT: l2tpv3_create_tunnel ");
1350 s = format (s, "client_address %U our_address %U ",
1351 format_ip6_address, (ip6_address_t *) (mp->client_address),
1352 format_ip6_address, (ip6_address_t *) (mp->our_address));
1353 s = format (s, "local_session_id %d ", ntohl (mp->local_session_id));
1354 s = format (s, "remote_session_id %d ", ntohl (mp->remote_session_id));
1355 s = format (s, "local_cookie %lld ",
1356 clib_net_to_host_u64 (mp->local_cookie));
1357 s = format (s, "remote_cookie %lld ",
1358 clib_net_to_host_u64 (mp->remote_cookie));
1359 if (mp->l2_sublayer_present)
1360 s = format (s, "l2-sublayer-present ");
1365 static void *vl_api_l2tpv3_set_tunnel_cookies_t_print
1366 (vl_api_l2tpv3_set_tunnel_cookies_t * mp, void *handle)
1370 s = format (0, "SCRIPT: l2tpv3_set_tunnel_cookies ");
1372 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1374 s = format (s, "new_local_cookie %llu ",
1375 clib_net_to_host_u64 (mp->new_local_cookie));
1377 s = format (s, "new_remote_cookie %llu ",
1378 clib_net_to_host_u64 (mp->new_remote_cookie));
1383 static void *vl_api_l2tpv3_interface_enable_disable_t_print
1384 (vl_api_l2tpv3_interface_enable_disable_t * mp, void *handle)
1388 s = format (0, "SCRIPT: l2tpv3_interface_enable_disable ");
1390 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1392 if (mp->enable_disable == 0)
1393 s = format (s, "del ");
1398 static void *vl_api_l2tpv3_set_lookup_key_t_print
1399 (vl_api_l2tpv3_set_lookup_key_t * mp, void *handle)
1402 char *str = "unknown";
1404 s = format (0, "SCRIPT: l2tpv3_set_lookup_key ");
1408 case L2T_LOOKUP_SRC_ADDRESS:
1409 str = "lookup_v6_src";
1411 case L2T_LOOKUP_DST_ADDRESS:
1412 str = "lookup_v6_dst";
1414 case L2T_LOOKUP_SESSION_ID:
1415 str = "lookup_session_id";
1421 s = format (s, "%s ", str);
1426 static void *vl_api_sw_if_l2tpv3_tunnel_dump_t_print
1427 (vl_api_sw_if_l2tpv3_tunnel_dump_t * mp, void *handle)
1431 s = format (0, "SCRIPT: sw_if_l2tpv3_tunnel_dump ");
1436 static void *vl_api_vxlan_add_del_tunnel_t_print
1437 (vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
1440 s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
1442 ip46_address_t src = to_ip46 (mp->is_ipv6, mp->src_address);
1443 ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->dst_address);
1445 u8 is_grp = ip46_address_is_multicast (&dst);
1446 char *dst_name = is_grp ? "group" : "dst";
1448 s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY);
1449 s = format (s, "%s %U ", dst_name, format_ip46_address,
1450 &dst, IP46_TYPE_ANY);
1453 s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1455 if (mp->encap_vrf_id)
1456 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1458 s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1460 s = format (s, "vni %d ", ntohl (mp->vni));
1462 if (mp->is_add == 0)
1463 s = format (s, "del ");
1468 static void *vl_api_vxlan_tunnel_dump_t_print
1469 (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1473 s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1475 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1480 static void *vl_api_gre_add_del_tunnel_t_print
1481 (vl_api_gre_add_del_tunnel_t * mp, void *handle)
1485 s = format (0, "SCRIPT: gre_add_del_tunnel ");
1487 s = format (s, "dst %U ", format_ip46_address,
1488 (ip46_address_t *) & (mp->dst_address),
1489 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1491 s = format (s, "src %U ", format_ip46_address,
1492 (ip46_address_t *) & (mp->src_address),
1493 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1496 s = format (s, "teb ");
1498 if (mp->outer_fib_id)
1499 s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
1501 if (mp->is_add == 0)
1502 s = format (s, "del ");
1507 static void *vl_api_gre_tunnel_dump_t_print
1508 (vl_api_gre_tunnel_dump_t * mp, void *handle)
1512 s = format (0, "SCRIPT: gre_tunnel_dump ");
1514 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1519 static void *vl_api_l2_fib_clear_table_t_print
1520 (vl_api_l2_fib_clear_table_t * mp, void *handle)
1524 s = format (0, "SCRIPT: l2_fib_clear_table ");
1529 static void *vl_api_l2_interface_efp_filter_t_print
1530 (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1534 s = format (0, "SCRIPT: l2_interface_efp_filter ");
1536 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1537 if (mp->enable_disable)
1538 s = format (s, "enable ");
1540 s = format (s, "disable ");
1545 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1546 (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1550 s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1552 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1553 s = format (s, "vtr_op %d ", ntohl (mp->vtr_op));
1554 s = format (s, "push_dot1q %d ", ntohl (mp->push_dot1q));
1555 s = format (s, "tag1 %d ", ntohl (mp->tag1));
1556 s = format (s, "tag2 %d ", ntohl (mp->tag2));
1561 static void *vl_api_create_vhost_user_if_t_print
1562 (vl_api_create_vhost_user_if_t * mp, void *handle)
1566 s = format (0, "SCRIPT: create_vhost_user_if ");
1568 s = format (s, "socket %s ", mp->sock_filename);
1570 s = format (s, "server ");
1572 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1574 s = format (s, "tag %s", mp->tag);
1579 static void *vl_api_modify_vhost_user_if_t_print
1580 (vl_api_modify_vhost_user_if_t * mp, void *handle)
1584 s = format (0, "SCRIPT: modify_vhost_user_if ");
1586 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
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));
1596 static void *vl_api_delete_vhost_user_if_t_print
1597 (vl_api_delete_vhost_user_if_t * mp, void *handle)
1601 s = format (0, "SCRIPT: delete_vhost_user_if ");
1602 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1607 static void *vl_api_sw_interface_vhost_user_dump_t_print
1608 (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
1612 s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
1617 static void *vl_api_sw_interface_dump_t_print
1618 (vl_api_sw_interface_dump_t * mp, void *handle)
1622 s = format (0, "SCRIPT: sw_interface_dump ");
1624 if (mp->name_filter_valid)
1625 s = format (s, "name_filter %s ", mp->name_filter);
1627 s = format (s, "all ");
1632 static void *vl_api_l2_fib_table_dump_t_print
1633 (vl_api_l2_fib_table_dump_t * mp, void *handle)
1637 s = format (0, "SCRIPT: l2_fib_table_dump ");
1639 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
1644 static void *vl_api_control_ping_t_print
1645 (vl_api_control_ping_t * mp, void *handle)
1649 s = format (0, "SCRIPT: control_ping ");
1654 static void *vl_api_want_interface_events_t_print
1655 (vl_api_want_interface_events_t * mp, void *handle)
1659 s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
1660 ntohl (mp->pid), ntohl (mp->enable_disable));
1666 vl_api_cli_t_print (vl_api_cli_t * mp, void *handle)
1670 s = format (0, "SCRIPT: cli ");
1675 static void *vl_api_cli_inband_t_print
1676 (vl_api_cli_inband_t * mp, void *handle)
1680 s = format (0, "SCRIPT: cli_inband ");
1685 static void *vl_api_memclnt_create_t_print
1686 (vl_api_memclnt_create_t * mp, void *handle)
1690 s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
1695 static void *vl_api_show_version_t_print
1696 (vl_api_show_version_t * mp, void *handle)
1700 s = format (0, "SCRIPT: show_version ");
1705 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
1706 (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
1710 s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
1712 ip46_address_t local = to_ip46 (mp->is_ipv6, mp->local);
1713 ip46_address_t remote = to_ip46 (mp->is_ipv6, mp->remote);
1715 u8 is_grp = ip46_address_is_multicast (&remote);
1716 char *remote_name = is_grp ? "group" : "remote";
1718 s = format (s, "local %U ", format_ip46_address, &local, IP46_TYPE_ANY);
1719 s = format (s, "%s %U ", remote_name, format_ip46_address,
1720 &remote, IP46_TYPE_ANY);
1723 s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1724 s = format (s, "protocol %d ", ntohl (mp->protocol));
1726 s = format (s, "vni %d ", ntohl (mp->vni));
1728 if (mp->is_add == 0)
1729 s = format (s, "del ");
1731 if (mp->encap_vrf_id)
1732 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1734 if (mp->decap_vrf_id)
1735 s = format (s, "decap-vrf-id %d ", ntohl (mp->decap_vrf_id));
1740 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
1741 (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
1745 s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
1747 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1752 static void *vl_api_interface_name_renumber_t_print
1753 (vl_api_interface_name_renumber_t * mp, void *handle)
1757 s = format (0, "SCRIPT: interface_renumber ");
1759 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1761 s = format (s, "new_show_dev_instance %d ",
1762 ntohl (mp->new_show_dev_instance));
1767 static void *vl_api_want_ip4_arp_events_t_print
1768 (vl_api_want_ip4_arp_events_t * mp, void *handle)
1772 s = format (0, "SCRIPT: want_ip4_arp_events ");
1773 s = format (s, "pid %d address %U ", ntohl (mp->pid),
1774 format_ip4_address, &mp->address);
1775 if (mp->enable_disable == 0)
1776 s = format (s, "del ");
1781 static void *vl_api_want_ip6_nd_events_t_print
1782 (vl_api_want_ip6_nd_events_t * mp, void *handle)
1786 s = format (0, "SCRIPT: want_ip6_nd_events ");
1787 s = format (s, "pid %d address %U ", ntohl (mp->pid),
1788 format_ip6_address, mp->address);
1789 if (mp->enable_disable == 0)
1790 s = format (s, "del ");
1795 static void *vl_api_want_l2_macs_events_t_print
1796 (vl_api_want_l2_macs_events_t * mp, void *handle)
1800 s = format (0, "SCRIPT: want_l2_macs_events ");
1801 s = format (s, "learn-limit %d ", ntohl (mp->learn_limit));
1802 s = format (s, "scan-delay %d ", (u32) mp->scan_delay);
1803 s = format (s, "max-entries %d ", (u32) mp->max_macs_in_event * 10);
1804 if (mp->enable_disable == 0)
1805 s = format (s, "disable");
1810 static void *vl_api_input_acl_set_interface_t_print
1811 (vl_api_input_acl_set_interface_t * mp, void *handle)
1815 s = format (0, "SCRIPT: input_acl_set_interface ");
1817 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1818 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1819 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1820 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
1822 if (mp->is_add == 0)
1823 s = format (s, "del ");
1828 static void *vl_api_ip_address_dump_t_print
1829 (vl_api_ip_address_dump_t * mp, void *handle)
1833 s = format (0, "SCRIPT: ip6_address_dump ");
1834 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1835 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1841 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
1845 s = format (0, "SCRIPT: ip_dump ");
1846 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1851 static void *vl_api_cop_interface_enable_disable_t_print
1852 (vl_api_cop_interface_enable_disable_t * mp, void *handle)
1856 s = format (0, "SCRIPT: cop_interface_enable_disable ");
1857 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1858 if (mp->enable_disable)
1859 s = format (s, "enable ");
1861 s = format (s, "disable ");
1866 static void *vl_api_cop_whitelist_enable_disable_t_print
1867 (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
1871 s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
1872 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1873 s = format (s, "fib-id %d ", ntohl (mp->fib_id));
1875 s = format (s, "ip4 ");
1877 s = format (s, "ip6 ");
1878 if (mp->default_cop)
1879 s = format (s, "default ");
1884 static void *vl_api_af_packet_create_t_print
1885 (vl_api_af_packet_create_t * mp, void *handle)
1889 s = format (0, "SCRIPT: af_packet_create ");
1890 s = format (s, "host_if_name %s ", mp->host_if_name);
1891 if (mp->use_random_hw_addr)
1892 s = format (s, "hw_addr random ");
1894 s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
1899 static void *vl_api_af_packet_delete_t_print
1900 (vl_api_af_packet_delete_t * mp, void *handle)
1904 s = format (0, "SCRIPT: af_packet_delete ");
1905 s = format (s, "host_if_name %s ", mp->host_if_name);
1911 format_policer_action (u8 * s, va_list * va)
1913 u32 action = va_arg (*va, u32);
1914 u32 dscp = va_arg (*va, u32);
1917 if (action == SSE2_QOS_ACTION_DROP)
1918 s = format (s, "drop");
1919 else if (action == SSE2_QOS_ACTION_TRANSMIT)
1920 s = format (s, "transmit");
1921 else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
1923 s = format (s, "mark-and-transmit ");
1926 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
1932 s = format (s, "%s", t);
1938 static void *vl_api_policer_add_del_t_print
1939 (vl_api_policer_add_del_t * mp, void *handle)
1943 s = format (0, "SCRIPT: policer_add_del ");
1944 s = format (s, "name %s ", mp->name);
1945 s = format (s, "cir %d ", mp->cir);
1946 s = format (s, "eir %d ", mp->eir);
1947 s = format (s, "cb %d ", mp->cb);
1948 s = format (s, "eb %d ", mp->eb);
1950 switch (mp->rate_type)
1952 case SSE2_QOS_RATE_KBPS:
1953 s = format (s, "rate_type kbps ");
1955 case SSE2_QOS_RATE_PPS:
1956 s = format (s, "rate_type pps ");
1962 switch (mp->round_type)
1964 case SSE2_QOS_ROUND_TO_CLOSEST:
1965 s = format (s, "round_type closest ");
1967 case SSE2_QOS_ROUND_TO_UP:
1968 s = format (s, "round_type up ");
1970 case SSE2_QOS_ROUND_TO_DOWN:
1971 s = format (s, "round_type down ");
1979 case SSE2_QOS_POLICER_TYPE_1R2C:
1980 s = format (s, "type 1r2c ");
1982 case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
1983 s = format (s, "type 1r3c ");
1985 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
1986 s = format (s, "type 2r3c-2698 ");
1988 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
1989 s = format (s, "type 2r3c-4115 ");
1991 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
1992 s = format (s, "type 2r3c-mef5cf1 ");
1998 s = format (s, "conform_action %U ", format_policer_action,
1999 mp->conform_action_type, mp->conform_dscp);
2000 s = format (s, "exceed_action %U ", format_policer_action,
2001 mp->exceed_action_type, mp->exceed_dscp);
2002 s = format (s, "violate_action %U ", format_policer_action,
2003 mp->violate_action_type, mp->violate_dscp);
2005 if (mp->color_aware)
2006 s = format (s, "color-aware ");
2007 if (mp->is_add == 0)
2008 s = format (s, "del ");
2013 static void *vl_api_policer_dump_t_print
2014 (vl_api_policer_dump_t * mp, void *handle)
2018 s = format (0, "SCRIPT: policer_dump ");
2019 if (mp->match_name_valid)
2020 s = format (s, "name %s ", mp->match_name);
2025 static void *vl_api_policer_classify_set_interface_t_print
2026 (vl_api_policer_classify_set_interface_t * mp, void *handle)
2030 s = format (0, "SCRIPT: policer_classify_set_interface ");
2031 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2032 if (mp->ip4_table_index != ~0)
2033 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2034 if (mp->ip6_table_index != ~0)
2035 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2036 if (mp->l2_table_index != ~0)
2037 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2038 if (mp->is_add == 0)
2039 s = format (s, "del ");
2044 static void *vl_api_policer_classify_dump_t_print
2045 (vl_api_policer_classify_dump_t * mp, void *handle)
2049 s = format (0, "SCRIPT: policer_classify_dump ");
2052 case POLICER_CLASSIFY_TABLE_IP4:
2053 s = format (s, "type ip4 ");
2055 case POLICER_CLASSIFY_TABLE_IP6:
2056 s = format (s, "type ip6 ");
2058 case POLICER_CLASSIFY_TABLE_L2:
2059 s = format (s, "type l2 ");
2068 static void *vl_api_sw_interface_clear_stats_t_print
2069 (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2073 s = format (0, "SCRIPT: sw_interface_clear_stats ");
2074 if (mp->sw_if_index != ~0)
2075 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2080 static void *vl_api_mpls_tunnel_dump_t_print
2081 (vl_api_mpls_tunnel_dump_t * mp, void *handle)
2085 s = format (0, "SCRIPT: mpls_tunnel_dump ");
2087 s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
2092 static void *vl_api_mpls_fib_dump_t_print
2093 (vl_api_mpls_fib_dump_t * mp, void *handle)
2097 s = format (0, "SCRIPT: mpls_fib_decap_dump ");
2102 static void *vl_api_ip_fib_dump_t_print
2103 (vl_api_ip_fib_dump_t * mp, void *handle)
2107 s = format (0, "SCRIPT: ip_fib_dump ");
2112 static void *vl_api_ip6_fib_dump_t_print
2113 (vl_api_ip6_fib_dump_t * mp, void *handle)
2117 s = format (0, "SCRIPT: ip6_fib_dump ");
2122 static void *vl_api_classify_table_ids_t_print
2123 (vl_api_classify_table_ids_t * mp, void *handle)
2127 s = format (0, "SCRIPT: classify_table_ids ");
2132 static void *vl_api_classify_table_by_interface_t_print
2133 (vl_api_classify_table_by_interface_t * mp, void *handle)
2137 s = format (0, "SCRIPT: classify_table_by_interface ");
2138 if (mp->sw_if_index != ~0)
2139 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2144 static void *vl_api_classify_table_info_t_print
2145 (vl_api_classify_table_info_t * mp, void *handle)
2149 s = format (0, "SCRIPT: classify_table_info ");
2150 if (mp->table_id != ~0)
2151 s = format (s, "table_id %d ", ntohl (mp->table_id));
2156 static void *vl_api_classify_session_dump_t_print
2157 (vl_api_classify_session_dump_t * mp, void *handle)
2161 s = format (0, "SCRIPT: classify_session_dump ");
2162 if (mp->table_id != ~0)
2163 s = format (s, "table_id %d ", ntohl (mp->table_id));
2168 static void *vl_api_set_ipfix_exporter_t_print
2169 (vl_api_set_ipfix_exporter_t * mp, void *handle)
2173 s = format (0, "SCRIPT: set_ipfix_exporter ");
2175 s = format (s, "collector-address %U ", format_ip4_address,
2176 (ip4_address_t *) mp->collector_address);
2177 s = format (s, "collector-port %d ", ntohs (mp->collector_port));
2178 s = format (s, "src-address %U ", format_ip4_address,
2179 (ip4_address_t *) mp->src_address);
2180 s = format (s, "vrf-id %d ", ntohl (mp->vrf_id));
2181 s = format (s, "path-mtu %d ", ntohl (mp->path_mtu));
2182 s = format (s, "template-interval %d ", ntohl (mp->template_interval));
2183 s = format (s, "udp-checksum %d ", mp->udp_checksum);
2188 static void *vl_api_ipfix_exporter_dump_t_print
2189 (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2193 s = format (0, "SCRIPT: ipfix_exporter_dump ");
2198 static void *vl_api_set_ipfix_classify_stream_t_print
2199 (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2203 s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2205 s = format (s, "domain-id %d ", ntohl (mp->domain_id));
2206 s = format (s, "src-port %d ", ntohs (mp->src_port));
2211 static void *vl_api_ipfix_classify_stream_dump_t_print
2212 (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2216 s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2221 static void *vl_api_ipfix_classify_table_add_del_t_print
2222 (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2226 s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2228 s = format (s, "table-id %d ", ntohl (mp->table_id));
2229 s = format (s, "ip-version %d ", mp->ip_version);
2230 s = format (s, "transport-protocol %d ", mp->transport_protocol);
2235 static void *vl_api_ipfix_classify_table_dump_t_print
2236 (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2240 s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2245 static void *vl_api_sw_interface_span_enable_disable_t_print
2246 (vl_api_sw_interface_span_enable_disable_t * mp, void *handle)
2250 s = format (0, "SCRIPT: sw_interface_span_enable_disable ");
2251 s = format (s, "src_sw_if_index %u ", ntohl (mp->sw_if_index_from));
2252 s = format (s, "dst_sw_if_index %u ", ntohl (mp->sw_if_index_to));
2255 s = format (s, "l2 ");
2260 s = format (s, "disable ");
2263 s = format (s, "rx ");
2266 s = format (s, "tx ");
2270 s = format (s, "both ");
2278 vl_api_sw_interface_span_dump_t_print (vl_api_sw_interface_span_dump_t * mp,
2283 s = format (0, "SCRIPT: sw_interface_span_dump ");
2286 s = format (s, "l2 ");
2291 static void *vl_api_get_next_index_t_print
2292 (vl_api_get_next_index_t * mp, void *handle)
2296 s = format (0, "SCRIPT: get_next_index ");
2297 s = format (s, "node-name %s ", mp->node_name);
2298 s = format (s, "next-node-name %s ", mp->next_name);
2303 static void *vl_api_pg_create_interface_t_print
2304 (vl_api_pg_create_interface_t * mp, void *handle)
2308 s = format (0, "SCRIPT: pg_create_interface ");
2309 s = format (0, "if_id %d", ntohl (mp->interface_id));
2314 static void *vl_api_pg_capture_t_print
2315 (vl_api_pg_capture_t * mp, void *handle)
2319 s = format (0, "SCRIPT: pg_capture ");
2320 s = format (0, "if_id %d ", ntohl (mp->interface_id));
2321 s = format (0, "pcap %s", mp->pcap_file_name);
2322 if (mp->count != ~0)
2323 s = format (s, "count %d ", ntohl (mp->count));
2324 if (!mp->is_enabled)
2325 s = format (s, "disable");
2330 static void *vl_api_pg_enable_disable_t_print
2331 (vl_api_pg_enable_disable_t * mp, void *handle)
2335 s = format (0, "SCRIPT: pg_enable_disable ");
2336 if (ntohl (mp->stream_name_length) > 0)
2337 s = format (s, "stream %s", mp->stream_name);
2338 if (!mp->is_enabled)
2339 s = format (s, "disable");
2344 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2345 (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2350 s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2352 s = format (s, "%U/%d ", format_ip6_address, mp->address,
2355 s = format (s, "%U/%d ", format_ip4_address, mp->address,
2358 for (i = 0; i < mp->number_of_ranges; i++)
2360 s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2363 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
2365 if (mp->is_add == 0)
2366 s = format (s, "del ");
2371 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2372 (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2377 s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2379 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2381 if (mp->tcp_out_vrf_id != ~0)
2382 s = format (s, "tcp-out-vrf %d ", ntohl (mp->tcp_out_vrf_id));
2384 if (mp->udp_out_vrf_id != ~0)
2385 s = format (s, "udp-out-vrf %d ", ntohl (mp->udp_out_vrf_id));
2387 if (mp->tcp_in_vrf_id != ~0)
2388 s = format (s, "tcp-in-vrf %d ", ntohl (mp->tcp_in_vrf_id));
2390 if (mp->udp_in_vrf_id != ~0)
2391 s = format (s, "udp-in-vrf %d ", ntohl (mp->udp_in_vrf_id));
2393 if (mp->is_add == 0)
2394 s = format (s, "del ");
2399 static void *vl_api_lisp_enable_disable_t_print
2400 (vl_api_lisp_enable_disable_t * mp, void *handle)
2404 s = format (0, "SCRIPT: lisp_enable_disable %s",
2405 mp->is_en ? "enable" : "disable");
2410 static void *vl_api_gpe_add_del_iface_t_print
2411 (vl_api_gpe_add_del_iface_t * mp, void *handle)
2415 s = format (0, "SCRIPT: gpe_add_del_iface ");
2417 s = format (s, "%s ", mp->is_add ? "up" : "down");
2418 s = format (s, "vni %d ", mp->vni);
2419 s = format (s, "%s %d ", mp->is_l2 ? "bd_id" : "table_id", mp->dp_table);
2424 static void *vl_api_lisp_pitr_set_locator_set_t_print
2425 (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
2429 s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
2432 s = format (s, "locator-set %s ", mp->ls_name);
2434 s = format (s, "del");
2440 format_lisp_flat_eid (u8 * s, va_list * args)
2442 u32 type = va_arg (*args, u32);
2443 u8 *eid = va_arg (*args, u8 *);
2444 u32 eid_len = va_arg (*args, u32);
2449 return format (s, "%U/%d", format_ip4_address, eid, eid_len);
2451 return format (s, "%U/%d", format_ip6_address, eid, eid_len);
2453 return format (s, "%U", format_ethernet_address, eid);
2458 static void *vl_api_lisp_add_del_remote_mapping_t_print
2459 (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
2464 s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
2467 s = format (s, "del-all ");
2469 s = format (s, "%s ", mp->is_add ? "add" : "del");
2470 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2472 s = format (s, "eid %U ", format_lisp_flat_eid,
2473 mp->eid_type, mp->eid, mp->eid_len);
2477 s = format (s, "seid %U ", format_lisp_flat_eid,
2478 mp->eid_type, mp->seid, mp->seid_len);
2481 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
2484 s = format (s, "action %d", mp->action);
2489 static void *vl_api_lisp_add_del_adjacency_t_print
2490 (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
2494 s = format (0, "SCRIPT: lisp_add_del_adjacency ");
2496 s = format (s, "%s ", mp->is_add ? "add" : "del");
2497 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2498 s = format (s, "reid %U leid %U ",
2499 format_lisp_flat_eid, mp->eid_type, mp->reid, mp->reid_len,
2500 format_lisp_flat_eid, mp->eid_type, mp->leid, mp->leid_len);
2505 static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
2506 (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
2510 s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
2513 s = format (s, "%s", mp->locator_set_name);
2515 s = format (s, "del");
2520 static void *vl_api_lisp_eid_table_add_del_map_t_print
2521 (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
2525 s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
2528 s = format (s, "del ");
2530 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2531 s = format (s, "%s %d ",
2532 mp->is_l2 ? "bd_index" : "vrf",
2533 clib_net_to_host_u32 (mp->dp_table));
2537 static void *vl_api_lisp_add_del_local_eid_t_print
2538 (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
2542 s = format (0, "SCRIPT: lisp_add_del_local_eid ");
2545 s = format (s, "del ");
2547 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2548 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
2550 s = format (s, "locator-set %s ", mp->locator_set_name);
2553 u32 key_id = mp->key_id;
2554 s = format (s, "key-id %U", format_hmac_key_id, key_id);
2555 s = format (s, "secret-key %s", mp->key);
2560 static void *vl_api_gpe_add_del_fwd_entry_t_print
2561 (vl_api_gpe_add_del_fwd_entry_t * mp, void *handle)
2565 s = format (0, "SCRIPT: gpe_add_del_fwd_entry TODO");
2570 static void *vl_api_lisp_add_del_map_resolver_t_print
2571 (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
2575 s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
2578 s = format (s, "del ");
2581 s = format (s, "%U ", format_ip6_address, mp->ip_address);
2583 s = format (s, "%U ", format_ip4_address, mp->ip_address);
2588 static void *vl_api_gpe_enable_disable_t_print
2589 (vl_api_gpe_enable_disable_t * mp, void *handle)
2593 s = format (0, "SCRIPT: gpe_enable_disable ");
2595 s = format (s, "%s ", mp->is_en ? "enable" : "disable");
2600 static void *vl_api_lisp_add_del_locator_set_t_print
2601 (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
2605 s = format (0, "SCRIPT: lisp_add_del_locator_set ");
2608 s = format (s, "del ");
2610 s = format (s, "locator-set %s ", mp->locator_set_name);
2615 static void *vl_api_lisp_add_del_locator_t_print
2616 (vl_api_lisp_add_del_locator_t * mp, void *handle)
2620 s = format (0, "SCRIPT: lisp_add_del_locator ");
2623 s = format (s, "del ");
2625 s = format (s, "locator-set %s ", mp->locator_set_name);
2626 s = format (s, "sw_if_index %d ", mp->sw_if_index);
2627 s = format (s, "p %d w %d ", mp->priority, mp->weight);
2632 static void *vl_api_lisp_locator_set_dump_t_print
2633 (vl_api_lisp_locator_set_dump_t * mp, void *handle)
2637 s = format (0, "SCRIPT: lisp_locator_set_dump ");
2638 if (mp->filter == 1)
2639 s = format (s, "local");
2640 else if (mp->filter == 2)
2641 s = format (s, "remote");
2646 static void *vl_api_lisp_locator_dump_t_print
2647 (vl_api_lisp_locator_dump_t * mp, void *handle)
2651 s = format (0, "SCRIPT: lisp_locator_dump ");
2652 if (mp->is_index_set)
2653 s = format (s, "ls_index %d", clib_net_to_host_u32 (mp->ls_index));
2655 s = format (s, "ls_name %s", mp->ls_name);
2660 static void *vl_api_lisp_map_request_mode_t_print
2661 (vl_api_lisp_map_request_mode_t * mp, void *handle)
2665 s = format (0, "SCRIPT: lisp_map_request_mode ");
2670 s = format (s, "dst-only");
2673 s = format (s, "src-dst");
2681 static void *vl_api_lisp_eid_table_dump_t_print
2682 (vl_api_lisp_eid_table_dump_t * mp, void *handle)
2686 s = format (0, "SCRIPT: lisp_eid_table_dump ");
2690 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2691 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
2692 mp->eid, mp->prefix_length);
2696 s = format (s, "local ");
2699 s = format (s, "remote ");
2707 static void *vl_api_lisp_rloc_probe_enable_disable_t_print
2708 (vl_api_lisp_rloc_probe_enable_disable_t * mp, void *handle)
2712 s = format (0, "SCRIPT: lisp_rloc_probe_enable_disable ");
2714 s = format (s, "enable");
2716 s = format (s, "disable");
2721 static void *vl_api_lisp_map_register_enable_disable_t_print
2722 (vl_api_lisp_map_register_enable_disable_t * mp, void *handle)
2726 s = format (0, "SCRIPT: lisp_map_register_enable_disable ");
2728 s = format (s, "enable");
2730 s = format (s, "disable");
2735 static void *vl_api_lisp_adjacencies_get_t_print
2736 (vl_api_lisp_adjacencies_get_t * mp, void *handle)
2740 s = format (0, "SCRIPT: lisp_adjacencies_get ");
2741 s = format (s, "vni %d", clib_net_to_host_u32 (mp->vni));
2746 static void *vl_api_lisp_eid_table_map_dump_t_print
2747 (vl_api_lisp_eid_table_map_dump_t * mp, void *handle)
2751 s = format (0, "SCRIPT: lisp_eid_table_map_dump ");
2754 s = format (s, "l2");
2756 s = format (s, "l3");
2761 static void *vl_api_ipsec_gre_add_del_tunnel_t_print
2762 (vl_api_ipsec_gre_add_del_tunnel_t * mp, void *handle)
2766 s = format (0, "SCRIPT: ipsec_gre_add_del_tunnel ");
2768 s = format (s, "dst %U ", format_ip4_address,
2769 (ip4_address_t *) & (mp->dst_address));
2771 s = format (s, "src %U ", format_ip4_address,
2772 (ip4_address_t *) & (mp->src_address));
2774 s = format (s, "local_sa %d ", ntohl (mp->local_sa_id));
2776 s = format (s, "remote_sa %d ", ntohl (mp->remote_sa_id));
2778 if (mp->is_add == 0)
2779 s = format (s, "del ");
2784 static void *vl_api_ipsec_gre_tunnel_dump_t_print
2785 (vl_api_ipsec_gre_tunnel_dump_t * mp, void *handle)
2789 s = format (0, "SCRIPT: ipsec_gre_tunnel_dump ");
2791 if (mp->sw_if_index != ~0)
2792 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2797 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
2798 (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
2801 u32 vtr_op = ntohl (mp->vtr_op);
2803 s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
2805 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2806 s = format (s, "vtr_op %d ", vtr_op);
2807 if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
2809 if (vtr_op == L2_VTR_TRANSLATE_2_2)
2810 s = format (s, "%d ", ntohs (mp->outer_tag));
2811 s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
2812 s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
2813 s = format (s, "sid %d ", ntohl (mp->i_sid));
2814 s = format (s, "vlanid %d ", ntohs (mp->b_vlanid));
2820 static void *vl_api_flow_classify_set_interface_t_print
2821 (vl_api_flow_classify_set_interface_t * mp, void *handle)
2825 s = format (0, "SCRIPT: flow_classify_set_interface ");
2826 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2827 if (mp->ip4_table_index != ~0)
2828 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2829 if (mp->ip6_table_index != ~0)
2830 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2831 if (mp->is_add == 0)
2832 s = format (s, "del ");
2838 vl_api_punt_t_print (vl_api_punt_t * mp, void *handle)
2842 s = format (0, "SCRIPT: punt ");
2844 if (mp->ipv != (u8) ~ 0)
2845 s = format (s, "ip %d ", mp->ipv);
2847 s = format (s, "protocol %d ", mp->l4_protocol);
2849 if (mp->l4_port != (u16) ~ 0)
2850 s = format (s, "port %d ", ntohs (mp->l4_port));
2853 s = format (s, "del ");
2858 static void *vl_api_flow_classify_dump_t_print
2859 (vl_api_flow_classify_dump_t * mp, void *handle)
2863 s = format (0, "SCRIPT: flow_classify_dump ");
2866 case FLOW_CLASSIFY_TABLE_IP4:
2867 s = format (s, "type ip4 ");
2869 case FLOW_CLASSIFY_TABLE_IP6:
2870 s = format (s, "type ip6 ");
2879 static void *vl_api_get_first_msg_id_t_print
2880 (vl_api_get_first_msg_id_t * mp, void *handle)
2884 s = format (0, "SCRIPT: get_first_msg_id %s ", mp->name);
2889 static void *vl_api_ioam_enable_t_print
2890 (vl_api_ioam_enable_t * mp, void *handle)
2894 s = format (0, "SCRIPT: ioam_enable ");
2896 if (mp->trace_enable)
2897 s = format (s, "trace enabled");
2900 s = format (s, "POT enabled");
2903 s = format (s, "Seqno enabled");
2906 s = format (s, "Analyse enabled");
2911 static void *vl_api_ioam_disable_t_print
2912 (vl_api_ioam_disable_t * mp, void *handle)
2916 s = format (0, "SCRIPT: ioam_disable ");
2917 s = format (s, "trace disabled");
2918 s = format (s, "POT disabled");
2919 s = format (s, "Seqno disabled");
2920 s = format (s, "Analyse disabled");
2925 static void *vl_api_feature_enable_disable_t_print
2926 (vl_api_feature_enable_disable_t * mp, void *handle)
2930 s = format (0, "SCRIPT: feature_enable_disable ");
2931 s = format (s, "arc_name %s ", mp->arc_name);
2932 s = format (s, "feature_name %s ", mp->feature_name);
2933 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2935 s = format (s, "disable");
2940 static void *vl_api_sw_interface_tag_add_del_t_print
2941 (vl_api_sw_interface_tag_add_del_t * mp, void *handle)
2945 s = format (0, "SCRIPT: sw_interface_tag_add_del ");
2946 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2948 s = format (s, "tag %s ", mp->tag);
2950 s = format (s, "del ");
2955 static void *vl_api_sw_interface_set_mtu_t_print
2956 (vl_api_sw_interface_set_mtu_t * mp, void *handle)
2960 s = format (0, "SCRIPT: sw_interface_set_mtu ");
2961 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2962 s = format (s, "tag %d ", ntohs (mp->mtu));
2967 static void *vl_api_p2p_ethernet_add_t_print
2968 (vl_api_p2p_ethernet_add_t * mp, void *handle)
2972 s = format (0, "SCRIPT: p2p_ethernet_add ");
2973 s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
2974 s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
2979 static void *vl_api_p2p_ethernet_del_t_print
2980 (vl_api_p2p_ethernet_del_t * mp, void *handle)
2984 s = format (0, "SCRIPT: p2p_ethernet_del ");
2985 s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
2986 s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
2991 #define foreach_custom_print_no_arg_function \
2992 _(lisp_eid_table_vni_dump) \
2993 _(lisp_map_resolver_dump) \
2994 _(lisp_map_server_dump) \
2995 _(show_lisp_rloc_probe_state) \
2996 _(show_lisp_map_register_state) \
2997 _(show_lisp_map_request_mode)
3000 static void * vl_api_ ## f ## _t_print \
3001 (vl_api_ ## f ## _t * mp, void * handle) \
3004 s = format (0, "SCRIPT: " #f ); \
3007 foreach_custom_print_no_arg_function
3009 #define foreach_custom_print_function \
3010 _(CREATE_LOOPBACK, create_loopback) \
3011 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \
3012 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
3013 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \
3014 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \
3015 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \
3016 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \
3017 _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass) \
3018 _(TAP_CONNECT, tap_connect) \
3019 _(TAP_MODIFY, tap_modify) \
3020 _(TAP_DELETE, tap_delete) \
3021 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \
3022 _(IP_ADD_DEL_ROUTE, ip_add_del_route) \
3023 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
3024 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
3025 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \
3026 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered) \
3027 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \
3028 _(RESET_VRF, reset_vrf) \
3029 _(CREATE_VLAN_SUBIF, create_vlan_subif) \
3030 _(CREATE_SUBIF, create_subif) \
3031 _(OAM_ADD_DEL, oam_add_del) \
3032 _(RESET_FIB, reset_fib) \
3033 _(DHCP_PROXY_CONFIG, dhcp_proxy_config) \
3034 _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss) \
3035 _(SET_IP_FLOW_HASH, set_ip_flow_hash) \
3036 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \
3037 sw_interface_ip6_set_link_local_address) \
3038 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix) \
3039 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config) \
3040 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \
3041 _(L2_PATCH_ADD_DEL, l2_patch_add_del) \
3042 _(SR_LOCALSID_ADD_DEL, sr_localsid_add_del) \
3043 _(SR_STEERING_ADD_DEL, sr_steering_add_del) \
3044 _(SR_POLICY_ADD, sr_policy_add) \
3045 _(SR_POLICY_MOD, sr_policy_mod) \
3046 _(SR_POLICY_DEL, sr_policy_del) \
3047 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \
3048 _(L2FIB_ADD_DEL, l2fib_add_del) \
3049 _(L2FIB_FLUSH_ALL, l2fib_flush_all) \
3050 _(L2FIB_FLUSH_BD, l2fib_flush_bd) \
3051 _(L2FIB_FLUSH_INT, l2fib_flush_int) \
3052 _(L2_FLAGS, l2_flags) \
3053 _(BRIDGE_FLAGS, bridge_flags) \
3054 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table) \
3055 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session) \
3056 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \
3057 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
3058 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
3059 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) \
3060 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \
3061 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \
3062 _(ADD_NODE_NEXT, add_node_next) \
3063 _(DHCP_CLIENT_CONFIG, dhcp_client_config) \
3064 _(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel) \
3065 _(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies) \
3066 _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable) \
3067 _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \
3068 _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \
3069 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \
3070 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \
3071 _(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel) \
3072 _(GRE_TUNNEL_DUMP, gre_tunnel_dump) \
3073 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \
3074 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \
3075 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \
3076 _(CREATE_VHOST_USER_IF, create_vhost_user_if) \
3077 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if) \
3078 _(DELETE_VHOST_USER_IF, delete_vhost_user_if) \
3079 _(SW_INTERFACE_DUMP, sw_interface_dump) \
3080 _(CONTROL_PING, control_ping) \
3081 _(WANT_INTERFACE_EVENTS, want_interface_events) \
3083 _(CLI_INBAND, cli_inband) \
3084 _(MEMCLNT_CREATE, memclnt_create) \
3085 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump) \
3086 _(SHOW_VERSION, show_version) \
3087 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
3088 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel) \
3089 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump) \
3090 _(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
3091 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
3092 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events) \
3093 _(WANT_L2_MACS_EVENTS, want_l2_macs_events) \
3094 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
3095 _(IP_ADDRESS_DUMP, ip_address_dump) \
3096 _(IP_DUMP, ip_dump) \
3097 _(DELETE_LOOPBACK, delete_loopback) \
3098 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \
3099 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \
3100 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \
3101 _(AF_PACKET_CREATE, af_packet_create) \
3102 _(AF_PACKET_DELETE, af_packet_delete) \
3103 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) \
3104 _(MPLS_FIB_DUMP, mpls_fib_dump) \
3105 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \
3106 _(CLASSIFY_TABLE_IDS,classify_table_ids) \
3107 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface) \
3108 _(CLASSIFY_TABLE_INFO,classify_table_info) \
3109 _(CLASSIFY_SESSION_DUMP,classify_session_dump) \
3110 _(SET_IPFIX_EXPORTER, set_ipfix_exporter) \
3111 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump) \
3112 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream) \
3113 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump) \
3114 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del) \
3115 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump) \
3116 _(SW_INTERFACE_SPAN_ENABLE_DISABLE, sw_interface_span_enable_disable) \
3117 _(SW_INTERFACE_SPAN_DUMP, sw_interface_span_dump) \
3118 _(GET_NEXT_INDEX, get_next_index) \
3119 _(PG_CREATE_INTERFACE,pg_create_interface) \
3120 _(PG_CAPTURE, pg_capture) \
3121 _(PG_ENABLE_DISABLE, pg_enable_disable) \
3122 _(POLICER_ADD_DEL, policer_add_del) \
3123 _(POLICER_DUMP, policer_dump) \
3124 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface) \
3125 _(POLICER_CLASSIFY_DUMP, policer_classify_dump) \
3126 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \
3127 ip_source_and_port_range_check_add_del) \
3128 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \
3129 ip_source_and_port_range_check_interface_add_del) \
3130 _(LISP_ENABLE_DISABLE, lisp_enable_disable) \
3131 _(GPE_ENABLE_DISABLE, gpe_enable_disable) \
3132 _(GPE_ADD_DEL_IFACE, gpe_add_del_iface) \
3133 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
3134 _(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
3135 _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
3136 _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
3137 _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
3138 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
3139 lisp_add_del_map_request_itr_rlocs) \
3140 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
3141 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
3142 _(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry) \
3143 _(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
3144 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
3145 _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
3146 _(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
3147 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
3148 _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
3149 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
3150 _(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
3151 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
3152 _(LISP_LOCATOR_DUMP, lisp_locator_dump) \
3153 _(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \
3154 _(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \
3155 _(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \
3156 _(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \
3157 _(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \
3158 _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel) \
3159 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump) \
3160 _(DELETE_SUBIF, delete_subif) \
3161 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \
3163 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface) \
3164 _(FLOW_CLASSIFY_DUMP, flow_classify_dump) \
3165 _(GET_FIRST_MSG_ID, get_first_msg_id) \
3166 _(IOAM_ENABLE, ioam_enable) \
3167 _(IOAM_DISABLE, ioam_disable) \
3168 _(IP_FIB_DUMP, ip_fib_dump) \
3169 _(IP6_FIB_DUMP, ip6_fib_dump) \
3170 _(FEATURE_ENABLE_DISABLE, feature_enable_disable) \
3171 _(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del) \
3172 _(SW_INTERFACE_SET_MTU, sw_interface_set_mtu) \
3173 _(P2P_ETHERNET_ADD, p2p_ethernet_add) \
3174 _(P2P_ETHERNET_DEL, p2p_ethernet_del)
3176 vl_msg_api_custom_dump_configure (api_main_t * am)
3178 #define _(n,f) am->msg_print_handlers[VL_API_##n] \
3179 = (void *) vl_api_##f##_t_print;
3180 foreach_custom_print_function;
3185 * fd.io coding-style-patch-verification: ON
3188 * eval: (c-set-style "gnu")