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/sr/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 forward %d learn %d arp-term %d",
264 mp->flood, mp->uu_flood, mp->forward, mp->learn,
268 s = format (s, "del ");
273 static void *vl_api_bridge_domain_dump_t_print
274 (vl_api_bridge_domain_dump_t * mp, void *handle)
277 u32 bd_id = ntohl (mp->bd_id);
279 s = format (0, "SCRIPT: bridge_domain_dump ");
282 s = format (s, "bd_id %d ", bd_id);
287 static void *vl_api_l2fib_add_del_t_print
288 (vl_api_l2fib_add_del_t * mp, void *handle)
292 s = format (0, "SCRIPT: l2fib_add_del ");
294 s = format (s, "mac %U ", format_ethernet_address, &mp->mac);
296 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
301 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
303 s = format (s, "%s", "static ");
305 s = format (s, "%s", "filter ");
307 s = format (s, "%s", "bvi ");
311 s = format (s, "del ");
318 vl_api_l2_flags_t_print (vl_api_l2_flags_t * mp, void *handle)
321 u32 flags = ntohl (mp->feature_bitmap);
323 s = format (0, "SCRIPT: l2_flags ");
325 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
328 if (flags & L2INPUT_FEAT_ ## a) s = format (s, #a " ");
329 foreach_l2input_feat;
335 static void *vl_api_bridge_flags_t_print
336 (vl_api_bridge_flags_t * mp, void *handle)
339 u32 flags = ntohl (mp->feature_bitmap);
341 s = format (0, "SCRIPT: bridge_flags ");
343 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
345 if (flags & L2_LEARN)
346 s = format (s, "learn ");
348 s = format (s, "forward ");
349 if (flags & L2_FLOOD)
350 s = format (s, "flood ");
351 if (flags & L2_UU_FLOOD)
352 s = format (s, "uu-flood ");
353 if (flags & L2_ARP_TERM)
354 s = format (s, "arp-term ");
357 s = format (s, "clear ");
362 static void *vl_api_bd_ip_mac_add_del_t_print
363 (vl_api_bd_ip_mac_add_del_t * mp, void *handle)
367 s = format (0, "SCRIPT: bd_ip_mac_add_del ");
368 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
371 s = format (s, "%U ", format_ip6_address,
372 (ip6_address_t *) mp->ip_address);
374 s = format (s, "%U ", format_ip4_address,
375 (ip4_address_t *) mp->ip_address);
377 s = format (s, "%U ", format_ethernet_address, mp->mac_address);
379 s = format (s, "del ");
384 static void *vl_api_tap_connect_t_print
385 (vl_api_tap_connect_t * mp, void *handle)
390 memset (null_mac, 0, sizeof (null_mac));
392 s = format (0, "SCRIPT: tap_connect ");
393 s = format (s, "tapname %s ", mp->tap_name);
394 if (mp->use_random_mac)
395 s = format (s, "random-mac ");
397 s = format (s, "tag %s ", mp->tag);
398 if (memcmp (mp->mac_address, null_mac, 6))
399 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
400 if (mp->ip4_address_set)
401 s = format (s, "address %U/%d ", format_ip4_address, mp->ip4_address,
403 if (mp->ip6_address_set)
404 s = format (s, "address %U/%d ", format_ip6_address, mp->ip6_address,
409 static void *vl_api_tap_modify_t_print
410 (vl_api_tap_modify_t * mp, void *handle)
415 memset (null_mac, 0, sizeof (null_mac));
417 s = format (0, "SCRIPT: tap_modify ");
418 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
419 s = format (s, "tapname %s ", mp->tap_name);
420 if (mp->use_random_mac)
421 s = format (s, "random-mac ");
423 if (memcmp (mp->mac_address, null_mac, 6))
424 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
429 static void *vl_api_tap_delete_t_print
430 (vl_api_tap_delete_t * mp, void *handle)
434 s = format (0, "SCRIPT: tap_delete ");
435 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
440 static void *vl_api_sw_interface_tap_dump_t_print
441 (vl_api_sw_interface_tap_dump_t * mp, void *handle)
445 s = format (0, "SCRIPT: sw_interface_tap_dump ");
451 static void *vl_api_ip_add_del_route_t_print
452 (vl_api_ip_add_del_route_t * mp, void *handle)
456 s = format (0, "SCRIPT: ip_add_del_route ");
458 s = format (s, "del ");
460 if (mp->next_hop_sw_if_index)
461 s = format (s, "sw_if_index %d ", ntohl (mp->next_hop_sw_if_index));
464 s = format (s, "%U/%d ", format_ip6_address, mp->dst_address,
465 mp->dst_address_length);
467 s = format (s, "%U/%d ", format_ip4_address, mp->dst_address,
468 mp->dst_address_length);
470 s = format (s, "local ");
471 else if (mp->is_drop)
472 s = format (s, "drop ");
473 else if (mp->is_classify)
474 s = format (s, "classify %d", ntohl (mp->classify_table_index));
478 s = format (s, "via %U ", format_ip6_address, mp->next_hop_address);
480 s = format (s, "via %U ", format_ip4_address, mp->next_hop_address);
483 if (mp->table_id != 0)
484 s = format (s, "vrf %d ", ntohl (mp->table_id));
486 if (mp->create_vrf_if_needed)
487 s = format (s, "create-vrf ");
489 if (mp->next_hop_weight != 1)
490 s = format (s, "weight %d ", mp->next_hop_weight);
493 s = format (s, "not-last ");
495 if (mp->is_multipath)
496 s = format (s, "multipath ");
498 if (mp->is_multipath)
499 s = format (s, "multipath ");
501 if (mp->next_hop_table_id)
502 s = format (s, "lookup-in-vrf %d ", ntohl (mp->next_hop_table_id));
507 static void *vl_api_proxy_arp_add_del_t_print
508 (vl_api_proxy_arp_add_del_t * mp, void *handle)
512 s = format (0, "SCRIPT: proxy_arp_add_del ");
514 s = format (s, "%U - %U ", format_ip4_address, mp->low_address,
515 format_ip4_address, mp->hi_address);
518 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
521 s = format (s, "del ");
526 static void *vl_api_proxy_arp_intfc_enable_disable_t_print
527 (vl_api_proxy_arp_intfc_enable_disable_t * mp, void *handle)
531 s = format (0, "SCRIPT: proxy_arp_intfc_enable_disable ");
533 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
535 s = format (s, "enable %d ", mp->enable_disable);
540 static void *vl_api_mpls_tunnel_add_del_t_print
541 (vl_api_mpls_tunnel_add_del_t * mp, void *handle)
545 s = format (0, "SCRIPT: mpls_tunnel_add_del ");
547 if (mp->mt_next_hop_sw_if_index)
548 s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index));
550 if (mp->mt_next_hop_proto_is_ip4)
551 s = format (s, "%U ", format_ip4_address, mp->mt_next_hop);
553 s = format (s, "%U ", format_ip6_address, mp->mt_next_hop);
556 s = format (s, "l2-only ");
558 if (mp->mt_is_add == 0)
559 s = format (s, "del ");
564 static void *vl_api_sw_interface_set_unnumbered_t_print
565 (vl_api_sw_interface_set_unnumbered_t * mp, void *handle)
569 s = format (0, "SCRIPT: sw_interface_set_unnumbered ");
571 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
573 s = format (s, "unnum_if_index %d ", ntohl (mp->unnumbered_sw_if_index));
576 s = format (s, "del ");
581 static void *vl_api_ip_neighbor_add_del_t_print
582 (vl_api_ip_neighbor_add_del_t * mp, void *handle)
587 memset (null_mac, 0, sizeof (null_mac));
589 s = format (0, "SCRIPT: ip_neighbor_add_del ");
591 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
594 s = format (s, "is_static ");
596 if (mp->is_no_adj_fib)
597 s = format (s, "is_no_fib_entry ");
599 if (memcmp (mp->mac_address, null_mac, 6))
600 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
604 format (s, "dst %U ", format_ip6_address,
605 (ip6_address_t *) mp->dst_address);
608 format (s, "dst %U ", format_ip4_address,
609 (ip4_address_t *) mp->dst_address);
612 s = format (s, "del ");
618 vl_api_reset_vrf_t_print (vl_api_reset_vrf_t * mp, void *handle)
622 s = format (0, "SCRIPT: reset_vrf ");
625 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
627 if (mp->is_ipv6 != 0)
628 s = format (s, "ipv6 ");
633 static void *vl_api_create_vlan_subif_t_print
634 (vl_api_create_vlan_subif_t * mp, void *handle)
638 s = format (0, "SCRIPT: create_vlan_subif ");
641 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
644 s = format (s, "vlan_id %d ", ntohl (mp->vlan_id));
649 #define foreach_create_subif_bit \
656 _(outer_vlan_id_any) \
659 static void *vl_api_create_subif_t_print
660 (vl_api_create_subif_t * mp, void *handle)
664 s = format (0, "SCRIPT: create_subif ");
666 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
668 s = format (s, "sub_id %d ", ntohl (mp->sub_id));
670 if (mp->outer_vlan_id)
671 s = format (s, "outer_vlan_id %d ", ntohs (mp->outer_vlan_id));
673 if (mp->inner_vlan_id)
674 s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
676 #define _(a) if (mp->a) s = format (s, "%s ", #a);
677 foreach_create_subif_bit;
683 static void *vl_api_delete_subif_t_print
684 (vl_api_delete_subif_t * mp, void *handle)
688 s = format (0, "SCRIPT: delete_subif ");
689 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
694 static void *vl_api_oam_add_del_t_print
695 (vl_api_oam_add_del_t * mp, void *handle)
699 s = format (0, "SCRIPT: oam_add_del ");
702 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
704 s = format (s, "src %U ", format_ip4_address, mp->src_address);
706 s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
709 s = format (s, "del ");
715 vl_api_reset_fib_t_print (vl_api_reset_fib_t * mp, void *handle)
719 s = format (0, "SCRIPT: reset_fib ");
722 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
724 if (mp->is_ipv6 != 0)
725 s = format (s, "ipv6 ");
730 static void *vl_api_dhcp_proxy_config_t_print
731 (vl_api_dhcp_proxy_config_t * mp, void *handle)
735 s = format (0, "SCRIPT: dhcp_proxy_config_2 ");
737 s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id));
738 s = format (s, "server_vrf_id %d ", ntohl (mp->server_vrf_id));
742 s = format (s, "svr %U ", format_ip6_address,
743 (ip6_address_t *) mp->dhcp_server);
744 s = format (s, "src %U ", format_ip6_address,
745 (ip6_address_t *) mp->dhcp_src_address);
749 s = format (s, "svr %U ", format_ip4_address,
750 (ip4_address_t *) mp->dhcp_server);
751 s = format (s, "src %U ", format_ip4_address,
752 (ip4_address_t *) mp->dhcp_src_address);
755 s = format (s, "del ");
760 static void *vl_api_dhcp_proxy_set_vss_t_print
761 (vl_api_dhcp_proxy_set_vss_t * mp, void *handle)
765 s = format (0, "SCRIPT: dhcp_proxy_set_vss ");
767 s = format (s, "tbl_id %d ", ntohl (mp->tbl_id));
769 s = format (s, "fib_id %d ", ntohl (mp->fib_id));
771 s = format (s, "oui %d ", ntohl (mp->oui));
773 if (mp->is_ipv6 != 0)
774 s = format (s, "ipv6 ");
777 s = format (s, "del ");
782 static void *vl_api_dhcp_client_config_t_print
783 (vl_api_dhcp_client_config_t * mp, void *handle)
787 s = format (0, "SCRIPT: dhcp_client_config ");
789 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
791 s = format (s, "hostname %s ", mp->hostname);
793 s = format (s, "want_dhcp_event %d ", mp->want_dhcp_event);
795 s = format (s, "pid %d ", mp->pid);
798 s = format (s, "del ");
804 static void *vl_api_set_ip_flow_hash_t_print
805 (vl_api_set_ip_flow_hash_t * mp, void *handle)
809 s = format (0, "SCRIPT: set_ip_flow_hash ");
811 s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
814 s = format (s, "src ");
817 s = format (s, "dst ");
820 s = format (s, "sport ");
823 s = format (s, "dport ");
826 s = format (s, "proto ");
829 s = format (s, "reverse ");
831 if (mp->is_ipv6 != 0)
832 s = format (s, "ipv6 ");
837 static void *vl_api_sw_interface_ip6_set_link_local_address_t_print
838 (vl_api_sw_interface_ip6_set_link_local_address_t * mp, void *handle)
842 s = format (0, "SCRIPT: sw_interface_ip6_set_link_local_address ");
844 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
846 s = format (s, "%U ", format_ip6_address, mp->address);
851 static void *vl_api_sw_interface_ip6nd_ra_prefix_t_print
852 (vl_api_sw_interface_ip6nd_ra_prefix_t * mp, void *handle)
856 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_prefix ");
858 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
860 s = format (s, "%U/%d ", format_ip6_address, mp->address,
863 s = format (s, "val_life %d ", ntohl (mp->val_lifetime));
865 s = format (s, "pref_life %d ", ntohl (mp->pref_lifetime));
868 s = format (s, "def ");
870 if (mp->no_advertise)
871 s = format (s, "noadv ");
874 s = format (s, "offl ");
876 if (mp->no_autoconfig)
877 s = format (s, "noauto ");
880 s = format (s, "nolink ");
883 s = format (s, "isno ");
888 static void *vl_api_sw_interface_ip6nd_ra_config_t_print
889 (vl_api_sw_interface_ip6nd_ra_config_t * mp, void *handle)
893 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_config ");
895 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
897 s = format (s, "maxint %d ", ntohl (mp->max_interval));
899 s = format (s, "minint %d ", ntohl (mp->min_interval));
901 s = format (s, "life %d ", ntohl (mp->lifetime));
903 s = format (s, "count %d ", ntohl (mp->initial_count));
905 s = format (s, "interval %d ", ntohl (mp->initial_interval));
908 s = format (s, "suppress ");
911 s = format (s, "managed ");
914 s = format (s, "other ");
917 s = format (s, "ll ");
919 if (mp->send_unicast)
920 s = format (s, "send ");
923 s = format (s, "cease ");
926 s = format (s, "isno ");
928 if (mp->default_router)
929 s = format (s, "def ");
934 static void *vl_api_set_arp_neighbor_limit_t_print
935 (vl_api_set_arp_neighbor_limit_t * mp, void *handle)
939 s = format (0, "SCRIPT: set_arp_neighbor_limit ");
941 s = format (s, "arp_nbr_limit %d ", ntohl (mp->arp_neighbor_limit));
943 if (mp->is_ipv6 != 0)
944 s = format (s, "ipv6 ");
949 static void *vl_api_l2_patch_add_del_t_print
950 (vl_api_l2_patch_add_del_t * mp, void *handle)
954 s = format (0, "SCRIPT: l2_patch_add_del ");
956 s = format (s, "rx_sw_if_index %d ", ntohl (mp->rx_sw_if_index));
958 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
961 s = format (s, "del ");
966 static void *vl_api_sr_localsid_add_del_t_print
967 (vl_api_sr_localsid_add_del_t * mp, void *handle)
969 vnet_main_t *vnm = vnet_get_main ();
972 s = format (0, "SCRIPT: sr_localsid_add_del ");
974 switch (mp->behavior)
976 case SR_BEHAVIOR_END:
977 s = format (s, "Address: %U\nBehavior: End",
978 format_ip6_address, (ip6_address_t *) mp->localsid_addr);
979 s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
984 "Address: %U\nBehavior: X (Endpoint with Layer-3 cross-connect)"
985 "\nIface: %U\nNext hop: %U", format_ip6_address,
986 (ip6_address_t *) mp->localsid_addr,
987 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
988 format_ip6_address, (ip6_address_t *) mp->nh_addr);
989 s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
991 case SR_BEHAVIOR_DX4:
994 "Address: %U\nBehavior: DX4 (Endpoint with decapsulation with IPv4 cross-connect)"
995 "\nIface: %U\nNext hop: %U", format_ip6_address,
996 (ip6_address_t *) mp->localsid_addr,
997 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
998 format_ip4_address, (ip4_address_t *) mp->nh_addr);
1000 case SR_BEHAVIOR_DX6:
1003 "Address: %U\nBehavior: DX6 (Endpoint with decapsulation with IPv6 cross-connect)"
1004 "\nIface: %UNext hop: %U", format_ip6_address,
1005 (ip6_address_t *) mp->localsid_addr,
1006 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1007 format_ip6_address, (ip6_address_t *) mp->nh_addr);
1009 case SR_BEHAVIOR_DX2:
1012 "Address: %U\nBehavior: DX2 (Endpoint with decapulation and Layer-2 cross-connect)"
1013 "\nIface: %U", format_ip6_address,
1014 (ip6_address_t *) mp->localsid_addr,
1015 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index));
1017 case SR_BEHAVIOR_DT6:
1020 "Address: %U\nBehavior: DT6 (Endpoint with decapsulation and specific IPv6 table lookup)"
1021 "\nTable: %u", format_ip6_address,
1022 (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table));
1024 case SR_BEHAVIOR_DT4:
1027 "Address: %U\nBehavior: DT4 (Endpoint with decapsulation and specific IPv4 table lookup)"
1028 "\nTable: %u", format_ip6_address,
1029 (ip6_address_t *) mp->localsid_addr, ntohl (mp->fib_table));
1032 if (mp->behavior >= SR_BEHAVIOR_LAST)
1034 s = format (s, "Address: %U\n Behavior: %u",
1035 format_ip6_address, (ip6_address_t *) mp->localsid_addr,
1039 //Should never get here...
1040 s = format (s, "Internal error");
1046 static void *vl_api_sr_steering_add_del_t_print
1047 (vl_api_sr_steering_add_del_t * mp, void *handle)
1051 s = format (0, "SCRIPT: sr_steering_add_del ");
1053 s = format (s, (mp->is_del ? "Del: True" : "Del: False"));
1055 switch (mp->traffic_type)
1058 s = format (s, "Traffic type: L2 iface: %u", ntohl (mp->sw_if_index));
1061 s = format (s, "Traffic type: IPv4 %U/%u", format_ip4_address,
1062 (ip4_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1065 s = format (s, "Traffic type: IPv6 %U/%u", format_ip6_address,
1066 (ip6_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1069 s = format (s, "Traffic type: Unknown(%u)", mp->traffic_type);
1072 s = format (s, "BindingSID: %U", format_ip6_address,
1073 (ip6_address_t *) mp->bsid_addr);
1075 s = format (s, "SR Policy Index: %u", ntohl (mp->sr_policy_index));
1077 s = format (s, "FIB_table: %u", ntohl (mp->table_id));
1082 static void *vl_api_sr_policy_add_t_print
1083 (vl_api_sr_policy_add_t * mp, void *handle)
1087 ip6_address_t *segments = 0, *seg;
1088 ip6_address_t *this_address = (ip6_address_t *) mp->segments;
1091 for (i = 0; i < mp->n_segments; i++)
1093 vec_add2 (segments, seg, 1);
1094 clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1098 s = format (0, "SCRIPT: sr_policy_add ");
1100 s = format (s, "BSID: %U", format_ip6_address,
1101 (ip6_address_t *) mp->bsid_addr);
1105 (mp->is_encap ? "Behavior: Encapsulation" :
1106 "Behavior: SRH insertion"));
1108 s = format (s, "FIB_table: %u", ntohl (mp->fib_table));
1110 s = format (s, (mp->type ? "Type: Default" : "Type: Spray"));
1112 s = format (s, "SID list weight: %u", ntohl (mp->weight));
1114 s = format (s, "{");
1115 vec_foreach (seg, segments)
1117 s = format (s, "%U, ", format_ip6_address, seg);
1119 s = format (s, "\b\b } ");
1124 static void *vl_api_sr_policy_mod_t_print
1125 (vl_api_sr_policy_mod_t * mp, void *handle)
1130 ip6_address_t *segments = 0, *seg;
1131 ip6_address_t *this_address = (ip6_address_t *) mp->segments;
1134 for (i = 0; i < mp->n_segments; i++)
1136 vec_add2 (segments, seg, 1);
1137 clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1141 s = format (0, "SCRIPT: sr_policy_mod ");
1143 s = format (s, "BSID: %U", format_ip6_address,
1144 (ip6_address_t *) mp->bsid_addr);
1146 s = format (s, "SR Policy index: %u", ntohl (mp->sr_policy_index));
1148 s = format (s, "Operation: %u", mp->operation);
1150 s = format (s, "SID list index: %u", ntohl (mp->sl_index));
1152 s = format (s, "SID list weight: %u", ntohl (mp->weight));
1154 s = format (s, "{");
1155 vec_foreach (seg, segments)
1157 s = format (s, "%U, ", format_ip6_address, seg);
1159 s = format (s, "\b\b } ");
1164 static void *vl_api_sr_policy_del_t_print
1165 (vl_api_sr_policy_del_t * mp, void *handle)
1169 s = format (0, "SCRIPT: sr_policy_del ");
1171 u32 sr_policy_index;
1172 s = format (s, "To be delivered. Good luck.");
1176 static void *vl_api_classify_add_del_table_t_print
1177 (vl_api_classify_add_del_table_t * mp, void *handle)
1182 s = format (0, "SCRIPT: classify_add_del_table ");
1184 if (mp->is_add == 0)
1186 s = format (s, "table %d ", ntohl (mp->table_index));
1187 s = format (s, "%s ", mp->del_chain ? "del-chain" : "del");
1191 s = format (s, "nbuckets %d ", ntohl (mp->nbuckets));
1192 s = format (s, "memory_size %d ", ntohl (mp->memory_size));
1193 s = format (s, "skip %d ", ntohl (mp->skip_n_vectors));
1194 s = format (s, "match %d ", ntohl (mp->match_n_vectors));
1195 s = format (s, "next-table %d ", ntohl (mp->next_table_index));
1196 s = format (s, "miss-next %d ", ntohl (mp->miss_next_index));
1197 s = format (s, "current-data-flag %d ", ntohl (mp->current_data_flag));
1198 if (mp->current_data_flag)
1199 s = format (s, "current-data-offset %d ",
1200 ntohl (mp->current_data_offset));
1201 s = format (s, "mask hex ");
1202 for (i = 0; i < ntohl (mp->match_n_vectors) * sizeof (u32x4); i++)
1203 s = format (s, "%02x", mp->mask[i]);
1210 static void *vl_api_classify_add_del_session_t_print
1211 (vl_api_classify_add_del_session_t * mp, void *handle)
1216 s = format (0, "SCRIPT: classify_add_del_session ");
1218 s = format (s, "table_index %d ", ntohl (mp->table_index));
1219 s = format (s, "hit_next_index %d ", ntohl (mp->hit_next_index));
1220 s = format (s, "opaque_index %d ", ntohl (mp->opaque_index));
1221 s = format (s, "advance %d ", ntohl (mp->advance));
1222 s = format (s, "action %d ", mp->action);
1224 s = format (s, "metadata %d ", ntohl (mp->metadata));
1225 if (mp->is_add == 0)
1226 s = format (s, "del ");
1228 s = format (s, "match hex ");
1229 for (i = 5 * sizeof (u32x4) - 1; i > 0; i--)
1231 if (mp->match[i] != 0)
1238 for (i = 0; i < limit; i++)
1239 s = format (s, "%02x", mp->match[i]);
1244 static void *vl_api_classify_set_interface_ip_table_t_print
1245 (vl_api_classify_set_interface_ip_table_t * mp, void *handle)
1249 s = format (0, "SCRIPT: classify_set_interface_ip_table ");
1252 s = format (s, "ipv6 ");
1254 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1255 s = format (s, "table %d ", ntohl (mp->table_index));
1260 static void *vl_api_classify_set_interface_l2_tables_t_print
1261 (vl_api_classify_set_interface_l2_tables_t * mp, void *handle)
1265 s = format (0, "SCRIPT: classify_set_interface_l2_tables ");
1267 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1268 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1269 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1270 s = format (s, "other-table %d ", ntohl (mp->other_table_index));
1271 s = format (s, "is-input %d ", mp->is_input);
1276 static void *vl_api_add_node_next_t_print
1277 (vl_api_add_node_next_t * mp, void *handle)
1281 s = format (0, "SCRIPT: add_node_next ");
1283 s = format (0, "node %s next %s ", mp->node_name, mp->next_name);
1288 static void *vl_api_l2tpv3_create_tunnel_t_print
1289 (vl_api_l2tpv3_create_tunnel_t * mp, void *handle)
1293 s = format (0, "SCRIPT: l2tpv3_create_tunnel ");
1295 s = format (s, "client_address %U our_address %U ",
1296 format_ip6_address, (ip6_address_t *) (mp->client_address),
1297 format_ip6_address, (ip6_address_t *) (mp->our_address));
1298 s = format (s, "local_session_id %d ", ntohl (mp->local_session_id));
1299 s = format (s, "remote_session_id %d ", ntohl (mp->remote_session_id));
1300 s = format (s, "local_cookie %lld ",
1301 clib_net_to_host_u64 (mp->local_cookie));
1302 s = format (s, "remote_cookie %lld ",
1303 clib_net_to_host_u64 (mp->remote_cookie));
1304 if (mp->l2_sublayer_present)
1305 s = format (s, "l2-sublayer-present ");
1310 static void *vl_api_l2tpv3_set_tunnel_cookies_t_print
1311 (vl_api_l2tpv3_set_tunnel_cookies_t * mp, void *handle)
1315 s = format (0, "SCRIPT: l2tpv3_set_tunnel_cookies ");
1317 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1319 s = format (s, "new_local_cookie %llu ",
1320 clib_net_to_host_u64 (mp->new_local_cookie));
1322 s = format (s, "new_remote_cookie %llu ",
1323 clib_net_to_host_u64 (mp->new_remote_cookie));
1328 static void *vl_api_l2tpv3_interface_enable_disable_t_print
1329 (vl_api_l2tpv3_interface_enable_disable_t * mp, void *handle)
1333 s = format (0, "SCRIPT: l2tpv3_interface_enable_disable ");
1335 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1337 if (mp->enable_disable == 0)
1338 s = format (s, "del ");
1343 static void *vl_api_l2tpv3_set_lookup_key_t_print
1344 (vl_api_l2tpv3_set_lookup_key_t * mp, void *handle)
1347 char *str = "unknown";
1349 s = format (0, "SCRIPT: l2tpv3_set_lookup_key ");
1353 case L2T_LOOKUP_SRC_ADDRESS:
1354 str = "lookup_v6_src";
1356 case L2T_LOOKUP_DST_ADDRESS:
1357 str = "lookup_v6_dst";
1359 case L2T_LOOKUP_SESSION_ID:
1360 str = "lookup_session_id";
1366 s = format (s, "%s ", str);
1371 static void *vl_api_sw_if_l2tpv3_tunnel_dump_t_print
1372 (vl_api_sw_if_l2tpv3_tunnel_dump_t * mp, void *handle)
1376 s = format (0, "SCRIPT: sw_if_l2tpv3_tunnel_dump ");
1381 static void *vl_api_vxlan_add_del_tunnel_t_print
1382 (vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
1385 s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
1387 ip46_address_t src, dst;
1389 ip46_from_addr_buf (mp->is_ipv6, mp->dst_address, &dst);
1390 ip46_from_addr_buf (mp->is_ipv6, mp->src_address, &src);
1392 u8 is_grp = ip46_address_is_multicast (&dst);
1393 char *dst_name = is_grp ? "group" : "dst";
1395 s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY);
1396 s = format (s, "%s %U ", dst_name, format_ip46_address,
1397 &dst, IP46_TYPE_ANY);
1400 s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1402 if (mp->encap_vrf_id)
1403 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1405 s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1407 s = format (s, "vni %d ", ntohl (mp->vni));
1409 if (mp->is_add == 0)
1410 s = format (s, "del ");
1412 if (mp->is_add == 0)
1413 s = format (s, "del ");
1418 static void *vl_api_vxlan_tunnel_dump_t_print
1419 (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1423 s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1425 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1430 static void *vl_api_gre_add_del_tunnel_t_print
1431 (vl_api_gre_add_del_tunnel_t * mp, void *handle)
1435 s = format (0, "SCRIPT: gre_add_del_tunnel ");
1437 s = format (s, "dst %U ", format_ip46_address,
1438 (ip46_address_t *) & (mp->dst_address),
1439 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1441 s = format (s, "src %U ", format_ip46_address,
1442 (ip46_address_t *) & (mp->src_address),
1443 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1446 s = format (s, "teb ");
1448 if (mp->outer_fib_id)
1449 s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
1451 if (mp->is_add == 0)
1452 s = format (s, "del ");
1457 static void *vl_api_gre_tunnel_dump_t_print
1458 (vl_api_gre_tunnel_dump_t * mp, void *handle)
1462 s = format (0, "SCRIPT: gre_tunnel_dump ");
1464 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1469 static void *vl_api_l2_fib_clear_table_t_print
1470 (vl_api_l2_fib_clear_table_t * mp, void *handle)
1474 s = format (0, "SCRIPT: l2_fib_clear_table ");
1479 static void *vl_api_l2_interface_efp_filter_t_print
1480 (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1484 s = format (0, "SCRIPT: l2_interface_efp_filter ");
1486 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1487 if (mp->enable_disable)
1488 s = format (s, "enable ");
1490 s = format (s, "disable ");
1495 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1496 (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1500 s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1502 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1503 s = format (s, "vtr_op %d ", ntohl (mp->vtr_op));
1504 s = format (s, "push_dot1q %d ", ntohl (mp->push_dot1q));
1505 s = format (s, "tag1 %d ", ntohl (mp->tag1));
1506 s = format (s, "tag2 %d ", ntohl (mp->tag2));
1511 static void *vl_api_create_vhost_user_if_t_print
1512 (vl_api_create_vhost_user_if_t * mp, void *handle)
1516 s = format (0, "SCRIPT: create_vhost_user_if ");
1518 s = format (s, "socket %s ", mp->sock_filename);
1520 s = format (s, "server ");
1522 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1524 s = format (s, "tag %s", mp->tag);
1529 static void *vl_api_modify_vhost_user_if_t_print
1530 (vl_api_modify_vhost_user_if_t * mp, void *handle)
1534 s = format (0, "SCRIPT: modify_vhost_user_if ");
1536 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1537 s = format (s, "socket %s ", mp->sock_filename);
1539 s = format (s, "server ");
1541 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1546 static void *vl_api_delete_vhost_user_if_t_print
1547 (vl_api_delete_vhost_user_if_t * mp, void *handle)
1551 s = format (0, "SCRIPT: delete_vhost_user_if ");
1552 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1557 static void *vl_api_sw_interface_vhost_user_dump_t_print
1558 (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
1562 s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
1567 static void *vl_api_sw_interface_dump_t_print
1568 (vl_api_sw_interface_dump_t * mp, void *handle)
1572 s = format (0, "SCRIPT: sw_interface_dump ");
1574 if (mp->name_filter_valid)
1575 s = format (s, "name_filter %s ", mp->name_filter);
1577 s = format (s, "all ");
1582 static void *vl_api_l2_fib_table_dump_t_print
1583 (vl_api_l2_fib_table_dump_t * mp, void *handle)
1587 s = format (0, "SCRIPT: l2_fib_table_dump ");
1589 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
1594 static void *vl_api_control_ping_t_print
1595 (vl_api_control_ping_t * mp, void *handle)
1599 s = format (0, "SCRIPT: control_ping ");
1604 static void *vl_api_want_interface_events_t_print
1605 (vl_api_want_interface_events_t * mp, void *handle)
1609 s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
1610 ntohl (mp->pid), ntohl (mp->enable_disable));
1615 static void *vl_api_cli_request_t_print
1616 (vl_api_cli_request_t * mp, void *handle)
1620 s = format (0, "SCRIPT: cli_request ");
1625 static void *vl_api_cli_inband_t_print
1626 (vl_api_cli_inband_t * mp, void *handle)
1630 s = format (0, "SCRIPT: cli_inband ");
1635 static void *vl_api_memclnt_create_t_print
1636 (vl_api_memclnt_create_t * mp, void *handle)
1640 s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
1645 static void *vl_api_show_version_t_print
1646 (vl_api_show_version_t * mp, void *handle)
1650 s = format (0, "SCRIPT: show_version ");
1655 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
1656 (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
1660 s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
1662 s = format (s, "local %U ", format_ip46_address, &mp->local, mp->is_ipv6);
1664 s = format (s, "remote %U ", format_ip46_address, &mp->remote, mp->is_ipv6);
1666 s = format (s, "protocol %d ", ntohl (mp->protocol));
1668 s = format (s, "vni %d ", ntohl (mp->vni));
1670 if (mp->is_add == 0)
1671 s = format (s, "del ");
1673 if (mp->encap_vrf_id)
1674 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1676 if (mp->decap_vrf_id)
1677 s = format (s, "decap-vrf-id %d ", ntohl (mp->decap_vrf_id));
1682 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
1683 (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
1687 s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
1689 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1694 static void *vl_api_interface_name_renumber_t_print
1695 (vl_api_interface_name_renumber_t * mp, void *handle)
1699 s = format (0, "SCRIPT: interface_renumber ");
1701 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1703 s = format (s, "new_show_dev_instance %d ",
1704 ntohl (mp->new_show_dev_instance));
1709 static void *vl_api_want_ip4_arp_events_t_print
1710 (vl_api_want_ip4_arp_events_t * mp, void *handle)
1714 s = format (0, "SCRIPT: want_ip4_arp_events ");
1715 s = format (s, "pid %d address %U ", mp->pid,
1716 format_ip4_address, &mp->address);
1717 if (mp->enable_disable == 0)
1718 s = format (s, "del ");
1723 static void *vl_api_want_ip6_nd_events_t_print
1724 (vl_api_want_ip6_nd_events_t * mp, void *handle)
1728 s = format (0, "SCRIPT: want_ip6_nd_events ");
1729 s = format (s, "pid %d address %U ", mp->pid,
1730 format_ip6_address, mp->address);
1731 if (mp->enable_disable == 0)
1732 s = format (s, "del ");
1737 static void *vl_api_input_acl_set_interface_t_print
1738 (vl_api_input_acl_set_interface_t * mp, void *handle)
1742 s = format (0, "SCRIPT: input_acl_set_interface ");
1744 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1745 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1746 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1747 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
1749 if (mp->is_add == 0)
1750 s = format (s, "del ");
1755 static void *vl_api_ip_address_dump_t_print
1756 (vl_api_ip_address_dump_t * mp, void *handle)
1760 s = format (0, "SCRIPT: ip6_address_dump ");
1761 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1762 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1768 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
1772 s = format (0, "SCRIPT: ip_dump ");
1773 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1778 static void *vl_api_cop_interface_enable_disable_t_print
1779 (vl_api_cop_interface_enable_disable_t * mp, void *handle)
1783 s = format (0, "SCRIPT: cop_interface_enable_disable ");
1784 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1785 if (mp->enable_disable)
1786 s = format (s, "enable ");
1788 s = format (s, "disable ");
1793 static void *vl_api_cop_whitelist_enable_disable_t_print
1794 (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
1798 s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
1799 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1800 s = format (s, "fib-id %d ", ntohl (mp->fib_id));
1802 s = format (s, "ip4 ");
1804 s = format (s, "ip6 ");
1805 if (mp->default_cop)
1806 s = format (s, "default ");
1811 static void *vl_api_af_packet_create_t_print
1812 (vl_api_af_packet_create_t * mp, void *handle)
1816 s = format (0, "SCRIPT: af_packet_create ");
1817 s = format (s, "host_if_name %s ", mp->host_if_name);
1818 if (mp->use_random_hw_addr)
1819 s = format (s, "hw_addr random ");
1821 s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
1826 static void *vl_api_af_packet_delete_t_print
1827 (vl_api_af_packet_delete_t * mp, void *handle)
1831 s = format (0, "SCRIPT: af_packet_delete ");
1832 s = format (s, "host_if_name %s ", mp->host_if_name);
1838 format_policer_action (u8 * s, va_list * va)
1840 u32 action = va_arg (*va, u32);
1841 u32 dscp = va_arg (*va, u32);
1844 if (action == SSE2_QOS_ACTION_DROP)
1845 s = format (s, "drop");
1846 else if (action == SSE2_QOS_ACTION_TRANSMIT)
1847 s = format (s, "transmit");
1848 else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
1850 s = format (s, "mark-and-transmit ");
1853 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
1859 s = format (s, "%s", t);
1865 static void *vl_api_policer_add_del_t_print
1866 (vl_api_policer_add_del_t * mp, void *handle)
1870 s = format (0, "SCRIPT: policer_add_del ");
1871 s = format (s, "name %s ", mp->name);
1872 s = format (s, "cir %d ", mp->cir);
1873 s = format (s, "eir %d ", mp->eir);
1874 s = format (s, "cb %d ", mp->cb);
1875 s = format (s, "eb %d ", mp->eb);
1877 switch (mp->rate_type)
1879 case SSE2_QOS_RATE_KBPS:
1880 s = format (s, "rate_type kbps ");
1882 case SSE2_QOS_RATE_PPS:
1883 s = format (s, "rate_type pps ");
1889 switch (mp->round_type)
1891 case SSE2_QOS_ROUND_TO_CLOSEST:
1892 s = format (s, "round_type closest ");
1894 case SSE2_QOS_ROUND_TO_UP:
1895 s = format (s, "round_type up ");
1897 case SSE2_QOS_ROUND_TO_DOWN:
1898 s = format (s, "round_type down ");
1906 case SSE2_QOS_POLICER_TYPE_1R2C:
1907 s = format (s, "type 1r2c ");
1909 case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
1910 s = format (s, "type 1r3c ");
1912 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
1913 s = format (s, "type 2r3c-2698 ");
1915 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
1916 s = format (s, "type 2r3c-4115 ");
1918 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
1919 s = format (s, "type 2r3c-mef5cf1 ");
1925 s = format (s, "conform_action %U ", format_policer_action,
1926 mp->conform_action_type, mp->conform_dscp);
1927 s = format (s, "exceed_action %U ", format_policer_action,
1928 mp->exceed_action_type, mp->exceed_dscp);
1929 s = format (s, "violate_action %U ", format_policer_action,
1930 mp->violate_action_type, mp->violate_dscp);
1932 if (mp->color_aware)
1933 s = format (s, "color-aware ");
1934 if (mp->is_add == 0)
1935 s = format (s, "del ");
1940 static void *vl_api_policer_dump_t_print
1941 (vl_api_policer_dump_t * mp, void *handle)
1945 s = format (0, "SCRIPT: policer_dump ");
1946 if (mp->match_name_valid)
1947 s = format (s, "name %s ", mp->match_name);
1952 static void *vl_api_policer_classify_set_interface_t_print
1953 (vl_api_policer_classify_set_interface_t * mp, void *handle)
1957 s = format (0, "SCRIPT: policer_classify_set_interface ");
1958 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1959 if (mp->ip4_table_index != ~0)
1960 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1961 if (mp->ip6_table_index != ~0)
1962 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1963 if (mp->l2_table_index != ~0)
1964 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
1965 if (mp->is_add == 0)
1966 s = format (s, "del ");
1971 static void *vl_api_policer_classify_dump_t_print
1972 (vl_api_policer_classify_dump_t * mp, void *handle)
1976 s = format (0, "SCRIPT: policer_classify_dump ");
1979 case POLICER_CLASSIFY_TABLE_IP4:
1980 s = format (s, "type ip4 ");
1982 case POLICER_CLASSIFY_TABLE_IP6:
1983 s = format (s, "type ip6 ");
1985 case POLICER_CLASSIFY_TABLE_L2:
1986 s = format (s, "type l2 ");
1995 static void *vl_api_sw_interface_clear_stats_t_print
1996 (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2000 s = format (0, "SCRIPT: sw_interface_clear_stats ");
2001 if (mp->sw_if_index != ~0)
2002 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2007 static void *vl_api_mpls_tunnel_dump_t_print
2008 (vl_api_mpls_tunnel_dump_t * mp, void *handle)
2012 s = format (0, "SCRIPT: mpls_tunnel_dump ");
2014 s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
2019 static void *vl_api_mpls_fib_dump_t_print
2020 (vl_api_mpls_fib_dump_t * mp, void *handle)
2024 s = format (0, "SCRIPT: mpls_fib_decap_dump ");
2029 static void *vl_api_ip_fib_dump_t_print
2030 (vl_api_ip_fib_dump_t * mp, void *handle)
2034 s = format (0, "SCRIPT: ip_fib_dump ");
2039 static void *vl_api_ip6_fib_dump_t_print
2040 (vl_api_ip6_fib_dump_t * mp, void *handle)
2044 s = format (0, "SCRIPT: ip6_fib_dump ");
2049 static void *vl_api_classify_table_ids_t_print
2050 (vl_api_classify_table_ids_t * mp, void *handle)
2054 s = format (0, "SCRIPT: classify_table_ids ");
2059 static void *vl_api_classify_table_by_interface_t_print
2060 (vl_api_classify_table_by_interface_t * mp, void *handle)
2064 s = format (0, "SCRIPT: classify_table_by_interface ");
2065 if (mp->sw_if_index != ~0)
2066 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2071 static void *vl_api_classify_table_info_t_print
2072 (vl_api_classify_table_info_t * mp, void *handle)
2076 s = format (0, "SCRIPT: classify_table_info ");
2077 if (mp->table_id != ~0)
2078 s = format (s, "table_id %d ", ntohl (mp->table_id));
2083 static void *vl_api_classify_session_dump_t_print
2084 (vl_api_classify_session_dump_t * mp, void *handle)
2088 s = format (0, "SCRIPT: classify_session_dump ");
2089 if (mp->table_id != ~0)
2090 s = format (s, "table_id %d ", ntohl (mp->table_id));
2095 static void *vl_api_set_ipfix_exporter_t_print
2096 (vl_api_set_ipfix_exporter_t * mp, void *handle)
2100 s = format (0, "SCRIPT: set_ipfix_exporter ");
2102 s = format (s, "collector-address %U ", format_ip4_address,
2103 (ip4_address_t *) mp->collector_address);
2104 s = format (s, "collector-port %d ", ntohs (mp->collector_port));
2105 s = format (s, "src-address %U ", format_ip4_address,
2106 (ip4_address_t *) mp->src_address);
2107 s = format (s, "vrf-id %d ", ntohl (mp->vrf_id));
2108 s = format (s, "path-mtu %d ", ntohl (mp->path_mtu));
2109 s = format (s, "template-interval %d ", ntohl (mp->template_interval));
2110 s = format (s, "udp-checksum %d ", mp->udp_checksum);
2115 static void *vl_api_ipfix_exporter_dump_t_print
2116 (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2120 s = format (0, "SCRIPT: ipfix_exporter_dump ");
2125 static void *vl_api_set_ipfix_classify_stream_t_print
2126 (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2130 s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2132 s = format (s, "domain-id %d ", ntohl (mp->domain_id));
2133 s = format (s, "src-port %d ", ntohs (mp->src_port));
2138 static void *vl_api_ipfix_classify_stream_dump_t_print
2139 (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2143 s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2148 static void *vl_api_ipfix_classify_table_add_del_t_print
2149 (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2153 s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2155 s = format (s, "table-id %d ", ntohl (mp->table_id));
2156 s = format (s, "ip-version %d ", mp->ip_version);
2157 s = format (s, "transport-protocol %d ", mp->transport_protocol);
2162 static void *vl_api_ipfix_classify_table_dump_t_print
2163 (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2167 s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2172 static void *vl_api_sw_interface_span_enable_disable_t_print
2173 (vl_api_sw_interface_span_enable_disable_t * mp, void *handle)
2177 s = format (0, "SCRIPT: sw_interface_span_enable_disable ");
2178 s = format (s, "src_sw_if_index %u ", ntohl (mp->sw_if_index_from));
2179 s = format (s, "dst_sw_if_index %u ", ntohl (mp->sw_if_index_to));
2184 s = format (s, "disable ");
2187 s = format (s, "rx ");
2190 s = format (s, "tx ");
2194 s = format (s, "both ");
2202 vl_api_sw_interface_span_dump_t_print (vl_api_sw_interface_span_dump_t * mp,
2207 s = format (0, "SCRIPT: sw_interface_span_dump ");
2212 static void *vl_api_get_next_index_t_print
2213 (vl_api_get_next_index_t * mp, void *handle)
2217 s = format (0, "SCRIPT: get_next_index ");
2218 s = format (s, "node-name %s ", mp->node_name);
2219 s = format (s, "next-node-name %s ", mp->next_name);
2224 static void *vl_api_pg_create_interface_t_print
2225 (vl_api_pg_create_interface_t * mp, void *handle)
2229 s = format (0, "SCRIPT: pg_create_interface ");
2230 s = format (0, "if_id %d", ntohl (mp->interface_id));
2235 static void *vl_api_pg_capture_t_print
2236 (vl_api_pg_capture_t * mp, void *handle)
2240 s = format (0, "SCRIPT: pg_capture ");
2241 s = format (0, "if_id %d ", ntohl (mp->interface_id));
2242 s = format (0, "pcap %s", mp->pcap_file_name);
2243 if (mp->count != ~0)
2244 s = format (s, "count %d ", ntohl (mp->count));
2245 if (!mp->is_enabled)
2246 s = format (s, "disable");
2251 static void *vl_api_pg_enable_disable_t_print
2252 (vl_api_pg_enable_disable_t * mp, void *handle)
2256 s = format (0, "SCRIPT: pg_enable_disable ");
2257 if (ntohl (mp->stream_name_length) > 0)
2258 s = format (s, "stream %s", mp->stream_name);
2259 if (!mp->is_enabled)
2260 s = format (s, "disable");
2265 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2266 (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2271 s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2273 s = format (s, "%U/%d ", format_ip6_address, mp->address,
2276 s = format (s, "%U/%d ", format_ip4_address, mp->address,
2279 for (i = 0; i < mp->number_of_ranges; i++)
2281 s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2284 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
2286 if (mp->is_add == 0)
2287 s = format (s, "del ");
2292 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2293 (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2298 s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2300 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2302 if (mp->tcp_out_vrf_id != ~0)
2303 s = format (s, "tcp-out-vrf %d ", ntohl (mp->tcp_out_vrf_id));
2305 if (mp->udp_out_vrf_id != ~0)
2306 s = format (s, "udp-out-vrf %d ", ntohl (mp->udp_out_vrf_id));
2308 if (mp->tcp_in_vrf_id != ~0)
2309 s = format (s, "tcp-in-vrf %d ", ntohl (mp->tcp_in_vrf_id));
2311 if (mp->udp_in_vrf_id != ~0)
2312 s = format (s, "udp-in-vrf %d ", ntohl (mp->udp_in_vrf_id));
2314 if (mp->is_add == 0)
2315 s = format (s, "del ");
2320 static void *vl_api_lisp_enable_disable_t_print
2321 (vl_api_lisp_enable_disable_t * mp, void *handle)
2325 s = format (0, "SCRIPT: lisp_enable_disable %s",
2326 mp->is_en ? "enable" : "disable");
2331 static void *vl_api_gpe_add_del_iface_t_print
2332 (vl_api_gpe_add_del_iface_t * mp, void *handle)
2336 s = format (0, "SCRIPT: gpe_add_del_iface ");
2338 s = format (s, "%s ", mp->is_add ? "up" : "down");
2339 s = format (s, "vni %d ", mp->vni);
2340 s = format (s, "%s %d ", mp->is_l2 ? "bd_id" : "table_id", mp->dp_table);
2345 static void *vl_api_lisp_pitr_set_locator_set_t_print
2346 (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
2350 s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
2353 s = format (s, "locator-set %s ", mp->ls_name);
2355 s = format (s, "del");
2361 format_lisp_flat_eid (u8 * s, va_list * args)
2363 u32 type = va_arg (*args, u32);
2364 u8 *eid = va_arg (*args, u8 *);
2365 u32 eid_len = va_arg (*args, u32);
2370 return format (s, "%U/%d", format_ip4_address, eid, eid_len);
2372 return format (s, "%U/%d", format_ip6_address, eid, eid_len);
2374 return format (s, "%U", format_ethernet_address, eid);
2379 static void *vl_api_lisp_add_del_remote_mapping_t_print
2380 (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
2383 u32 i, rloc_num = 0;
2385 s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
2388 s = format (s, "del-all ");
2390 s = format (s, "%s ", mp->is_add ? "add" : "del");
2391 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2393 s = format (s, "eid %U ", format_lisp_flat_eid,
2394 mp->eid_type, mp->eid, mp->eid_len);
2398 s = format (s, "seid %U ", format_lisp_flat_eid,
2399 mp->eid_type, mp->seid, mp->seid_len);
2402 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
2405 s = format (s, "action %d", mp->action);
2410 static void *vl_api_lisp_add_del_adjacency_t_print
2411 (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
2415 s = format (0, "SCRIPT: lisp_add_del_adjacency ");
2417 s = format (s, "%s ", mp->is_add ? "add" : "del");
2418 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2419 s = format (s, "reid %U leid %U ",
2420 format_lisp_flat_eid, mp->eid_type, mp->reid, mp->reid_len,
2421 format_lisp_flat_eid, mp->eid_type, mp->leid, mp->leid_len);
2426 static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
2427 (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
2431 s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
2434 s = format (s, "%s", mp->locator_set_name);
2436 s = format (s, "del");
2441 static void *vl_api_lisp_eid_table_add_del_map_t_print
2442 (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
2446 s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
2449 s = format (s, "del ");
2451 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2452 s = format (s, "%s %d ",
2453 mp->is_l2 ? "bd_index" : "vrf",
2454 clib_net_to_host_u32 (mp->dp_table));
2458 static void *vl_api_lisp_add_del_local_eid_t_print
2459 (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
2463 s = format (0, "SCRIPT: lisp_add_del_local_eid ");
2466 s = format (s, "del ");
2468 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2469 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
2471 s = format (s, "locator-set %s ", mp->locator_set_name);
2474 u32 key_id = mp->key_id;
2475 s = format (s, "key-id %U", format_hmac_key_id, key_id);
2476 s = format (s, "secret-key %s", mp->key);
2481 static void *vl_api_gpe_add_del_fwd_entry_t_print
2482 (vl_api_gpe_add_del_fwd_entry_t * mp, void *handle)
2486 s = format (0, "SCRIPT: gpe_add_del_fwd_entry TODO");
2491 static void *vl_api_lisp_add_del_map_resolver_t_print
2492 (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
2496 s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
2499 s = format (s, "del ");
2502 s = format (s, "%U ", format_ip6_address, mp->ip_address);
2504 s = format (s, "%U ", format_ip4_address, mp->ip_address);
2509 static void *vl_api_gpe_enable_disable_t_print
2510 (vl_api_gpe_enable_disable_t * mp, void *handle)
2514 s = format (0, "SCRIPT: gpe_enable_disable ");
2516 s = format (s, "%s ", mp->is_en ? "enable" : "disable");
2521 static void *vl_api_lisp_add_del_locator_set_t_print
2522 (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
2527 s = format (0, "SCRIPT: lisp_add_del_locator_set ");
2530 s = format (s, "del ");
2532 s = format (s, "locator-set %s ", mp->locator_set_name);
2534 loc_num = clib_net_to_host_u32 (mp->locator_num);
2539 static void *vl_api_lisp_add_del_locator_t_print
2540 (vl_api_lisp_add_del_locator_t * mp, void *handle)
2544 s = format (0, "SCRIPT: lisp_add_del_locator ");
2547 s = format (s, "del ");
2549 s = format (s, "locator-set %s ", mp->locator_set_name);
2550 s = format (s, "sw_if_index %d ", mp->sw_if_index);
2551 s = format (s, "p %d w %d ", mp->priority, mp->weight);
2556 static void *vl_api_lisp_locator_set_dump_t_print
2557 (vl_api_lisp_locator_set_dump_t * mp, void *handle)
2561 s = format (0, "SCRIPT: lisp_locator_set_dump ");
2562 if (mp->filter == 1)
2563 s = format (s, "local");
2564 else if (mp->filter == 2)
2565 s = format (s, "remote");
2570 static void *vl_api_lisp_locator_dump_t_print
2571 (vl_api_lisp_locator_dump_t * mp, void *handle)
2575 s = format (0, "SCRIPT: lisp_locator_dump ");
2576 if (mp->is_index_set)
2577 s = format (s, "ls_index %d", clib_net_to_host_u32 (mp->ls_index));
2579 s = format (s, "ls_name %s", mp->ls_name);
2584 static void *vl_api_lisp_map_request_mode_t_print
2585 (vl_api_lisp_map_request_mode_t * mp, void *handle)
2589 s = format (0, "SCRIPT: lisp_map_request_mode ");
2594 s = format (s, "dst-only");
2597 s = format (s, "src-dst");
2605 static void *vl_api_lisp_eid_table_dump_t_print
2606 (vl_api_lisp_eid_table_dump_t * mp, void *handle)
2610 s = format (0, "SCRIPT: lisp_eid_table_dump ");
2614 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2615 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
2616 mp->eid, mp->prefix_length);
2620 s = format (s, "local ");
2623 s = format (s, "remote ");
2631 static void *vl_api_lisp_rloc_probe_enable_disable_t_print
2632 (vl_api_lisp_rloc_probe_enable_disable_t * mp, void *handle)
2636 s = format (0, "SCRIPT: lisp_rloc_probe_enable_disable ");
2638 s = format (s, "enable");
2640 s = format (s, "disable");
2645 static void *vl_api_lisp_map_register_enable_disable_t_print
2646 (vl_api_lisp_map_register_enable_disable_t * mp, void *handle)
2650 s = format (0, "SCRIPT: lisp_map_register_enable_disable ");
2652 s = format (s, "enable");
2654 s = format (s, "disable");
2659 static void *vl_api_lisp_adjacencies_get_t_print
2660 (vl_api_lisp_adjacencies_get_t * mp, void *handle)
2664 s = format (0, "SCRIPT: lisp_adjacencies_get ");
2665 s = format (s, "vni %d", clib_net_to_host_u32 (mp->vni));
2670 static void *vl_api_lisp_eid_table_map_dump_t_print
2671 (vl_api_lisp_eid_table_map_dump_t * mp, void *handle)
2675 s = format (0, "SCRIPT: lisp_eid_table_map_dump ");
2678 s = format (s, "l2");
2680 s = format (s, "l3");
2685 static void *vl_api_ipsec_gre_add_del_tunnel_t_print
2686 (vl_api_ipsec_gre_add_del_tunnel_t * mp, void *handle)
2690 s = format (0, "SCRIPT: ipsec_gre_add_del_tunnel ");
2692 s = format (s, "dst %U ", format_ip4_address,
2693 (ip4_address_t *) & (mp->dst_address));
2695 s = format (s, "src %U ", format_ip4_address,
2696 (ip4_address_t *) & (mp->src_address));
2698 s = format (s, "local_sa %d ", ntohl (mp->local_sa_id));
2700 s = format (s, "remote_sa %d ", ntohl (mp->remote_sa_id));
2702 if (mp->is_add == 0)
2703 s = format (s, "del ");
2708 static void *vl_api_ipsec_gre_tunnel_dump_t_print
2709 (vl_api_ipsec_gre_tunnel_dump_t * mp, void *handle)
2713 s = format (0, "SCRIPT: ipsec_gre_tunnel_dump ");
2715 if (mp->sw_if_index != ~0)
2716 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2721 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
2722 (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
2725 u32 vtr_op = ntohl (mp->vtr_op);
2727 s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
2729 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2730 s = format (s, "vtr_op %d ", vtr_op);
2731 if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
2733 if (vtr_op == L2_VTR_TRANSLATE_2_2)
2734 s = format (s, "%d ", ntohs (mp->outer_tag));
2735 s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
2736 s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
2737 s = format (s, "sid %d ", ntohl (mp->i_sid));
2738 s = format (s, "vlanid %d ", ntohs (mp->b_vlanid));
2744 static void *vl_api_flow_classify_set_interface_t_print
2745 (vl_api_flow_classify_set_interface_t * mp, void *handle)
2749 s = format (0, "SCRIPT: flow_classify_set_interface ");
2750 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2751 if (mp->ip4_table_index != ~0)
2752 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2753 if (mp->ip6_table_index != ~0)
2754 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2755 if (mp->is_add == 0)
2756 s = format (s, "del ");
2762 vl_api_punt_t_print (vl_api_punt_t * mp, void *handle)
2766 s = format (0, "SCRIPT: punt ");
2768 if (mp->ipv != (u8) ~ 0)
2769 s = format (s, "ip %d ", mp->ipv);
2771 s = format (s, "protocol %d ", mp->l4_protocol);
2773 if (mp->l4_port != (u16) ~ 0)
2774 s = format (s, "port %d ", ntohs (mp->l4_port));
2777 s = format (s, "del ");
2782 static void *vl_api_flow_classify_dump_t_print
2783 (vl_api_flow_classify_dump_t * mp, void *handle)
2787 s = format (0, "SCRIPT: flow_classify_dump ");
2790 case FLOW_CLASSIFY_TABLE_IP4:
2791 s = format (s, "type ip4 ");
2793 case FLOW_CLASSIFY_TABLE_IP6:
2794 s = format (s, "type ip6 ");
2803 static void *vl_api_get_first_msg_id_t_print
2804 (vl_api_get_first_msg_id_t * mp, void *handle)
2808 s = format (0, "SCRIPT: get_first_msg_id %s ", mp->name);
2813 static void *vl_api_ioam_enable_t_print
2814 (vl_api_ioam_enable_t * mp, void *handle)
2818 s = format (0, "SCRIPT: ioam_enable ");
2820 if (mp->trace_enable)
2821 s = format (s, "trace enabled");
2824 s = format (s, "POT enabled");
2827 s = format (s, "Seqno enabled");
2830 s = format (s, "Analyse enabled");
2835 static void *vl_api_ioam_disable_t_print
2836 (vl_api_ioam_disable_t * mp, void *handle)
2840 s = format (0, "SCRIPT: ioam_disable ");
2841 s = format (s, "trace disabled");
2842 s = format (s, "POT disabled");
2843 s = format (s, "Seqno disabled");
2844 s = format (s, "Analyse disabled");
2849 static void *vl_api_feature_enable_disable_t_print
2850 (vl_api_feature_enable_disable_t * mp, void *handle)
2854 s = format (0, "SCRIPT: feature_enable_disable ");
2855 s = format (s, "arc_name %s ", mp->arc_name);
2856 s = format (s, "feature_name %s ", mp->feature_name);
2857 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2859 s = format (s, "disable");
2864 static void *vl_api_sw_interface_tag_add_del_t_print
2865 (vl_api_sw_interface_tag_add_del_t * mp, void *handle)
2869 s = format (0, "SCRIPT: sw_interface_tag_add_del ");
2870 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2872 s = format (s, "tag %s ", mp->tag);
2874 s = format (s, "del ");
2879 static void *vl_api_sw_interface_set_mtu_t_print
2880 (vl_api_sw_interface_set_mtu_t * mp, void *handle)
2884 s = format (0, "SCRIPT: sw_interface_set_mtu ");
2885 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2886 s = format (s, "tag %d ", ntohs (mp->mtu));
2891 #define foreach_custom_print_no_arg_function \
2892 _(lisp_eid_table_vni_dump) \
2893 _(lisp_map_resolver_dump) \
2894 _(lisp_map_server_dump) \
2895 _(show_lisp_rloc_probe_state) \
2896 _(show_lisp_map_register_state) \
2897 _(show_lisp_map_request_mode)
2900 static void * vl_api_ ## f ## _t_print \
2901 (vl_api_ ## f ## _t * mp, void * handle) \
2904 s = format (0, "SCRIPT: " #f ); \
2907 foreach_custom_print_no_arg_function
2909 #define foreach_custom_print_function \
2910 _(CREATE_LOOPBACK, create_loopback) \
2911 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \
2912 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
2913 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \
2914 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \
2915 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \
2916 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \
2917 _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass) \
2918 _(TAP_CONNECT, tap_connect) \
2919 _(TAP_MODIFY, tap_modify) \
2920 _(TAP_DELETE, tap_delete) \
2921 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \
2922 _(IP_ADD_DEL_ROUTE, ip_add_del_route) \
2923 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
2924 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
2925 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \
2926 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered) \
2927 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \
2928 _(RESET_VRF, reset_vrf) \
2929 _(CREATE_VLAN_SUBIF, create_vlan_subif) \
2930 _(CREATE_SUBIF, create_subif) \
2931 _(OAM_ADD_DEL, oam_add_del) \
2932 _(RESET_FIB, reset_fib) \
2933 _(DHCP_PROXY_CONFIG, dhcp_proxy_config) \
2934 _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss) \
2935 _(SET_IP_FLOW_HASH, set_ip_flow_hash) \
2936 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \
2937 sw_interface_ip6_set_link_local_address) \
2938 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix) \
2939 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config) \
2940 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \
2941 _(L2_PATCH_ADD_DEL, l2_patch_add_del) \
2942 _(SR_LOCALSID_ADD_DEL, sr_localsid_add_del) \
2943 _(SR_STEERING_ADD_DEL, sr_steering_add_del) \
2944 _(SR_POLICY_ADD, sr_policy_add) \
2945 _(SR_POLICY_MOD, sr_policy_mod) \
2946 _(SR_POLICY_DEL, sr_policy_del) \
2947 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \
2948 _(L2FIB_ADD_DEL, l2fib_add_del) \
2949 _(L2_FLAGS, l2_flags) \
2950 _(BRIDGE_FLAGS, bridge_flags) \
2951 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table) \
2952 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session) \
2953 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \
2954 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
2955 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
2956 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \
2957 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \
2958 _(ADD_NODE_NEXT, add_node_next) \
2959 _(DHCP_CLIENT_CONFIG, dhcp_client_config) \
2960 _(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel) \
2961 _(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies) \
2962 _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable) \
2963 _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \
2964 _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \
2965 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \
2966 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \
2967 _(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel) \
2968 _(GRE_TUNNEL_DUMP, gre_tunnel_dump) \
2969 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \
2970 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \
2971 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \
2972 _(CREATE_VHOST_USER_IF, create_vhost_user_if) \
2973 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if) \
2974 _(DELETE_VHOST_USER_IF, delete_vhost_user_if) \
2975 _(SW_INTERFACE_DUMP, sw_interface_dump) \
2976 _(CONTROL_PING, control_ping) \
2977 _(WANT_INTERFACE_EVENTS, want_interface_events) \
2978 _(CLI_REQUEST, cli_request) \
2979 _(CLI_INBAND, cli_inband) \
2980 _(MEMCLNT_CREATE, memclnt_create) \
2981 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump) \
2982 _(SHOW_VERSION, show_version) \
2983 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
2984 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel) \
2985 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump) \
2986 _(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
2987 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
2988 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events) \
2989 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
2990 _(IP_ADDRESS_DUMP, ip_address_dump) \
2991 _(IP_DUMP, ip_dump) \
2992 _(DELETE_LOOPBACK, delete_loopback) \
2993 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \
2994 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \
2995 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \
2996 _(AF_PACKET_CREATE, af_packet_create) \
2997 _(AF_PACKET_DELETE, af_packet_delete) \
2998 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) \
2999 _(MPLS_FIB_DUMP, mpls_fib_dump) \
3000 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \
3001 _(CLASSIFY_TABLE_IDS,classify_table_ids) \
3002 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface) \
3003 _(CLASSIFY_TABLE_INFO,classify_table_info) \
3004 _(CLASSIFY_SESSION_DUMP,classify_session_dump) \
3005 _(SET_IPFIX_EXPORTER, set_ipfix_exporter) \
3006 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump) \
3007 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream) \
3008 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump) \
3009 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del) \
3010 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump) \
3011 _(SW_INTERFACE_SPAN_ENABLE_DISABLE, sw_interface_span_enable_disable) \
3012 _(SW_INTERFACE_SPAN_DUMP, sw_interface_span_dump) \
3013 _(GET_NEXT_INDEX, get_next_index) \
3014 _(PG_CREATE_INTERFACE,pg_create_interface) \
3015 _(PG_CAPTURE, pg_capture) \
3016 _(PG_ENABLE_DISABLE, pg_enable_disable) \
3017 _(POLICER_ADD_DEL, policer_add_del) \
3018 _(POLICER_DUMP, policer_dump) \
3019 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface) \
3020 _(POLICER_CLASSIFY_DUMP, policer_classify_dump) \
3021 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \
3022 ip_source_and_port_range_check_add_del) \
3023 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \
3024 ip_source_and_port_range_check_interface_add_del) \
3025 _(LISP_ENABLE_DISABLE, lisp_enable_disable) \
3026 _(GPE_ENABLE_DISABLE, gpe_enable_disable) \
3027 _(GPE_ADD_DEL_IFACE, gpe_add_del_iface) \
3028 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
3029 _(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
3030 _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
3031 _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
3032 _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
3033 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
3034 lisp_add_del_map_request_itr_rlocs) \
3035 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
3036 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
3037 _(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry) \
3038 _(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
3039 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
3040 _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
3041 _(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
3042 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
3043 _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
3044 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
3045 _(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
3046 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
3047 _(LISP_LOCATOR_DUMP, lisp_locator_dump) \
3048 _(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \
3049 _(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \
3050 _(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \
3051 _(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \
3052 _(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \
3053 _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel) \
3054 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump) \
3055 _(DELETE_SUBIF, delete_subif) \
3056 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \
3058 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface) \
3059 _(FLOW_CLASSIFY_DUMP, flow_classify_dump) \
3060 _(GET_FIRST_MSG_ID, get_first_msg_id) \
3061 _(IOAM_ENABLE, ioam_enable) \
3062 _(IOAM_DISABLE, ioam_disable) \
3063 _(IP_FIB_DUMP, ip_fib_dump) \
3064 _(IP6_FIB_DUMP, ip6_fib_dump) \
3065 _(FEATURE_ENABLE_DISABLE, feature_enable_disable) \
3066 _(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del) \
3067 _(SW_INTERFACE_SET_MTU, sw_interface_set_mtu)
3069 vl_msg_api_custom_dump_configure (api_main_t * am)
3071 #define _(n,f) am->msg_print_handlers[VL_API_##n] \
3072 = (void *) vl_api_##f##_t_print;
3073 foreach_custom_print_function;
3078 * fd.io coding-style-patch-verification: ON
3081 * eval: (c-set-style "gnu")