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/proxy.h>
25 #include <vnet/dhcpv6/proxy.h>
26 #include <vnet/l2tp/l2tp.h>
27 #include <vnet/l2/l2_input.h>
28 #include <vnet/sr/sr_packet.h>
29 #include <vnet/vxlan-gpe/vxlan_gpe.h>
30 #include <vnet/classify/policer_classify.h>
31 #include <vnet/policer/xlate.h>
32 #include <vnet/policer/policer.h>
33 #include <vlib/vlib.h>
34 #include <vlib/unix/unix.h>
35 #include <vlibapi/api.h>
36 #include <vlibmemory/api.h>
38 #include <stats/stats.h>
41 #include <vnet/ethernet/ethernet.h>
42 #include <vnet/l2/l2_vtr.h>
44 #include <vpp-api/vpe_msg_enum.h>
46 #define vl_typedefs /* define message structures */
47 #include <vpp-api/vpe_all_api_h.h>
50 #define vl_endianfun /* define message structures */
51 #include <vpp-api/vpe_all_api_h.h>
54 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
58 vl_print (handle, (char *)s); \
63 static void *vl_api_create_loopback_t_print
64 (vl_api_create_loopback_t * mp, void *handle)
68 s = format (0, "SCRIPT: create_loopback ");
69 s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
74 static void *vl_api_delete_loopback_t_print
75 (vl_api_delete_loopback_t * mp, void *handle)
79 s = format (0, "SCRIPT: delete_loopback ");
80 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
85 static void *vl_api_sw_interface_set_flags_t_print
86 (vl_api_sw_interface_set_flags_t * mp, void *handle)
89 s = format (0, "SCRIPT: sw_interface_set_flags ");
91 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
93 if (mp->admin_up_down)
94 s = format (s, "admin-up ");
96 s = format (s, "admin-down ");
99 s = format (s, "link-up");
101 s = format (s, "link-down");
106 static void *vl_api_sw_interface_add_del_address_t_print
107 (vl_api_sw_interface_add_del_address_t * mp, void *handle)
111 s = format (0, "SCRIPT: sw_interface_add_del_address ");
113 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
116 s = format (s, "%U/%d ", format_ip6_address,
117 (ip6_address_t *) mp->address, mp->address_length);
119 s = format (s, "%U/%d ", format_ip4_address,
120 (ip4_address_t *) mp->address, mp->address_length);
123 s = format (s, "del ");
125 s = format (s, "del-all ");
130 static void *vl_api_sw_interface_set_table_t_print
131 (vl_api_sw_interface_set_table_t * mp, void *handle)
135 s = format (0, "SCRIPT: sw_interface_set_table ");
137 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
140 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
143 s = format (s, "ipv6 ");
148 static void *vl_api_sw_interface_set_vpath_t_print
149 (vl_api_sw_interface_set_vpath_t * mp, void *handle)
153 s = format (0, "SCRIPT: sw_interface_set_vpath ");
155 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
158 s = format (s, "vPath enable ");
160 s = format (s, "vPath disable ");
165 static void *vl_api_sw_interface_set_l2_xconnect_t_print
166 (vl_api_sw_interface_set_l2_xconnect_t * mp, void *handle)
170 s = format (0, "SCRIPT: sw_interface_set_l2_xconnect ");
172 s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
176 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
179 s = format (s, "delete ");
184 static void *vl_api_sw_interface_set_l2_bridge_t_print
185 (vl_api_sw_interface_set_l2_bridge_t * mp, void *handle)
189 s = format (0, "SCRIPT: sw_interface_set_l2_bridge ");
191 s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
195 s = format (s, "bd_id %d shg %d %senable ", ntohl (mp->bd_id),
196 mp->shg, ((mp->bvi) ? "bvi " : " "));
199 s = format (s, "disable ");
204 static void *vl_api_sw_interface_set_dpdk_hqos_pipe_t_print
205 (vl_api_sw_interface_set_dpdk_hqos_pipe_t * mp, void *handle)
209 s = format (0, "SCRIPT: sw_interface_set_dpdk_hqos_pipe ");
211 s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index));
213 s = format (s, "subport %u pipe %u profile %u ",
214 ntohl (mp->subport), ntohl (mp->pipe), ntohl (mp->profile));
219 static void *vl_api_sw_interface_set_dpdk_hqos_subport_t_print
220 (vl_api_sw_interface_set_dpdk_hqos_subport_t * mp, void *handle)
224 s = format (0, "SCRIPT: sw_interface_set_dpdk_hqos_subport ");
226 s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index));
230 "subport %u rate %u bkt_size %u tc0 %u tc1 %u tc2 %u tc3 %u period %u",
231 ntohl (mp->subport), ntohl (mp->tb_rate), ntohl (mp->tb_size),
232 ntohl (mp->tc_rate[0]), ntohl (mp->tc_rate[1]),
233 ntohl (mp->tc_rate[2]), ntohl (mp->tc_rate[3]),
234 ntohl (mp->tc_period));
239 static void *vl_api_sw_interface_set_dpdk_hqos_tctbl_t_print
240 (vl_api_sw_interface_set_dpdk_hqos_tctbl_t * mp, void *handle)
244 s = format (0, "SCRIPT: sw_interface_set_dpdk_hqos_tctbl ");
246 s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index));
248 s = format (s, "entry %u tc %u queue %u",
249 ntohl (mp->entry), ntohl (mp->tc), ntohl (mp->queue));
254 static void *vl_api_bridge_domain_add_del_t_print
255 (vl_api_bridge_domain_add_del_t * mp, void *handle)
259 s = format (0, "SCRIPT: bridge_domain_add_del ");
261 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
265 s = format (s, "flood %d uu-flood %d forward %d learn %d arp-term %d",
266 mp->flood, mp->uu_flood, mp->forward, mp->learn,
270 s = format (s, "del ");
275 static void *vl_api_bridge_domain_dump_t_print
276 (vl_api_bridge_domain_dump_t * mp, void *handle)
279 u32 bd_id = ntohl (mp->bd_id);
281 s = format (0, "SCRIPT: bridge_domain_dump ");
284 s = format (s, "bd_id %d ", bd_id);
289 static void *vl_api_l2fib_add_del_t_print
290 (vl_api_l2fib_add_del_t * mp, void *handle)
294 s = format (0, "SCRIPT: l2fib_add_del ");
296 s = format (s, "mac %U ", format_ethernet_address, &mp->mac);
298 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
303 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
305 s = format (s, "%s", "static ");
307 s = format (s, "%s", "filter ");
309 s = format (s, "%s", "bvi ");
313 s = format (s, "del ");
320 vl_api_l2_flags_t_print (vl_api_l2_flags_t * mp, void *handle)
323 u32 flags = ntohl (mp->feature_bitmap);
325 s = format (0, "SCRIPT: l2_flags ");
327 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
330 if (flags & L2INPUT_FEAT_ ## a) s = format (s, #a " ");
331 foreach_l2input_feat;
337 static void *vl_api_bridge_flags_t_print
338 (vl_api_bridge_flags_t * mp, void *handle)
341 u32 flags = ntohl (mp->feature_bitmap);
343 s = format (0, "SCRIPT: bridge_flags ");
345 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
347 if (flags & L2_LEARN)
348 s = format (s, "learn ");
350 s = format (s, "forward ");
351 if (flags & L2_FLOOD)
352 s = format (s, "flood ");
353 if (flags & L2_UU_FLOOD)
354 s = format (s, "uu-flood ");
355 if (flags & L2_ARP_TERM)
356 s = format (s, "arp-term ");
359 s = format (s, "clear ");
364 static void *vl_api_bd_ip_mac_add_del_t_print
365 (vl_api_bd_ip_mac_add_del_t * mp, void *handle)
369 s = format (0, "SCRIPT: bd_ip_mac_add_del ");
370 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
373 s = format (s, "%U ", format_ip6_address,
374 (ip6_address_t *) mp->ip_address);
376 s = format (s, "%U ", format_ip4_address,
377 (ip4_address_t *) mp->ip_address);
379 s = format (s, "%U ", format_ethernet_address, mp->mac_address);
381 s = format (s, "del ");
386 static void *vl_api_tap_connect_t_print
387 (vl_api_tap_connect_t * mp, void *handle)
392 memset (null_mac, 0, sizeof (null_mac));
394 s = format (0, "SCRIPT: tap_connect ");
395 s = format (s, "tapname %s ", mp->tap_name);
396 if (mp->use_random_mac)
397 s = format (s, "random-mac ");
399 if (memcmp (mp->mac_address, null_mac, 6))
400 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
405 static void *vl_api_tap_modify_t_print
406 (vl_api_tap_modify_t * mp, void *handle)
411 memset (null_mac, 0, sizeof (null_mac));
413 s = format (0, "SCRIPT: tap_modify ");
414 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
415 s = format (s, "tapname %s ", mp->tap_name);
416 if (mp->use_random_mac)
417 s = format (s, "random-mac ");
419 if (memcmp (mp->mac_address, null_mac, 6))
420 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
425 static void *vl_api_tap_delete_t_print
426 (vl_api_tap_delete_t * mp, void *handle)
430 s = format (0, "SCRIPT: tap_delete ");
431 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
436 static void *vl_api_sw_interface_tap_dump_t_print
437 (vl_api_sw_interface_tap_dump_t * mp, void *handle)
441 s = format (0, "SCRIPT: sw_interface_tap_dump ");
447 static void *vl_api_ip_add_del_route_t_print
448 (vl_api_ip_add_del_route_t * mp, void *handle)
452 s = format (0, "SCRIPT: ip_add_del_route ");
454 s = format (s, "del ");
456 if (mp->next_hop_sw_if_index)
457 s = format (s, "sw_if_index %d ", ntohl (mp->next_hop_sw_if_index));
460 s = format (s, "%U/%d ", format_ip6_address, mp->dst_address,
461 mp->dst_address_length);
463 s = format (s, "%U/%d ", format_ip4_address, mp->dst_address,
464 mp->dst_address_length);
466 s = format (s, "local ");
467 else if (mp->is_drop)
468 s = format (s, "drop ");
469 else if (mp->is_classify)
470 s = format (s, "classify %d", ntohl (mp->classify_table_index));
474 s = format (s, "via %U ", format_ip6_address, mp->next_hop_address);
476 s = format (s, "via %U ", format_ip4_address, mp->next_hop_address);
480 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
482 if (mp->create_vrf_if_needed)
483 s = format (s, "create-vrf ");
485 if (mp->resolve_attempts != 0)
486 s = format (s, "resolve-attempts %d ", ntohl (mp->resolve_attempts));
488 if (mp->next_hop_weight != 1)
489 s = format (s, "weight %d ", mp->next_hop_weight);
492 s = format (s, "not-last ");
494 if (mp->is_multipath)
495 s = format (s, "multipath ");
497 if (mp->is_multipath)
498 s = format (s, "multipath ");
500 if (mp->lookup_in_vrf)
501 s = format (s, "lookup-in-vrf %d ", ntohl (mp->lookup_in_vrf));
506 static void *vl_api_proxy_arp_add_del_t_print
507 (vl_api_proxy_arp_add_del_t * mp, void *handle)
511 s = format (0, "SCRIPT: proxy_arp_add_del ");
513 s = format (s, "%U - %U ", format_ip4_address, mp->low_address,
514 format_ip4_address, mp->hi_address);
517 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
520 s = format (s, "del ");
525 static void *vl_api_proxy_arp_intfc_enable_disable_t_print
526 (vl_api_proxy_arp_intfc_enable_disable_t * mp, void *handle)
530 s = format (0, "SCRIPT: proxy_arp_intfc_enable_disable ");
532 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
534 s = format (s, "enable %d ", mp->enable_disable);
539 static void *vl_api_mpls_add_del_decap_t_print
540 (vl_api_mpls_add_del_decap_t * mp, void *handle)
544 s = format (0, "SCRIPT: mpls_add_del_decap ");
546 s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id));
548 s = format (s, "tx_vrf_id %d ", ntohl (mp->tx_vrf_id));
550 s = format (s, "label %d ", ntohl (mp->label));
552 s = format (s, "next-index %d ", ntohl (mp->next_index));
555 s = format (s, "s-bit-clear ");
558 s = format (s, "del ");
563 static void *vl_api_mpls_add_del_encap_t_print
564 (vl_api_mpls_add_del_encap_t * mp, void *handle)
569 s = format (0, "SCRIPT: mpls_add_del_encap ");
571 s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
573 s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
575 for (i = 0; i < mp->nlabels; i++)
576 s = format (s, "label %d ", ntohl (mp->labels[i]));
579 s = format (s, "del ");
584 static void *vl_api_mpls_gre_add_del_tunnel_t_print
585 (vl_api_mpls_gre_add_del_tunnel_t * mp, void *handle)
589 s = format (0, "SCRIPT: mpls_gre_add_del_tunnel ");
591 s = format (s, "src %U ", format_ip4_address, mp->src_address);
593 s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
595 s = format (s, "adj %U/%d ", format_ip4_address,
596 (ip4_address_t *) mp->intfc_address, mp->intfc_address_length);
598 s = format (s, "inner-vrf_id %d ", ntohl (mp->inner_vrf_id));
600 s = format (s, "outer-vrf_id %d ", ntohl (mp->outer_vrf_id));
603 s = format (s, "del ");
606 s = format (s, "l2-only ");
611 static void *vl_api_mpls_ethernet_add_del_tunnel_t_print
612 (vl_api_mpls_ethernet_add_del_tunnel_t * mp, void *handle)
616 s = format (0, "SCRIPT: mpls_ethernet_add_del_tunnel ");
618 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
620 s = format (s, "dst %U", format_ethernet_address, mp->dst_mac_address);
622 s = format (s, "adj %U/%d ", format_ip4_address,
623 (ip4_address_t *) mp->adj_address, mp->adj_address_length);
625 s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
628 s = format (s, "l2-only ");
631 s = format (s, "del ");
636 static void *vl_api_mpls_ethernet_add_del_tunnel_2_t_print
637 (vl_api_mpls_ethernet_add_del_tunnel_2_t * mp, void *handle)
641 s = format (0, "SCRIPT: mpls_ethernet_add_del_tunnel_2 ");
643 s = format (s, "adj %U/%d ", format_ip4_address,
644 (ip4_address_t *) mp->adj_address, mp->adj_address_length);
646 s = format (s, "next-hop %U ", format_ip4_address,
647 (ip4_address_t *) mp->next_hop_ip4_address_in_outer_vrf);
649 s = format (s, "inner_vrf_id %d ", ntohl (mp->inner_vrf_id));
651 s = format (s, "outer_vrf_id %d ", ntohl (mp->outer_vrf_id));
653 s = format (s, "resolve-if-needed %d ", mp->resolve_if_needed);
655 s = format (s, "resolve-attempts %d ", ntohl (mp->resolve_attempts));
658 s = format (s, "l2-only ");
661 s = format (s, "del ");
666 static void *vl_api_sw_interface_set_unnumbered_t_print
667 (vl_api_sw_interface_set_unnumbered_t * mp, void *handle)
671 s = format (0, "SCRIPT: sw_interface_set_unnumbered ");
673 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
675 s = format (s, "unnum_if_index %d ", ntohl (mp->unnumbered_sw_if_index));
678 s = format (s, "del ");
683 static void *vl_api_ip_neighbor_add_del_t_print
684 (vl_api_ip_neighbor_add_del_t * mp, void *handle)
689 memset (null_mac, 0, sizeof (null_mac));
691 s = format (0, "SCRIPT: ip_neighbor_add_del ");
693 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
696 s = format (s, "is_static ");
698 s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
700 if (memcmp (mp->mac_address, null_mac, 6))
701 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
705 format (s, "dst %U ", format_ip6_address,
706 (ip6_address_t *) mp->dst_address);
709 format (s, "dst %U ", format_ip4_address,
710 (ip4_address_t *) mp->dst_address);
713 s = format (s, "del ");
719 vl_api_reset_vrf_t_print (vl_api_reset_vrf_t * mp, void *handle)
723 s = format (0, "SCRIPT: reset_vrf ");
726 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
728 if (mp->is_ipv6 != 0)
729 s = format (s, "ipv6 ");
734 static void *vl_api_create_vlan_subif_t_print
735 (vl_api_create_vlan_subif_t * mp, void *handle)
739 s = format (0, "SCRIPT: create_vlan_subif ");
742 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
745 s = format (s, "vlan_id %d ", ntohl (mp->vlan_id));
750 #define foreach_create_subif_bit \
757 _(outer_vlan_id_any) \
760 static void *vl_api_create_subif_t_print
761 (vl_api_create_subif_t * mp, void *handle)
765 s = format (0, "SCRIPT: create_subif ");
767 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
769 s = format (s, "sub_id %d ", ntohl (mp->sub_id));
771 if (mp->outer_vlan_id)
772 s = format (s, "outer_vlan_id %d ", ntohs (mp->outer_vlan_id));
774 if (mp->inner_vlan_id)
775 s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
777 #define _(a) if (mp->a) s = format (s, "%s ", #a);
778 foreach_create_subif_bit;
784 static void *vl_api_delete_subif_t_print
785 (vl_api_delete_subif_t * mp, void *handle)
789 s = format (0, "SCRIPT: delete_subif ");
790 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
795 static void *vl_api_oam_add_del_t_print
796 (vl_api_oam_add_del_t * mp, void *handle)
800 s = format (0, "SCRIPT: oam_add_del ");
803 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
805 s = format (s, "src %U ", format_ip4_address, mp->src_address);
807 s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
810 s = format (s, "del ");
816 vl_api_reset_fib_t_print (vl_api_reset_fib_t * mp, void *handle)
820 s = format (0, "SCRIPT: reset_fib ");
823 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
825 if (mp->is_ipv6 != 0)
826 s = format (s, "ipv6 ");
831 static void *vl_api_dhcp_proxy_config_t_print
832 (vl_api_dhcp_proxy_config_t * mp, void *handle)
836 s = format (0, "SCRIPT: dhcp_proxy_config ");
838 s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
842 s = format (s, "svr %U ", format_ip6_address,
843 (ip6_address_t *) mp->dhcp_server);
844 s = format (s, "src %U ", format_ip6_address,
845 (ip6_address_t *) mp->dhcp_src_address);
849 s = format (s, "svr %U ", format_ip4_address,
850 (ip4_address_t *) mp->dhcp_server);
851 s = format (s, "src %U ", format_ip4_address,
852 (ip4_address_t *) mp->dhcp_src_address);
855 s = format (s, "del ");
857 s = format (s, "insert-cid %d ", mp->insert_circuit_id);
862 static void *vl_api_dhcp_proxy_config_2_t_print
863 (vl_api_dhcp_proxy_config_2_t * mp, void *handle)
867 s = format (0, "SCRIPT: dhcp_proxy_config_2 ");
869 s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id));
870 s = format (s, "server_vrf_id %d ", ntohl (mp->server_vrf_id));
874 s = format (s, "svr %U ", format_ip6_address,
875 (ip6_address_t *) mp->dhcp_server);
876 s = format (s, "src %U ", format_ip6_address,
877 (ip6_address_t *) mp->dhcp_src_address);
881 s = format (s, "svr %U ", format_ip4_address,
882 (ip4_address_t *) mp->dhcp_server);
883 s = format (s, "src %U ", format_ip4_address,
884 (ip4_address_t *) mp->dhcp_src_address);
887 s = format (s, "del ");
889 s = format (s, "insert-cid %d ", mp->insert_circuit_id);
894 static void *vl_api_dhcp_proxy_set_vss_t_print
895 (vl_api_dhcp_proxy_set_vss_t * mp, void *handle)
899 s = format (0, "SCRIPT: dhcp_proxy_set_vss ");
901 s = format (s, "tbl_id %d ", ntohl (mp->tbl_id));
903 s = format (s, "fib_id %d ", ntohl (mp->fib_id));
905 s = format (s, "oui %d ", ntohl (mp->oui));
907 if (mp->is_ipv6 != 0)
908 s = format (s, "ipv6 ");
911 s = format (s, "del ");
916 static void *vl_api_dhcp_client_config_t_print
917 (vl_api_dhcp_client_config_t * mp, void *handle)
921 s = format (0, "SCRIPT: dhcp_client_config ");
923 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
925 s = format (s, "hostname %s ", mp->hostname);
927 s = format (s, "want_dhcp_event %d ", mp->want_dhcp_event);
929 s = format (s, "pid %d ", mp->pid);
932 s = format (s, "del ");
938 static void *vl_api_set_ip_flow_hash_t_print
939 (vl_api_set_ip_flow_hash_t * mp, void *handle)
943 s = format (0, "SCRIPT: set_ip_flow_hash ");
945 s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
948 s = format (s, "src ");
951 s = format (s, "dst ");
954 s = format (s, "sport ");
957 s = format (s, "dport ");
960 s = format (s, "proto ");
963 s = format (s, "reverse ");
965 if (mp->is_ipv6 != 0)
966 s = format (s, "ipv6 ");
971 static void *vl_api_sw_interface_ip6_set_link_local_address_t_print
972 (vl_api_sw_interface_ip6_set_link_local_address_t * mp, void *handle)
976 s = format (0, "SCRIPT: sw_interface_ip6_set_link_local_address ");
978 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
980 s = format (s, "%U/%d ", format_ip6_address, mp->address,
986 static void *vl_api_sw_interface_ip6nd_ra_prefix_t_print
987 (vl_api_sw_interface_ip6nd_ra_prefix_t * mp, void *handle)
991 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_prefix ");
993 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
995 s = format (s, "%U/%d ", format_ip6_address, mp->address,
998 s = format (s, "val_life %d ", ntohl (mp->val_lifetime));
1000 s = format (s, "pref_life %d ", ntohl (mp->pref_lifetime));
1002 if (mp->use_default)
1003 s = format (s, "def ");
1005 if (mp->no_advertise)
1006 s = format (s, "noadv ");
1009 s = format (s, "offl ");
1011 if (mp->no_autoconfig)
1012 s = format (s, "noauto ");
1015 s = format (s, "nolink ");
1018 s = format (s, "isno ");
1023 static void *vl_api_sw_interface_ip6nd_ra_config_t_print
1024 (vl_api_sw_interface_ip6nd_ra_config_t * mp, void *handle)
1028 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_config ");
1030 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1032 s = format (s, "maxint %d ", ntohl (mp->max_interval));
1034 s = format (s, "minint %d ", ntohl (mp->min_interval));
1036 s = format (s, "life %d ", ntohl (mp->lifetime));
1038 s = format (s, "count %d ", ntohl (mp->initial_count));
1040 s = format (s, "interval %d ", ntohl (mp->initial_interval));
1043 s = format (s, "suppress ");
1046 s = format (s, "managed ");
1049 s = format (s, "other ");
1052 s = format (s, "ll ");
1054 if (mp->send_unicast)
1055 s = format (s, "send ");
1058 s = format (s, "cease ");
1061 s = format (s, "isno ");
1063 if (mp->default_router)
1064 s = format (s, "def ");
1069 static void *vl_api_set_arp_neighbor_limit_t_print
1070 (vl_api_set_arp_neighbor_limit_t * mp, void *handle)
1074 s = format (0, "SCRIPT: set_arp_neighbor_limit ");
1076 s = format (s, "arp_nbr_limit %d ", ntohl (mp->arp_neighbor_limit));
1078 if (mp->is_ipv6 != 0)
1079 s = format (s, "ipv6 ");
1084 static void *vl_api_l2_patch_add_del_t_print
1085 (vl_api_l2_patch_add_del_t * mp, void *handle)
1089 s = format (0, "SCRIPT: l2_patch_add_del ");
1091 s = format (s, "rx_sw_if_index %d ", ntohl (mp->rx_sw_if_index));
1093 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
1095 if (mp->is_add == 0)
1096 s = format (s, "del ");
1101 static void *vl_api_sr_tunnel_add_del_t_print
1102 (vl_api_sr_tunnel_add_del_t * mp, void *handle)
1105 ip6_address_t *this_address;
1107 u16 flags_host_byte_order;
1110 s = format (0, "SCRIPT: sr_tunnel_add_del ");
1113 s = format (s, "name %s ", mp->name);
1115 s = format (s, "src %U dst %U/%d ", format_ip6_address,
1116 (ip6_address_t *) mp->src_address,
1118 (ip6_address_t *) mp->dst_address, mp->dst_mask_width);
1120 this_address = (ip6_address_t *) mp->segs_and_tags;
1121 for (i = 0; i < mp->n_segments; i++)
1123 s = format (s, "next %U ", format_ip6_address, this_address);
1126 for (i = 0; i < mp->n_tags; i++)
1128 s = format (s, "tag %U ", format_ip6_address, this_address);
1132 flags_host_byte_order = clib_net_to_host_u16 (mp->flags_net_byte_order);
1134 if (flags_host_byte_order & IP6_SR_HEADER_FLAG_CLEANUP)
1135 s = format (s, " clean ");
1137 if (flags_host_byte_order & IP6_SR_HEADER_FLAG_PROTECTED)
1138 s = format (s, "protected ");
1140 for (i = 1; i <= 4; i++)
1142 pl_flag = ip6_sr_policy_list_flags (flags_host_byte_order, i);
1146 case IP6_SR_HEADER_FLAG_PL_ELT_NOT_PRESENT:
1149 case IP6_SR_HEADER_FLAG_PL_ELT_INGRESS_PE:
1150 s = format (s, "InPE %d ", i);
1153 case IP6_SR_HEADER_FLAG_PL_ELT_EGRESS_PE:
1154 s = format (s, "EgPE %d ", i);
1157 case IP6_SR_HEADER_FLAG_PL_ELT_ORIG_SRC_ADDR:
1158 s = format (s, "OrgSrc %d ", i);
1162 clib_warning ("BUG: pl elt %d value %d", i, pl_flag);
1167 if (mp->policy_name[0])
1168 s = format (s, "policy_name %s ", mp->policy_name);
1170 if (mp->is_add == 0)
1171 s = format (s, "del ");
1176 static void *vl_api_sr_policy_add_del_t_print
1177 (vl_api_sr_policy_add_del_t * mp, void *handle)
1182 s = format (0, "SCRIPT: sr_policy_add_del ");
1185 s = format (s, "name %s ", mp->name);
1188 if (mp->tunnel_names[0])
1190 // start deserializing tunnel_names
1191 int num_tunnels = mp->tunnel_names[0]; //number of tunnels
1192 u8 *deser_tun_names = mp->tunnel_names;
1193 deser_tun_names += 1; //moving along
1196 int tun_name_len = 0;
1198 for (i = 0; i < num_tunnels; i++)
1200 tun_name_len = *deser_tun_names;
1201 deser_tun_names += 1;
1202 vec_resize (tun_name, tun_name_len);
1203 memcpy (tun_name, deser_tun_names, tun_name_len);
1204 s = format (s, "tunnel %s ", tun_name);
1205 deser_tun_names += tun_name_len;
1210 if (mp->is_add == 0)
1211 s = format (s, "del ");
1216 static void *vl_api_sr_multicast_map_add_del_t_print
1217 (vl_api_sr_multicast_map_add_del_t * mp, void *handle)
1223 s = format (0, "SCRIPT: sr_multicast_map_add_del ");
1225 if (mp->multicast_address[0])
1226 s = format (s, "address %U ", format_ip6_address, &mp->multicast_address);
1228 if (mp->policy_name[0])
1229 s = format (s, "sr-policy %s ", &mp->policy_name);
1232 if (mp->is_add == 0)
1233 s = format (s, "del ");
1239 static void *vl_api_classify_add_del_table_t_print
1240 (vl_api_classify_add_del_table_t * mp, void *handle)
1245 s = format (0, "SCRIPT: classify_add_del_table ");
1247 if (mp->is_add == 0)
1249 s = format (s, "table %d ", ntohl (mp->table_index));
1250 s = format (s, "del ");
1254 s = format (s, "nbuckets %d ", ntohl (mp->nbuckets));
1255 s = format (s, "memory_size %d ", ntohl (mp->memory_size));
1256 s = format (s, "skip %d ", ntohl (mp->skip_n_vectors));
1257 s = format (s, "match %d ", ntohl (mp->match_n_vectors));
1258 s = format (s, "next-table %d ", ntohl (mp->next_table_index));
1259 s = format (s, "miss-next %d ", ntohl (mp->miss_next_index));
1260 s = format (s, "mask hex ");
1261 for (i = 0; i < ntohl (mp->match_n_vectors) * sizeof (u32x4); i++)
1262 s = format (s, "%02x", mp->mask[i]);
1269 static void *vl_api_classify_add_del_session_t_print
1270 (vl_api_classify_add_del_session_t * mp, void *handle)
1275 s = format (0, "SCRIPT: classify_add_del_session ");
1277 s = format (s, "table_index %d ", ntohl (mp->table_index));
1278 s = format (s, "hit_next_index %d ", ntohl (mp->hit_next_index));
1279 s = format (s, "opaque_index %d ", ntohl (mp->opaque_index));
1280 s = format (s, "advance %d ", ntohl (mp->advance));
1281 if (mp->is_add == 0)
1282 s = format (s, "del ");
1284 s = format (s, "match hex ");
1285 for (i = 5 * sizeof (u32x4) - 1; i > 0; i--)
1287 if (mp->match[i] != 0)
1294 for (i = 0; i < limit; i++)
1295 s = format (s, "%02x", mp->match[i]);
1300 static void *vl_api_classify_set_interface_ip_table_t_print
1301 (vl_api_classify_set_interface_ip_table_t * mp, void *handle)
1305 s = format (0, "SCRIPT: classify_set_interface_ip_table ");
1308 s = format (s, "ipv6 ");
1310 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1311 s = format (s, "table %d ", ntohl (mp->table_index));
1316 static void *vl_api_classify_set_interface_l2_tables_t_print
1317 (vl_api_classify_set_interface_l2_tables_t * mp, void *handle)
1321 s = format (0, "SCRIPT: classify_set_interface_l2_tables ");
1323 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1324 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1325 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1326 s = format (s, "other-table %d ", ntohl (mp->other_table_index));
1327 s = format (s, "is-input %d ", mp->is_input);
1332 static void *vl_api_add_node_next_t_print
1333 (vl_api_add_node_next_t * mp, void *handle)
1337 s = format (0, "SCRIPT: add_node_next ");
1339 s = format (0, "node %s next %s ", mp->node_name, mp->next_name);
1344 static void *vl_api_l2tpv3_create_tunnel_t_print
1345 (vl_api_l2tpv3_create_tunnel_t * mp, void *handle)
1349 s = format (0, "SCRIPT: l2tpv3_create_tunnel ");
1351 s = format (s, "client_address %U our_address %U ",
1352 format_ip6_address, (ip6_address_t *) (mp->client_address),
1353 format_ip6_address, (ip6_address_t *) (mp->our_address));
1354 s = format (s, "local_session_id %d ", ntohl (mp->local_session_id));
1355 s = format (s, "remote_session_id %d ", ntohl (mp->remote_session_id));
1356 s = format (s, "local_cookie %lld ",
1357 clib_net_to_host_u64 (mp->local_cookie));
1358 s = format (s, "remote_cookie %lld ",
1359 clib_net_to_host_u64 (mp->remote_cookie));
1360 if (mp->l2_sublayer_present)
1361 s = format (s, "l2-sublayer-present ");
1366 static void *vl_api_l2tpv3_set_tunnel_cookies_t_print
1367 (vl_api_l2tpv3_set_tunnel_cookies_t * mp, void *handle)
1371 s = format (0, "SCRIPT: l2tpv3_set_tunnel_cookies ");
1373 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1375 s = format (s, "new_local_cookie %llu ",
1376 clib_net_to_host_u64 (mp->new_local_cookie));
1378 s = format (s, "new_remote_cookie %llu ",
1379 clib_net_to_host_u64 (mp->new_remote_cookie));
1384 static void *vl_api_l2tpv3_interface_enable_disable_t_print
1385 (vl_api_l2tpv3_interface_enable_disable_t * mp, void *handle)
1389 s = format (0, "SCRIPT: l2tpv3_interface_enable_disable ");
1391 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1393 if (mp->enable_disable == 0)
1394 s = format (s, "del ");
1399 static void *vl_api_l2tpv3_set_lookup_key_t_print
1400 (vl_api_l2tpv3_set_lookup_key_t * mp, void *handle)
1403 char *str = "unknown";
1405 s = format (0, "SCRIPT: l2tpv3_set_lookup_key ");
1409 case L2T_LOOKUP_SRC_ADDRESS:
1410 str = "lookup_v6_src";
1412 case L2T_LOOKUP_DST_ADDRESS:
1413 str = "lookup_v6_dst";
1415 case L2T_LOOKUP_SESSION_ID:
1416 str = "lookup_session_id";
1422 s = format (s, "%s ", str);
1427 static void *vl_api_sw_if_l2tpv3_tunnel_dump_t_print
1428 (vl_api_sw_if_l2tpv3_tunnel_dump_t * mp, void *handle)
1432 s = format (0, "SCRIPT: sw_if_l2tpv3_tunnel_dump ");
1437 static void *vl_api_vxlan_add_del_tunnel_t_print
1438 (vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
1442 s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
1446 s = format (s, "src %U ", format_ip6_address,
1447 (ip6_address_t *) mp->src_address);
1448 s = format (s, "dst %U ", format_ip6_address,
1449 (ip6_address_t *) mp->dst_address);
1453 s = format (s, "src %U ", format_ip4_address,
1454 (ip4_address_t *) mp->src_address);
1455 s = format (s, "dst %U ", format_ip4_address,
1456 (ip4_address_t *) mp->dst_address);
1459 if (mp->encap_vrf_id)
1460 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1462 s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1464 s = format (s, "vni %d ", ntohl (mp->vni));
1466 if (mp->is_add == 0)
1467 s = format (s, "del ");
1469 if (mp->is_add == 0)
1470 s = format (s, "del ");
1475 static void *vl_api_vxlan_tunnel_dump_t_print
1476 (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1480 s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1482 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1487 static void *vl_api_gre_add_del_tunnel_t_print
1488 (vl_api_gre_add_del_tunnel_t * mp, void *handle)
1492 s = format (0, "SCRIPT: gre_add_del_tunnel ");
1494 s = format (s, "dst %U ", format_ip46_address,
1495 (ip46_address_t *) & (mp->dst_address),
1496 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1498 s = format (s, "src %U ", format_ip46_address,
1499 (ip46_address_t *) & (mp->src_address),
1500 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1503 s = format (s, "teb ");
1505 if (mp->outer_fib_id)
1506 s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
1508 if (mp->is_add == 0)
1509 s = format (s, "del ");
1514 static void *vl_api_gre_tunnel_dump_t_print
1515 (vl_api_gre_tunnel_dump_t * mp, void *handle)
1519 s = format (0, "SCRIPT: gre_tunnel_dump ");
1521 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1526 static void *vl_api_l2_fib_clear_table_t_print
1527 (vl_api_l2_fib_clear_table_t * mp, void *handle)
1531 s = format (0, "SCRIPT: l2_fib_clear_table ");
1536 static void *vl_api_l2_interface_efp_filter_t_print
1537 (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1541 s = format (0, "SCRIPT: l2_interface_efp_filter ");
1543 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1544 if (mp->enable_disable)
1545 s = format (s, "enable ");
1547 s = format (s, "disable ");
1552 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1553 (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1557 s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1559 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1560 s = format (s, "vtr_op %d ", ntohl (mp->vtr_op));
1561 s = format (s, "push_dot1q %d ", ntohl (mp->push_dot1q));
1562 s = format (s, "tag1 %d ", ntohl (mp->tag1));
1563 s = format (s, "tag2 %d ", ntohl (mp->tag2));
1568 static void *vl_api_create_vhost_user_if_t_print
1569 (vl_api_create_vhost_user_if_t * mp, void *handle)
1573 s = format (0, "SCRIPT: create_vhost_user_if ");
1575 s = format (s, "socket %s ", mp->sock_filename);
1577 s = format (s, "server ");
1579 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1584 static void *vl_api_modify_vhost_user_if_t_print
1585 (vl_api_modify_vhost_user_if_t * mp, void *handle)
1589 s = format (0, "SCRIPT: modify_vhost_user_if ");
1591 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1592 s = format (s, "socket %s ", mp->sock_filename);
1594 s = format (s, "server ");
1596 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1601 static void *vl_api_delete_vhost_user_if_t_print
1602 (vl_api_delete_vhost_user_if_t * mp, void *handle)
1606 s = format (0, "SCRIPT: delete_vhost_user_if ");
1607 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1612 static void *vl_api_sw_interface_vhost_user_dump_t_print
1613 (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
1617 s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
1622 static void *vl_api_sw_interface_dump_t_print
1623 (vl_api_sw_interface_dump_t * mp, void *handle)
1627 s = format (0, "SCRIPT: sw_interface_dump ");
1629 if (mp->name_filter_valid)
1630 s = format (s, "name_filter %s ", mp->name_filter);
1632 s = format (s, "all ");
1637 static void *vl_api_l2_fib_table_dump_t_print
1638 (vl_api_l2_fib_table_dump_t * mp, void *handle)
1642 s = format (0, "SCRIPT: l2_fib_table_dump ");
1644 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
1649 static void *vl_api_control_ping_t_print
1650 (vl_api_control_ping_t * mp, void *handle)
1654 s = format (0, "SCRIPT: control_ping ");
1659 static void *vl_api_want_interface_events_t_print
1660 (vl_api_want_interface_events_t * mp, void *handle)
1664 s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
1665 ntohl (mp->pid), ntohl (mp->enable_disable));
1670 static void *vl_api_cli_request_t_print
1671 (vl_api_cli_request_t * mp, void *handle)
1675 s = format (0, "SCRIPT: cli_request ");
1680 static void *vl_api_cli_inband_t_print
1681 (vl_api_cli_inband_t * mp, void *handle)
1685 s = format (0, "SCRIPT: cli_inband ");
1690 static void *vl_api_memclnt_create_t_print
1691 (vl_api_memclnt_create_t * mp, void *handle)
1695 s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
1700 static void *vl_api_show_version_t_print
1701 (vl_api_show_version_t * mp, void *handle)
1705 s = format (0, "SCRIPT: show_version ");
1710 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
1711 (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
1715 s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
1717 s = format (s, "local %U ", format_ip46_address, &mp->local, mp->is_ipv6);
1719 s = format (s, "remote %U ", format_ip46_address, &mp->remote, mp->is_ipv6);
1721 s = format (s, "protocol %d ", ntohl (mp->protocol));
1723 s = format (s, "vni %d ", ntohl (mp->vni));
1725 if (mp->is_add == 0)
1726 s = format (s, "del ");
1728 if (mp->encap_vrf_id)
1729 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1731 if (mp->decap_vrf_id)
1732 s = format (s, "decap-vrf-id %d ", ntohl (mp->decap_vrf_id));
1737 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
1738 (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
1742 s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
1744 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1749 static void *vl_api_interface_name_renumber_t_print
1750 (vl_api_interface_name_renumber_t * mp, void *handle)
1754 s = format (0, "SCRIPT: interface_renumber ");
1756 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1758 s = format (s, "new_show_dev_instance %d ",
1759 ntohl (mp->new_show_dev_instance));
1764 static void *vl_api_want_ip4_arp_events_t_print
1765 (vl_api_want_ip4_arp_events_t * mp, void *handle)
1769 s = format (0, "SCRIPT: want_ip4_arp_events ");
1770 s = format (s, "pid %d address %U ", mp->pid,
1771 format_ip4_address, &mp->address);
1772 if (mp->enable_disable == 0)
1773 s = format (s, "del ");
1778 static void *vl_api_want_ip6_nd_events_t_print
1779 (vl_api_want_ip6_nd_events_t * mp, void *handle)
1783 s = format (0, "SCRIPT: want_ip6_nd_events ");
1784 s = format (s, "pid %d address %U ", mp->pid,
1785 format_ip6_address, mp->address);
1786 if (mp->enable_disable == 0)
1787 s = format (s, "del ");
1792 static void *vl_api_input_acl_set_interface_t_print
1793 (vl_api_input_acl_set_interface_t * mp, void *handle)
1797 s = format (0, "SCRIPT: input_acl_set_interface ");
1799 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1800 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1801 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1802 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
1804 if (mp->is_add == 0)
1805 s = format (s, "del ");
1810 static void *vl_api_ip_address_dump_t_print
1811 (vl_api_ip_address_dump_t * mp, void *handle)
1815 s = format (0, "SCRIPT: ip6_address_dump ");
1816 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1817 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1823 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
1827 s = format (0, "SCRIPT: ip_dump ");
1828 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1833 static void *vl_api_cop_interface_enable_disable_t_print
1834 (vl_api_cop_interface_enable_disable_t * mp, void *handle)
1838 s = format (0, "SCRIPT: cop_interface_enable_disable ");
1839 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1840 if (mp->enable_disable)
1841 s = format (s, "enable ");
1843 s = format (s, "disable ");
1848 static void *vl_api_cop_whitelist_enable_disable_t_print
1849 (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
1853 s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
1854 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1855 s = format (s, "fib-id %d ", ntohl (mp->fib_id));
1857 s = format (s, "ip4 ");
1859 s = format (s, "ip6 ");
1860 if (mp->default_cop)
1861 s = format (s, "default ");
1866 static void *vl_api_af_packet_create_t_print
1867 (vl_api_af_packet_create_t * mp, void *handle)
1871 s = format (0, "SCRIPT: af_packet_create ");
1872 s = format (s, "host_if_name %s ", mp->host_if_name);
1873 if (mp->use_random_hw_addr)
1874 s = format (s, "hw_addr random ");
1876 s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
1881 static void *vl_api_af_packet_delete_t_print
1882 (vl_api_af_packet_delete_t * mp, void *handle)
1886 s = format (0, "SCRIPT: af_packet_delete ");
1887 s = format (s, "host_if_name %s ", mp->host_if_name);
1893 format_policer_action (u8 * s, va_list * va)
1895 u32 action = va_arg (*va, u32);
1896 u32 dscp = va_arg (*va, u32);
1899 if (action == SSE2_QOS_ACTION_DROP)
1900 s = format (s, "drop");
1901 else if (action == SSE2_QOS_ACTION_TRANSMIT)
1902 s = format (s, "transmit");
1903 else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
1905 s = format (s, "mark-and-transmit ");
1908 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
1914 s = format (s, "%s", t);
1920 static void *vl_api_policer_add_del_t_print
1921 (vl_api_policer_add_del_t * mp, void *handle)
1925 s = format (0, "SCRIPT: policer_add_del ");
1926 s = format (s, "name %s ", mp->name);
1927 s = format (s, "cir %d ", mp->cir);
1928 s = format (s, "eir %d ", mp->eir);
1929 s = format (s, "cb %d ", mp->cb);
1930 s = format (s, "eb %d ", mp->eb);
1932 switch (mp->rate_type)
1934 case SSE2_QOS_RATE_KBPS:
1935 s = format (s, "rate_type kbps ");
1937 case SSE2_QOS_RATE_PPS:
1938 s = format (s, "rate_type pps ");
1944 switch (mp->round_type)
1946 case SSE2_QOS_ROUND_TO_CLOSEST:
1947 s = format (s, "round_type closest ");
1949 case SSE2_QOS_ROUND_TO_UP:
1950 s = format (s, "round_type up ");
1952 case SSE2_QOS_ROUND_TO_DOWN:
1953 s = format (s, "round_type down ");
1961 case SSE2_QOS_POLICER_TYPE_1R2C:
1962 s = format (s, "type 1r2c ");
1964 case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
1965 s = format (s, "type 1r3c ");
1967 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
1968 s = format (s, "type 2r3c-2698 ");
1970 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
1971 s = format (s, "type 2r3c-4115 ");
1973 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
1974 s = format (s, "type 2r3c-mef5cf1 ");
1980 s = format (s, "conform_action %U ", format_policer_action,
1981 mp->conform_action_type, mp->conform_dscp);
1982 s = format (s, "exceed_action %U ", format_policer_action,
1983 mp->exceed_action_type, mp->exceed_dscp);
1984 s = format (s, "violate_action %U ", format_policer_action,
1985 mp->violate_action_type, mp->violate_dscp);
1987 if (mp->color_aware)
1988 s = format (s, "color-aware ");
1989 if (mp->is_add == 0)
1990 s = format (s, "del ");
1995 static void *vl_api_policer_dump_t_print
1996 (vl_api_policer_dump_t * mp, void *handle)
2000 s = format (0, "SCRIPT: policer_dump ");
2001 if (mp->match_name_valid)
2002 s = format (s, "name %s ", mp->match_name);
2007 static void *vl_api_policer_classify_set_interface_t_print
2008 (vl_api_policer_classify_set_interface_t * mp, void *handle)
2012 s = format (0, "SCRIPT: policer_classify_set_interface ");
2013 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2014 if (mp->ip4_table_index != ~0)
2015 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2016 if (mp->ip6_table_index != ~0)
2017 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2018 if (mp->l2_table_index != ~0)
2019 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2020 if (mp->is_add == 0)
2021 s = format (s, "del ");
2026 static void *vl_api_policer_classify_dump_t_print
2027 (vl_api_policer_classify_dump_t * mp, void *handle)
2031 s = format (0, "SCRIPT: policer_classify_dump ");
2034 case POLICER_CLASSIFY_TABLE_IP4:
2035 s = format (s, "type ip4 ");
2037 case POLICER_CLASSIFY_TABLE_IP6:
2038 s = format (s, "type ip6 ");
2040 case POLICER_CLASSIFY_TABLE_L2:
2041 s = format (s, "type l2 ");
2050 static void *vl_api_sw_interface_clear_stats_t_print
2051 (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2055 s = format (0, "SCRIPT: sw_interface_clear_stats ");
2056 if (mp->sw_if_index != ~0)
2057 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2062 static void *vl_api_mpls_gre_tunnel_dump_t_print
2063 (vl_api_mpls_gre_tunnel_dump_t * mp, void *handle)
2067 s = format (0, "SCRIPT: mpls_gre_tunnel_dump ");
2069 s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
2074 static void *vl_api_mpls_eth_tunnel_dump_t_print
2075 (vl_api_mpls_eth_tunnel_dump_t * mp, void *handle)
2079 s = format (0, "SCRIPT: mpls_eth_tunnel_dump ");
2081 s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
2086 static void *vl_api_mpls_fib_encap_dump_t_print
2087 (vl_api_mpls_fib_encap_dump_t * mp, void *handle)
2091 s = format (0, "SCRIPT: mpls_fib_encap_dump ");
2096 static void *vl_api_mpls_fib_decap_dump_t_print
2097 (vl_api_mpls_fib_decap_dump_t * mp, void *handle)
2101 s = format (0, "SCRIPT: mpls_fib_decap_dump ");
2106 static void *vl_api_classify_table_ids_t_print
2107 (vl_api_classify_table_ids_t * mp, void *handle)
2111 s = format (0, "SCRIPT: classify_table_ids ");
2116 static void *vl_api_classify_table_by_interface_t_print
2117 (vl_api_classify_table_by_interface_t * mp, void *handle)
2121 s = format (0, "SCRIPT: classify_table_by_interface ");
2122 if (mp->sw_if_index != ~0)
2123 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2128 static void *vl_api_classify_table_info_t_print
2129 (vl_api_classify_table_info_t * mp, void *handle)
2133 s = format (0, "SCRIPT: classify_table_info ");
2134 if (mp->table_id != ~0)
2135 s = format (s, "table_id %d ", ntohl (mp->table_id));
2140 static void *vl_api_classify_session_dump_t_print
2141 (vl_api_classify_session_dump_t * mp, void *handle)
2145 s = format (0, "SCRIPT: classify_session_dump ");
2146 if (mp->table_id != ~0)
2147 s = format (s, "table_id %d ", ntohl (mp->table_id));
2152 static void *vl_api_set_ipfix_exporter_t_print
2153 (vl_api_set_ipfix_exporter_t * mp, void *handle)
2157 s = format (0, "SCRIPT: set_ipfix_exporter ");
2159 s = format (s, "collector-address %U ", format_ip4_address,
2160 (ip4_address_t *) mp->collector_address);
2161 s = format (s, "collector-port %d ", ntohs (mp->collector_port));
2162 s = format (s, "src-address %U ", format_ip4_address,
2163 (ip4_address_t *) mp->src_address);
2164 s = format (s, "vrf-id %d ", ntohl (mp->vrf_id));
2165 s = format (s, "path-mtu %d ", ntohl (mp->path_mtu));
2166 s = format (s, "template-interval %d ", ntohl (mp->template_interval));
2167 s = format (s, "udp-checksum %d ", mp->udp_checksum);
2172 static void *vl_api_ipfix_exporter_dump_t_print
2173 (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2177 s = format (0, "SCRIPT: ipfix_exporter_dump ");
2182 static void *vl_api_set_ipfix_classify_stream_t_print
2183 (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2187 s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2189 s = format (s, "domain-id %d ", ntohl (mp->domain_id));
2190 s = format (s, "src-port %d ", ntohs (mp->src_port));
2195 static void *vl_api_ipfix_classify_stream_dump_t_print
2196 (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2200 s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2205 static void *vl_api_ipfix_classify_table_add_del_t_print
2206 (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2210 s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2212 s = format (s, "table-id %d ", ntohl (mp->table_id));
2213 s = format (s, "ip-version %d ", mp->ip_version);
2214 s = format (s, "transport-protocol %d ", mp->transport_protocol);
2219 static void *vl_api_ipfix_classify_table_dump_t_print
2220 (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2224 s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2229 static void *vl_api_get_next_index_t_print
2230 (vl_api_get_next_index_t * mp, void *handle)
2234 s = format (0, "SCRIPT: get_next_index ");
2235 s = format (s, "node-name %s ", mp->node_name);
2236 s = format (s, "next-node-name %s ", mp->next_name);
2241 static void *vl_api_pg_create_interface_t_print
2242 (vl_api_pg_create_interface_t * mp, void *handle)
2246 s = format (0, "SCRIPT: pg_create_interface ");
2247 s = format (0, "if_id %d", ntohl (mp->interface_id));
2252 static void *vl_api_pg_capture_t_print
2253 (vl_api_pg_capture_t * mp, void *handle)
2257 s = format (0, "SCRIPT: pg_capture ");
2258 s = format (0, "if_id %d ", ntohl (mp->interface_id));
2259 s = format (0, "pcap %s", mp->pcap_file_name);
2260 if (mp->count != ~0)
2261 s = format (s, "count %d ", ntohl (mp->count));
2262 if (!mp->is_enabled)
2263 s = format (s, "disable");
2268 static void *vl_api_pg_enable_disable_t_print
2269 (vl_api_pg_enable_disable_t * mp, void *handle)
2273 s = format (0, "SCRIPT: pg_enable_disable ");
2274 if (ntohl (mp->stream_name_length) > 0)
2275 s = format (s, "stream %s", mp->stream_name);
2276 if (!mp->is_enabled)
2277 s = format (s, "disable");
2282 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2283 (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2288 s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2290 s = format (s, "%U/%d ", format_ip6_address, mp->address,
2293 s = format (s, "%U/%d ", format_ip4_address, mp->address,
2296 for (i = 0; i < mp->number_of_ranges; i++)
2298 s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2301 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
2303 if (mp->is_add == 0)
2304 s = format (s, "del ");
2309 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2310 (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2315 s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2317 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2319 if (mp->tcp_out_vrf_id != ~0)
2320 s = format (s, "tcp-out-vrf %d ", ntohl (mp->tcp_out_vrf_id));
2322 if (mp->udp_out_vrf_id != ~0)
2323 s = format (s, "udp-out-vrf %d ", ntohl (mp->udp_out_vrf_id));
2325 if (mp->tcp_in_vrf_id != ~0)
2326 s = format (s, "tcp-in-vrf %d ", ntohl (mp->tcp_in_vrf_id));
2328 if (mp->udp_in_vrf_id != ~0)
2329 s = format (s, "udp-in-vrf %d ", ntohl (mp->udp_in_vrf_id));
2331 if (mp->is_add == 0)
2332 s = format (s, "del ");
2337 static void *vl_api_lisp_enable_disable_t_print
2338 (vl_api_lisp_enable_disable_t * mp, void *handle)
2342 s = format (0, "SCRIPT: lisp_enable_disable %s",
2343 mp->is_en ? "enable" : "disable");
2348 static void *vl_api_lisp_gpe_add_del_iface_t_print
2349 (vl_api_lisp_gpe_add_del_iface_t * mp, void *handle)
2353 s = format (0, "SCRIPT: lisp_gpe_add_del_iface ");
2355 s = format (s, "%s ", mp->is_add ? "up" : "down");
2356 s = format (s, "vni %d ", mp->vni);
2357 s = format (s, "%s %d ", mp->is_l2 ? "bd_id" : "table_id", mp->dp_table);
2362 static void *vl_api_lisp_pitr_set_locator_set_t_print
2363 (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
2367 s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
2370 s = format (s, "locator-set %s ", mp->ls_name);
2372 s = format (s, "del");
2378 format_lisp_flat_eid (u8 * s, va_list * args)
2380 u32 type = va_arg (*args, u32);
2381 u8 *eid = va_arg (*args, u8 *);
2382 u32 eid_len = va_arg (*args, u32);
2387 return format (s, "%U/%d", format_ip4_address, eid, eid_len);
2389 return format (s, "%U/%d", format_ip6_address, eid, eid_len);
2391 return format (s, "%U", format_ethernet_address, eid);
2396 /** Used for transferring locators via VPP API */
2397 typedef CLIB_PACKED (struct
2400 /**< is locator an IPv4 address */
2402 /**< locator priority */
2404 /**< locator weight */
2406 /**< IPv4/IPv6 address */
2410 format_rloc (u8 * s, va_list * args)
2412 rloc_t *rloc = va_arg (*args, rloc_t *);
2415 s = format (s, "%U ", format_ip4_address, rloc->addr);
2417 s = format (s, "%U ", format_ip6_address, rloc->addr);
2419 s = format (s, "p %d w %d", rloc->priority, rloc->weight);
2424 static void *vl_api_lisp_add_del_remote_mapping_t_print
2425 (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
2428 u32 i, rloc_num = 0;
2430 s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
2433 s = format (s, "del-all ");
2435 s = format (s, "%s ", mp->is_add ? "add" : "del");
2436 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2438 s = format (s, "eid %U ", format_lisp_flat_eid,
2439 mp->eid_type, mp->eid, mp->eid_len);
2443 s = format (s, "seid %U ", format_lisp_flat_eid,
2444 mp->eid_type, mp->seid, mp->seid_len);
2447 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
2450 s = format (s, "action %d", mp->action);
2453 rloc_t *rloc = (rloc_t *) mp->rlocs;
2454 for (i = 0; i < rloc_num; i++)
2455 s = format (s, "%U ", format_rloc, &rloc[i]);
2461 static void *vl_api_lisp_add_del_adjacency_t_print
2462 (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
2466 s = format (0, "SCRIPT: lisp_add_del_adjacency ");
2468 s = format (s, "%s ", mp->is_add ? "add" : "del");
2469 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2470 s = format (s, "reid %U leid %U ",
2471 format_lisp_flat_eid, mp->eid_type, mp->reid, mp->reid_len,
2472 format_lisp_flat_eid, mp->eid_type, mp->leid, mp->leid_len);
2477 static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
2478 (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
2482 s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
2485 s = format (s, "%s", mp->locator_set_name);
2487 s = format (s, "del");
2492 static void *vl_api_lisp_eid_table_add_del_map_t_print
2493 (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
2497 s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
2500 s = format (s, "del ");
2502 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2503 s = format (s, "%s %d ",
2504 mp->is_l2 ? "bd_index" : "vrf",
2505 clib_net_to_host_u32 (mp->dp_table));
2509 static void *vl_api_lisp_add_del_local_eid_t_print
2510 (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
2514 s = format (0, "SCRIPT: lisp_add_del_local_eid ");
2517 s = format (s, "del ");
2519 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2520 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
2522 s = format (s, "locator-set %s ", mp->locator_set_name);
2526 static void *vl_api_lisp_gpe_add_del_fwd_entry_t_print
2527 (vl_api_lisp_gpe_add_del_fwd_entry_t * mp, void *handle)
2531 s = format (0, "SCRIPT: lisp_gpe_add_del_fwd_entry TODO");
2536 static void *vl_api_lisp_add_del_map_resolver_t_print
2537 (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
2541 s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
2544 s = format (s, "del ");
2547 s = format (s, "%U ", format_ip6_address, mp->ip_address);
2549 s = format (s, "%U ", format_ip4_address, mp->ip_address);
2554 static void *vl_api_lisp_gpe_enable_disable_t_print
2555 (vl_api_lisp_gpe_enable_disable_t * mp, void *handle)
2559 s = format (0, "SCRIPT: lisp_gpe_enable_disable ");
2561 s = format (s, "%s ", mp->is_en ? "enable" : "disable");
2566 typedef CLIB_PACKED (struct
2569 /**< locator sw_if_index */
2571 /**< locator priority */
2573 /**< locator weight */
2577 format_locator (u8 * s, va_list * args)
2579 ls_locator_t *l = va_arg (*args, ls_locator_t *);
2581 return format (s, "sw_if_index %d p %d w %d",
2582 l->sw_if_index, l->priority, l->weight);
2585 static void *vl_api_lisp_add_del_locator_set_t_print
2586 (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
2592 s = format (0, "SCRIPT: lisp_add_del_locator_set ");
2595 s = format (s, "del ");
2597 s = format (s, "locator-set %s ", mp->locator_set_name);
2599 loc_num = clib_net_to_host_u32 (mp->locator_num);
2600 locs = (ls_locator_t *) mp->locators;
2602 for (i = 0; i < loc_num; i++)
2603 s = format (s, "%U ", format_locator, &locs[i]);
2608 static void *vl_api_lisp_add_del_locator_t_print
2609 (vl_api_lisp_add_del_locator_t * mp, void *handle)
2613 s = format (0, "SCRIPT: lisp_add_del_locator ");
2616 s = format (s, "del ");
2618 s = format (s, "locator-set %s ", mp->locator_set_name);
2619 s = format (s, "sw_if_index %d ", mp->sw_if_index);
2620 s = format (s, "p %d w %d ", mp->priority, mp->weight);
2625 static void *vl_api_lisp_locator_set_dump_t_print
2626 (vl_api_lisp_locator_set_dump_t * mp, void *handle)
2630 s = format (0, "SCRIPT: lisp_locator_set_dump ");
2631 if (mp->filter == 1)
2632 s = format (s, "local");
2633 else if (mp->filter == 2)
2634 s = format (s, "remote");
2639 static void *vl_api_lisp_locator_dump_t_print
2640 (vl_api_lisp_locator_dump_t * mp, void *handle)
2644 s = format (0, "SCRIPT: lisp_locator_dump ");
2645 if (mp->is_index_set)
2646 s = format (s, "ls_index %d", clib_net_to_host_u32 (mp->ls_index));
2648 s = format (s, "ls_name %s", mp->ls_name);
2653 static void *vl_api_lisp_map_request_mode_t_print
2654 (vl_api_lisp_map_request_mode_t * mp, void *handle)
2658 s = format (0, "SCRIPT: lisp_map_request_mode ");
2663 s = format (s, "dst-only");
2666 s = format (s, "src-dst");
2674 static void *vl_api_lisp_eid_table_dump_t_print
2675 (vl_api_lisp_eid_table_dump_t * mp, void *handle)
2679 s = format (0, "SCRIPT: lisp_eid_table_dump ");
2683 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2684 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
2685 mp->eid, mp->prefix_length);
2689 s = format (s, "local ");
2692 s = format (s, "remote ");
2700 static void *vl_api_lisp_eid_table_map_dump_t_print
2701 (vl_api_lisp_eid_table_map_dump_t * mp, void *handle)
2705 s = format (0, "SCRIPT: lisp_eid_table_map_dump ");
2708 s = format (s, "l2");
2710 s = format (s, "l3");
2715 static void *vl_api_ipsec_gre_add_del_tunnel_t_print
2716 (vl_api_ipsec_gre_add_del_tunnel_t * mp, void *handle)
2720 s = format (0, "SCRIPT: ipsec_gre_add_del_tunnel ");
2722 s = format (s, "dst %U ", format_ip4_address,
2723 (ip4_address_t *) & (mp->dst_address));
2725 s = format (s, "src %U ", format_ip4_address,
2726 (ip4_address_t *) & (mp->src_address));
2728 s = format (s, "local_sa %d ", ntohl (mp->local_sa_id));
2730 s = format (s, "remote_sa %d ", ntohl (mp->remote_sa_id));
2732 if (mp->is_add == 0)
2733 s = format (s, "del ");
2738 static void *vl_api_ipsec_gre_tunnel_dump_t_print
2739 (vl_api_ipsec_gre_tunnel_dump_t * mp, void *handle)
2743 s = format (0, "SCRIPT: ipsec_gre_tunnel_dump ");
2745 if (mp->sw_if_index != ~0)
2746 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2751 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
2752 (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
2755 u32 vtr_op = ntohl (mp->vtr_op);
2757 s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
2759 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2760 s = format (s, "vtr_op %d ", vtr_op);
2761 if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
2763 if (vtr_op == L2_VTR_TRANSLATE_2_2)
2764 s = format (s, "%d ", ntohs (mp->outer_tag));
2765 s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
2766 s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
2767 s = format (s, "sid %d ", ntohl (mp->i_sid));
2768 s = format (s, "vlanid %d ", ntohs (mp->b_vlanid));
2775 vl_api_punt_t_print (vl_api_punt_t * mp, void *handle)
2779 s = format (0, "SCRIPT: punt ");
2781 if (mp->ipv != (u8) ~ 0)
2782 s = format (s, "ip %d ", mp->ipv);
2784 s = format (s, "protocol %d ", mp->l4_protocol);
2786 if (mp->l4_port != (u16) ~ 0)
2787 s = format (s, "port %d ", ntohs (mp->l4_port));
2790 s = format (s, "del ");
2796 #define foreach_custom_print_no_arg_function \
2797 _(lisp_eid_table_vni_dump) \
2798 _(lisp_map_resolver_dump) \
2799 _(show_lisp_map_request_mode) \
2800 _(lisp_gpe_tunnel_dump)
2803 static void * vl_api_ ## f ## _t_print \
2804 (vl_api_ ## f ## _t * mp, void * handle) \
2807 s = format (0, "SCRIPT: " #f ); \
2810 foreach_custom_print_no_arg_function
2812 #define foreach_custom_print_function \
2813 _(CREATE_LOOPBACK, create_loopback) \
2814 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
2815 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \
2816 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \
2817 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \
2818 _(TAP_CONNECT, tap_connect) \
2819 _(TAP_MODIFY, tap_modify) \
2820 _(TAP_DELETE, tap_delete) \
2821 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \
2822 _(IP_ADD_DEL_ROUTE, ip_add_del_route) \
2823 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
2824 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
2825 _(MPLS_ADD_DEL_DECAP, mpls_add_del_decap) \
2826 _(MPLS_ADD_DEL_ENCAP, mpls_add_del_encap) \
2827 _(MPLS_GRE_ADD_DEL_TUNNEL, mpls_gre_add_del_tunnel) \
2828 _(MPLS_ETHERNET_ADD_DEL_TUNNEL, mpls_ethernet_add_del_tunnel) \
2829 _(MPLS_ETHERNET_ADD_DEL_TUNNEL_2, mpls_ethernet_add_del_tunnel_2) \
2830 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered) \
2831 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \
2832 _(RESET_VRF, reset_vrf) \
2833 _(CREATE_VLAN_SUBIF, create_vlan_subif) \
2834 _(CREATE_SUBIF, create_subif) \
2835 _(OAM_ADD_DEL, oam_add_del) \
2836 _(RESET_FIB, reset_fib) \
2837 _(DHCP_PROXY_CONFIG, dhcp_proxy_config) \
2838 _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss) \
2839 _(SET_IP_FLOW_HASH, set_ip_flow_hash) \
2840 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \
2841 sw_interface_ip6_set_link_local_address) \
2842 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix) \
2843 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config) \
2844 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \
2845 _(L2_PATCH_ADD_DEL, l2_patch_add_del) \
2846 _(SR_TUNNEL_ADD_DEL, sr_tunnel_add_del) \
2847 _(SR_POLICY_ADD_DEL, sr_policy_add_del) \
2848 _(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del) \
2849 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \
2850 _(L2FIB_ADD_DEL, l2fib_add_del) \
2851 _(L2_FLAGS, l2_flags) \
2852 _(BRIDGE_FLAGS, bridge_flags) \
2853 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table) \
2854 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session) \
2855 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \
2856 _(SW_INTERFACE_SET_DPDK_HQOS_PIPE, sw_interface_set_dpdk_hqos_pipe) \
2857 _(SW_INTERFACE_SET_DPDK_HQOS_SUBPORT, sw_interface_set_dpdk_hqos_subport)\
2858 _(SW_INTERFACE_SET_DPDK_HQOS_TCTBL, sw_interface_set_dpdk_hqos_tctbl) \
2859 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
2860 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
2861 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \
2862 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \
2863 _(ADD_NODE_NEXT, add_node_next) \
2864 _(DHCP_PROXY_CONFIG_2, dhcp_proxy_config_2) \
2865 _(DHCP_CLIENT_CONFIG, dhcp_client_config) \
2866 _(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel) \
2867 _(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies) \
2868 _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable) \
2869 _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \
2870 _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \
2871 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \
2872 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \
2873 _(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel) \
2874 _(GRE_TUNNEL_DUMP, gre_tunnel_dump) \
2875 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \
2876 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \
2877 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \
2878 _(CREATE_VHOST_USER_IF, create_vhost_user_if) \
2879 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if) \
2880 _(DELETE_VHOST_USER_IF, delete_vhost_user_if) \
2881 _(SW_INTERFACE_DUMP, sw_interface_dump) \
2882 _(CONTROL_PING, control_ping) \
2883 _(WANT_INTERFACE_EVENTS, want_interface_events) \
2884 _(CLI_REQUEST, cli_request) \
2885 _(CLI_INBAND, cli_inband) \
2886 _(MEMCLNT_CREATE, memclnt_create) \
2887 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump) \
2888 _(SHOW_VERSION, show_version) \
2889 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
2890 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel) \
2891 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump) \
2892 _(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
2893 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
2894 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events) \
2895 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
2896 _(IP_ADDRESS_DUMP, ip_address_dump) \
2897 _(IP_DUMP, ip_dump) \
2898 _(DELETE_LOOPBACK, delete_loopback) \
2899 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \
2900 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \
2901 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \
2902 _(AF_PACKET_CREATE, af_packet_create) \
2903 _(AF_PACKET_DELETE, af_packet_delete) \
2904 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) \
2905 _(MPLS_GRE_TUNNEL_DUMP, mpls_gre_tunnel_dump) \
2906 _(MPLS_ETH_TUNNEL_DUMP, mpls_eth_tunnel_dump) \
2907 _(MPLS_FIB_ENCAP_DUMP, mpls_fib_encap_dump) \
2908 _(MPLS_FIB_DECAP_DUMP, mpls_fib_decap_dump) \
2909 _(CLASSIFY_TABLE_IDS,classify_table_ids) \
2910 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface) \
2911 _(CLASSIFY_TABLE_INFO,classify_table_info) \
2912 _(CLASSIFY_SESSION_DUMP,classify_session_dump) \
2913 _(SET_IPFIX_EXPORTER, set_ipfix_exporter) \
2914 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump) \
2915 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream) \
2916 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump) \
2917 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del) \
2918 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump) \
2919 _(GET_NEXT_INDEX, get_next_index) \
2920 _(PG_CREATE_INTERFACE,pg_create_interface) \
2921 _(PG_CAPTURE, pg_capture) \
2922 _(PG_ENABLE_DISABLE, pg_enable_disable) \
2923 _(POLICER_ADD_DEL, policer_add_del) \
2924 _(POLICER_DUMP, policer_dump) \
2925 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface) \
2926 _(POLICER_CLASSIFY_DUMP, policer_classify_dump) \
2927 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \
2928 ip_source_and_port_range_check_add_del) \
2929 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \
2930 ip_source_and_port_range_check_interface_add_del) \
2931 _(LISP_ENABLE_DISABLE, lisp_enable_disable) \
2932 _(LISP_GPE_ENABLE_DISABLE, lisp_gpe_enable_disable) \
2933 _(LISP_GPE_ADD_DEL_IFACE, lisp_gpe_add_del_iface) \
2934 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
2935 _(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
2936 _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
2937 _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
2938 _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
2939 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
2940 lisp_add_del_map_request_itr_rlocs) \
2941 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
2942 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
2943 _(LISP_GPE_ADD_DEL_FWD_ENTRY, lisp_gpe_add_del_fwd_entry) \
2944 _(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
2945 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
2946 _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
2947 _(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
2948 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
2949 _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
2950 _(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \
2951 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
2952 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
2953 _(LISP_LOCATOR_DUMP, lisp_locator_dump) \
2954 _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel) \
2955 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump) \
2956 _(DELETE_SUBIF, delete_subif) \
2957 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \
2960 vl_msg_api_custom_dump_configure (api_main_t * am)
2962 #define _(n,f) am->msg_print_handlers[VL_API_##n] \
2963 = (void *) vl_api_##f##_t_print;
2964 foreach_custom_print_function;
2969 * fd.io coding-style-patch-verification: ON
2972 * eval: (c-set-style "gnu")