2 * ------------------------------------------------------------------
3 * custom_dump.c - pretty-print API messages for replay
5 * Copyright (c) 2014-2016 Cisco and/or its affiliates. Licensed under the
6 * Apache License, Version 2.0 (the "License"); you may not use this file
7 * except in compliance with the License. You may obtain a copy of the
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, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 * License for the specific language governing permissions and limitations
17 * ------------------------------------------------------------------
20 #include <vnet/vnet.h>
21 #include <vnet/ip/ip.h>
22 #include <vnet/ip/ip_neighbor.h>
23 #include <vnet/unix/tuntap.h>
24 #include <vnet/mpls/mpls.h>
25 #include <vnet/dhcp/dhcp_proxy.h>
26 #include <vnet/l2tp/l2tp.h>
27 #include <vnet/l2/l2_input.h>
28 #include <vnet/srv6/sr.h>
29 #include <vnet/srmpls/sr_mpls.h>
30 #include <vnet/gre/gre.h>
31 #include <vnet/vxlan-gpe/vxlan_gpe.h>
32 #include <vnet/geneve/geneve.h>
33 #include <vnet/classify/policer_classify.h>
34 #include <vnet/policer/xlate.h>
35 #include <vnet/policer/policer.h>
36 #include <vnet/classify/flow_classify.h>
37 #include <vlib/vlib.h>
38 #include <vlib/unix/unix.h>
39 #include <vlibapi/api.h>
40 #include <vlibmemory/api.h>
41 #include <vnet/lisp-cp/lisp_types.h>
42 #include <vnet/qos/qos_types.h>
43 #include <vpp/stats/stats.h>
44 #include <vpp/oam/oam.h>
46 #include <vnet/ethernet/ethernet.h>
47 #include <vnet/l2/l2_vtr.h>
49 #include <vpp/api/vpe_msg_enum.h>
51 #include <vnet/bonding/node.h>
53 #define vl_typedefs /* define message structures */
54 #include <vpp/api/vpe_all_api_h.h>
57 #define vl_endianfun /* define message structures */
58 #include <vpp/api/vpe_all_api_h.h>
61 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
65 vl_print (handle, (char *)s); \
70 static void *vl_api_create_loopback_t_print
71 (vl_api_create_loopback_t * mp, void *handle)
75 s = format (0, "SCRIPT: create_loopback ");
76 s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
81 static void *vl_api_create_loopback_instance_t_print
82 (vl_api_create_loopback_instance_t * mp, void *handle)
86 s = format (0, "SCRIPT: create_loopback ");
87 s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
88 s = format (s, "instance %d ", ntohl (mp->user_instance));
93 static void *vl_api_delete_loopback_t_print
94 (vl_api_delete_loopback_t * mp, void *handle)
98 s = format (0, "SCRIPT: delete_loopback ");
99 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
104 static void *vl_api_sw_interface_set_flags_t_print
105 (vl_api_sw_interface_set_flags_t * mp, void *handle)
108 s = format (0, "SCRIPT: sw_interface_set_flags ");
110 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
112 if (mp->admin_up_down)
113 s = format (s, "admin-up ");
115 s = format (s, "admin-down ");
120 static void *vl_api_sw_interface_set_rx_placement_t_print
121 (vl_api_sw_interface_set_rx_placement_t * mp, void *handle)
124 s = format (0, "SCRIPT: sw_interface_set_rx_placement ");
126 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
128 s = format (s, "queue %d ", ntohl (mp->queue_id));
130 s = format (s, "main ");
132 s = format (s, "worker %d ", ntohl (mp->worker_id));
137 static void *vl_api_sw_interface_event_t_print
138 (vl_api_sw_interface_event_t * mp, void *handle)
141 s = format (0, "SCRIPT: sw_interface_event ");
143 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
145 if (mp->admin_up_down)
146 s = format (s, "admin-up ");
148 s = format (s, "admin-down ");
150 if (mp->link_up_down)
151 s = format (s, "link-up");
153 s = format (s, "link-down");
156 s = format (s, " deleted");
161 static void *vl_api_sw_interface_add_del_address_t_print
162 (vl_api_sw_interface_add_del_address_t * mp, void *handle)
166 s = format (0, "SCRIPT: sw_interface_add_del_address ");
168 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
171 s = format (s, "%U/%d ", format_ip6_address,
172 (ip6_address_t *) mp->address, mp->address_length);
174 s = format (s, "%U/%d ", format_ip4_address,
175 (ip4_address_t *) mp->address, mp->address_length);
178 s = format (s, "del ");
180 s = format (s, "del-all ");
185 static void *vl_api_sw_interface_set_table_t_print
186 (vl_api_sw_interface_set_table_t * mp, void *handle)
190 s = format (0, "SCRIPT: sw_interface_set_table ");
192 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
195 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
198 s = format (s, "ipv6 ");
203 static void *vl_api_sw_interface_set_mpls_enable_t_print
204 (vl_api_sw_interface_set_mpls_enable_t * mp, void *handle)
208 s = format (0, "SCRIPT: sw_interface_set_mpls_enable ");
210 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
213 s = format (s, "disable");
218 static void *vl_api_sw_interface_set_vpath_t_print
219 (vl_api_sw_interface_set_vpath_t * mp, void *handle)
223 s = format (0, "SCRIPT: sw_interface_set_vpath ");
225 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
228 s = format (s, "enable ");
230 s = format (s, "disable ");
235 static void *vl_api_sw_interface_set_vxlan_bypass_t_print
236 (vl_api_sw_interface_set_vxlan_bypass_t * mp, void *handle)
240 s = format (0, "SCRIPT: sw_interface_set_vxlan_bypass ");
242 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
245 s = format (s, "ip6 ");
248 s = format (s, "enable ");
250 s = format (s, "disable ");
255 static void *vl_api_sw_interface_set_geneve_bypass_t_print
256 (vl_api_sw_interface_set_geneve_bypass_t * mp, void *handle)
260 s = format (0, "SCRIPT: sw_interface_set_geneve_bypass ");
262 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
265 s = format (s, "ip6 ");
268 s = format (s, "enable ");
270 s = format (s, "disable ");
275 static void *vl_api_sw_interface_set_l2_xconnect_t_print
276 (vl_api_sw_interface_set_l2_xconnect_t * mp, void *handle)
280 s = format (0, "SCRIPT: sw_interface_set_l2_xconnect ");
282 s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
286 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
289 s = format (s, "delete ");
294 static void *vl_api_sw_interface_set_l2_bridge_t_print
295 (vl_api_sw_interface_set_l2_bridge_t * mp, void *handle)
299 s = format (0, "SCRIPT: sw_interface_set_l2_bridge ");
301 s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
305 s = format (s, "bd_id %d shg %d %senable ", ntohl (mp->bd_id),
306 mp->shg, ((mp->bvi) ? "bvi " : " "));
309 s = format (s, "disable ");
314 static void *vl_api_bridge_domain_add_del_t_print
315 (vl_api_bridge_domain_add_del_t * mp, void *handle)
319 s = format (0, "SCRIPT: bridge_domain_add_del ");
321 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
326 s = format (s, "bd_tag %s ", mp->bd_tag);
327 s = format (s, "flood %d uu-flood %d ", mp->flood, mp->uu_flood);
328 s = format (s, "forward %d learn %d ", mp->forward, mp->learn);
329 s = format (s, "arp-term %d mac-age %d", mp->arp_term, mp->mac_age);
332 s = format (s, "del ");
337 static void *vl_api_bridge_domain_set_mac_age_t_print
338 (vl_api_bridge_domain_set_mac_age_t * mp, void *handle)
342 s = format (0, "SCRIPT: bridge_domain_set_mac_age ");
344 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
346 s = format (s, "mac-age %d", mp->mac_age);
351 static void *vl_api_bridge_domain_dump_t_print
352 (vl_api_bridge_domain_dump_t * mp, void *handle)
355 u32 bd_id = ntohl (mp->bd_id);
357 s = format (0, "SCRIPT: bridge_domain_dump ");
360 s = format (s, "bd_id %d ", bd_id);
365 static void *vl_api_l2fib_flush_all_t_print
366 (vl_api_l2fib_flush_all_t * mp, void *handle)
370 s = format (0, "SCRIPT: l2fib_flush_all ");
376 static void *vl_api_l2fib_flush_bd_t_print
377 (vl_api_l2fib_flush_bd_t * mp, void *handle)
380 u32 bd_id = ntohl (mp->bd_id);
382 s = format (0, "SCRIPT: l2fib_flush_bd ");
383 s = format (s, "bd_id %d ", bd_id);
388 static void *vl_api_l2fib_flush_int_t_print
389 (vl_api_l2fib_flush_int_t * mp, void *handle)
392 u32 sw_if_index = ntohl (mp->sw_if_index);
394 s = format (0, "SCRIPT: l2fib_flush_int ");
395 s = format (s, "sw_if_index %d ", sw_if_index);
400 static void *vl_api_l2fib_add_del_t_print
401 (vl_api_l2fib_add_del_t * mp, void *handle)
405 s = format (0, "SCRIPT: l2fib_add_del ");
407 s = format (s, "mac %U ", format_ethernet_address, mp->mac);
409 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
414 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
416 s = format (s, "%s", "static ");
418 s = format (s, "%s", "filter ");
420 s = format (s, "%s", "bvi ");
424 s = format (s, "del ");
431 vl_api_l2_flags_t_print (vl_api_l2_flags_t * mp, void *handle)
434 u32 flags = ntohl (mp->feature_bitmap);
436 s = format (0, "SCRIPT: l2_flags ");
438 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
440 if (flags & L2_LEARN)
441 s = format (s, "learn ");
443 s = format (s, "forward ");
444 if (flags & L2_FLOOD)
445 s = format (s, "flood ");
446 if (flags & L2_UU_FLOOD)
447 s = format (s, "uu-flood ");
448 if (flags & L2_ARP_TERM)
449 s = format (s, "arp-term ");
452 s = format (s, "clear ");
457 static void *vl_api_bridge_flags_t_print
458 (vl_api_bridge_flags_t * mp, void *handle)
461 u32 flags = ntohl (mp->feature_bitmap);
463 s = format (0, "SCRIPT: bridge_flags ");
465 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
467 if (flags & L2_LEARN)
468 s = format (s, "learn ");
470 s = format (s, "forward ");
471 if (flags & L2_FLOOD)
472 s = format (s, "flood ");
473 if (flags & L2_UU_FLOOD)
474 s = format (s, "uu-flood ");
475 if (flags & L2_ARP_TERM)
476 s = format (s, "arp-term ");
479 s = format (s, "clear ");
484 static void *vl_api_bd_ip_mac_add_del_t_print
485 (vl_api_bd_ip_mac_add_del_t * mp, void *handle)
489 s = format (0, "SCRIPT: bd_ip_mac_add_del ");
490 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
493 s = format (s, "%U ", format_ip6_address,
494 (ip6_address_t *) mp->ip_address);
496 s = format (s, "%U ", format_ip4_address,
497 (ip4_address_t *) mp->ip_address);
499 s = format (s, "%U ", format_ethernet_address, mp->mac_address);
501 s = format (s, "del ");
506 static void *vl_api_bd_ip_mac_dump_t_print
507 (vl_api_bd_ip_mac_dump_t * mp, void *handle)
511 s = format (0, "SCRIPT: bd_ip_mac_dump ");
516 static void *vl_api_tap_connect_t_print
517 (vl_api_tap_connect_t * mp, void *handle)
522 memset (null_mac, 0, sizeof (null_mac));
524 s = format (0, "SCRIPT: tap_connect ");
525 s = format (s, "tapname %s ", mp->tap_name);
526 if (mp->use_random_mac)
527 s = format (s, "random-mac ");
529 s = format (s, "tag %s ", mp->tag);
530 if (memcmp (mp->mac_address, null_mac, 6))
531 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
532 if (mp->ip4_address_set)
533 s = format (s, "address %U/%d ", format_ip4_address, mp->ip4_address,
535 if (mp->ip6_address_set)
536 s = format (s, "address %U/%d ", format_ip6_address, mp->ip6_address,
541 static void *vl_api_tap_modify_t_print
542 (vl_api_tap_modify_t * mp, void *handle)
547 memset (null_mac, 0, sizeof (null_mac));
549 s = format (0, "SCRIPT: tap_modify ");
550 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
551 s = format (s, "tapname %s ", mp->tap_name);
552 if (mp->use_random_mac)
553 s = format (s, "random-mac ");
555 if (memcmp (mp->mac_address, null_mac, 6))
556 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
561 static void *vl_api_tap_delete_t_print
562 (vl_api_tap_delete_t * mp, void *handle)
566 s = format (0, "SCRIPT: tap_delete ");
567 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
572 static void *vl_api_sw_interface_tap_dump_t_print
573 (vl_api_sw_interface_tap_dump_t * mp, void *handle)
577 s = format (0, "SCRIPT: sw_interface_tap_dump ");
582 static void *vl_api_tap_create_v2_t_print
583 (vl_api_tap_create_v2_t * mp, void *handle)
588 memset (null_mac, 0, sizeof (null_mac));
590 s = format (0, "SCRIPT: tap_create_v2 ");
591 s = format (s, "id %u ", ntohl (mp->id));
592 if (memcmp (mp->mac_address, null_mac, 6))
593 s = format (s, "mac-address %U ",
594 format_ethernet_address, mp->mac_address);
595 if (memcmp (mp->host_mac_addr, null_mac, 6))
596 s = format (s, "host-mac-addr %U ",
597 format_ethernet_address, mp->host_mac_addr);
598 if (mp->host_if_name_set)
599 s = format (s, "host-if-name %s ", mp->host_if_name);
600 if (mp->host_namespace_set)
601 s = format (s, "host-ns %s ", mp->host_namespace);
602 if (mp->host_bridge_set)
603 s = format (s, "host-bridge %s ", mp->host_bridge);
604 if (mp->host_ip4_addr_set)
605 s = format (s, "host-ip4-addr %U/%d ", format_ip4_address,
606 mp->host_ip4_addr, mp->host_ip4_prefix_len);
607 if (mp->host_ip6_addr_set)
608 s = format (s, "host-ip6-addr %U/%d ", format_ip6_address,
609 mp->host_ip6_addr, mp->host_ip6_prefix_len);
610 if (mp->host_ip4_gw_set)
611 s = format (s, "host-ip4-gw %U ", format_ip4_address, mp->host_ip4_addr);
612 if (mp->host_ip6_gw_set)
613 s = format (s, "host-ip6-gw %U ", format_ip6_address, mp->host_ip6_addr);
615 s = format (s, "tx-ring-size %u ", ntohs (mp->tx_ring_sz));
617 s = format (s, "rx-ring-size %u ", ntohs (mp->rx_ring_sz));
621 static void *vl_api_tap_delete_v2_t_print
622 (vl_api_tap_delete_v2_t * mp, void *handle)
626 s = format (0, "SCRIPT: tap_delete_v2 ");
627 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
632 static void *vl_api_sw_interface_tap_v2_dump_t_print
633 (vl_api_sw_interface_tap_v2_dump_t * mp, void *handle)
637 s = format (0, "SCRIPT: sw_interface_tap_v2_dump ");
642 static void *vl_api_bond_create_t_print
643 (vl_api_bond_create_t * mp, void *handle)
648 memset (null_mac, 0, sizeof (null_mac));
650 s = format (0, "SCRIPT: bond_create ");
651 if (memcmp (mp->mac_address, null_mac, 6))
652 s = format (s, "mac-address %U ",
653 format_ethernet_address, mp->mac_address);
655 s = format (s, "mode %U", format_bond_mode, mp->mode);
657 s = format (s, "lb %U", format_bond_load_balance, mp->lb);
661 static void *vl_api_bond_delete_t_print
662 (vl_api_bond_delete_t * mp, void *handle)
666 s = format (0, "SCRIPT: bond_delete ");
667 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
672 static void *vl_api_bond_enslave_t_print
673 (vl_api_bond_enslave_t * mp, void *handle)
677 s = format (0, "SCRIPT: bond_enslave ");
678 s = format (s, "bond_sw_if_index %u ", mp->bond_sw_if_index);
679 s = format (s, "sw_if_index %u ", mp->sw_if_index);
681 s = format (s, "passive ");
682 if (mp->is_long_timeout)
683 s = format (s, "long-timeout ");
688 static void *vl_api_bond_detach_slave_t_print
689 (vl_api_bond_detach_slave_t * mp, void *handle)
693 s = format (0, "SCRIPT: bond_detach_slave ");
694 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
699 static void *vl_api_sw_interface_bond_dump_t_print
700 (vl_api_sw_interface_bond_dump_t * mp, void *handle)
704 s = format (0, "SCRIPT: sw_interface_bond_dump ");
709 static void *vl_api_sw_interface_slave_dump_t_print
710 (vl_api_sw_interface_slave_dump_t * mp, void *handle)
714 s = format (0, "SCRIPT: sw_interface_slave_dump ");
715 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
720 static void *vl_api_ip_add_del_route_t_print
721 (vl_api_ip_add_del_route_t * mp, void *handle)
725 s = format (0, "SCRIPT: ip_add_del_route ");
727 s = format (s, "del ");
729 if (mp->next_hop_sw_if_index != ~0)
730 s = format (s, "sw_if_index %d ", ntohl (mp->next_hop_sw_if_index));
733 s = format (s, "%U/%d ", format_ip6_address, mp->dst_address,
734 mp->dst_address_length);
736 s = format (s, "%U/%d ", format_ip4_address, mp->dst_address,
737 mp->dst_address_length);
739 if (mp->table_id != 0)
740 s = format (s, "vrf %d ", ntohl (mp->table_id));
743 s = format (s, "local ");
744 else if (mp->is_drop)
745 s = format (s, "drop ");
746 else if (mp->is_classify)
747 s = format (s, "classify %d", ntohl (mp->classify_table_index));
748 else if (mp->next_hop_via_label != htonl (MPLS_LABEL_INVALID))
749 s = format (s, "via via_label %d ", ntohl (mp->next_hop_via_label));
753 s = format (s, "via %U ", format_ip6_address, mp->next_hop_address);
755 s = format (s, "via %U ", format_ip4_address, mp->next_hop_address);
758 if (mp->next_hop_weight != 1)
759 s = format (s, "weight %d ", (u32) mp->next_hop_weight);
761 if (mp->is_multipath)
762 s = format (s, "multipath ");
764 if (mp->next_hop_table_id)
765 s = format (s, "lookup-in-vrf %d ", ntohl (mp->next_hop_table_id));
767 if (mp->next_hop_n_out_labels)
769 for (u8 i = 0; i < mp->next_hop_n_out_labels; i++)
771 s = format (s, "out-label %d ",
772 ntohl (mp->next_hop_out_label_stack[i].label));
779 static void *vl_api_mpls_route_add_del_t_print
780 (vl_api_mpls_route_add_del_t * mp, void *handle)
784 s = format (0, "SCRIPT: mpls_route_add_del ");
787 s = format (s, "add ");
789 s = format (s, "del ");
791 s = format (s, "%d ", ntohl (mp->mr_label));
794 s = format (s, "eos ");
796 s = format (s, "non-eos ");
799 if (mp->mr_next_hop_proto == DPO_PROTO_IP4)
801 ip4_address_t ip4_null = {.as_u32 = 0, };
802 if (memcmp (mp->mr_next_hop, &ip4_null, sizeof (ip4_null)))
803 s = format (s, "via %U ", format_ip4_address, mp->mr_next_hop);
805 s = format (s, "via lookup-in-ip4-table %d ",
806 ntohl (mp->mr_next_hop_table_id));
808 else if (mp->mr_next_hop_proto == DPO_PROTO_IP6)
810 ip6_address_t ip6_null = { {0}
812 if (memcmp (mp->mr_next_hop, &ip6_null, sizeof (ip6_null)))
813 s = format (s, "via %U ", format_ip6_address, mp->mr_next_hop);
815 s = format (s, "via lookup-in-ip6-table %d ",
816 ntohl (mp->mr_next_hop_table_id));
818 else if (mp->mr_next_hop_proto == DPO_PROTO_ETHERNET)
820 s = format (s, "via l2-input-on ");
822 else if (mp->mr_next_hop_proto == DPO_PROTO_MPLS)
824 if (mp->mr_next_hop_via_label != htonl (MPLS_LABEL_INVALID))
826 format (s, "via via-label %d ", ntohl (mp->mr_next_hop_via_label));
828 s = format (s, "via next-hop-table %d ",
829 ntohl (mp->mr_next_hop_table_id));
831 if (mp->mr_next_hop_sw_if_index != ~0)
832 s = format (s, "sw_if_index %d ", ntohl (mp->mr_next_hop_sw_if_index));
834 if (mp->mr_next_hop_weight != 1)
835 s = format (s, "weight %d ", (u32) mp->mr_next_hop_weight);
837 if (mp->mr_is_multipath)
838 s = format (s, "multipath ");
840 if (mp->mr_is_classify)
841 s = format (s, "classify %d", ntohl (mp->mr_classify_table_index));
843 if (mp->mr_next_hop_n_out_labels)
845 for (u8 i = 0; i < mp->mr_next_hop_n_out_labels; i++)
847 s = format (s, "out-label %d ",
848 ntohl (mp->mr_next_hop_out_label_stack[i].label));
855 static void *vl_api_ip_table_add_del_t_print
856 (vl_api_ip_table_add_del_t * mp, void *handle)
860 s = format (0, "SCRIPT: ip_table_add_del ");
862 s = format (s, "add ");
864 s = format (s, "del ");
866 s = format (s, "ip6 ");
867 s = format (s, "table %d ", ntohl (mp->table_id));
872 static void *vl_api_mpls_table_add_del_t_print
873 (vl_api_mpls_table_add_del_t * mp, void *handle)
877 s = format (0, "SCRIPT: mpls_table_add_del ");
879 s = format (s, "add ");
881 s = format (s, "del ");
882 s = format (s, "table %d ", ntohl (mp->mt_table_id));
887 static void *vl_api_proxy_arp_add_del_t_print
888 (vl_api_proxy_arp_add_del_t * mp, void *handle)
892 s = format (0, "SCRIPT: proxy_arp_add_del ");
894 s = format (s, "%U - %U ",
895 format_ip4_address, mp->proxy.low_address,
896 format_ip4_address, mp->proxy.hi_address);
898 if (mp->proxy.vrf_id)
899 s = format (s, "vrf %d ", ntohl (mp->proxy.vrf_id));
902 s = format (s, "del ");
907 static void *vl_api_proxy_arp_intfc_enable_disable_t_print
908 (vl_api_proxy_arp_intfc_enable_disable_t * mp, void *handle)
912 s = format (0, "SCRIPT: proxy_arp_intfc_enable_disable ");
914 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
916 s = format (s, "enable %d ", mp->enable_disable);
921 static void *vl_api_mpls_tunnel_add_del_t_print
922 (vl_api_mpls_tunnel_add_del_t * mp, void *handle)
926 s = format (0, "SCRIPT: mpls_tunnel_add_del ");
928 if (mp->mt_next_hop_sw_if_index)
929 s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index));
931 if (mp->mt_next_hop_proto_is_ip4)
932 s = format (s, "%U ", format_ip4_address, mp->mt_next_hop);
934 s = format (s, "%U ", format_ip6_address, mp->mt_next_hop);
937 s = format (s, "l2-only ");
939 if (mp->mt_is_add == 0)
940 s = format (s, "del ");
945 static void *vl_api_sr_mpls_policy_add_t_print
946 (vl_api_sr_mpls_policy_add_t * mp, void *handle)
950 s = format (0, "SCRIPT: sr_mpls_policy_add ");
952 s = format (s, "bsid %d ", ntohl (mp->bsid));
954 if (mp->weight != htonl ((u32) 1))
955 s = format (s, "%d ", ntohl (mp->weight));
958 s = format (s, "spray ");
962 for (int i = 0; i < mp->n_segments; i++)
963 s = format (s, "next %d ", ntohl (mp->segments[i]));
969 static void *vl_api_sr_mpls_policy_del_t_print
970 (vl_api_sr_mpls_policy_del_t * mp, void *handle)
974 s = format (0, "SCRIPT: sr_mpls_policy_del ");
976 s = format (s, "bsid %d ", ntohl (mp->bsid));
981 static void *vl_api_sw_interface_set_unnumbered_t_print
982 (vl_api_sw_interface_set_unnumbered_t * mp, void *handle)
986 s = format (0, "SCRIPT: sw_interface_set_unnumbered ");
988 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
990 s = format (s, "unnum_if_index %d ", ntohl (mp->unnumbered_sw_if_index));
993 s = format (s, "del ");
998 static void *vl_api_ip_neighbor_add_del_t_print
999 (vl_api_ip_neighbor_add_del_t * mp, void *handle)
1004 memset (null_mac, 0, sizeof (null_mac));
1006 s = format (0, "SCRIPT: ip_neighbor_add_del ");
1008 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1011 s = format (s, "is_static ");
1013 if (mp->is_no_adj_fib)
1014 s = format (s, "is_no_fib_entry ");
1016 if (memcmp (mp->mac_address, null_mac, 6))
1017 s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
1021 format (s, "dst %U ", format_ip6_address,
1022 (ip6_address_t *) mp->dst_address);
1025 format (s, "dst %U ", format_ip4_address,
1026 (ip4_address_t *) mp->dst_address);
1028 if (mp->is_add == 0)
1029 s = format (s, "del ");
1034 static void *vl_api_create_vlan_subif_t_print
1035 (vl_api_create_vlan_subif_t * mp, void *handle)
1039 s = format (0, "SCRIPT: create_vlan_subif ");
1041 if (mp->sw_if_index)
1042 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1045 s = format (s, "vlan_id %d ", ntohl (mp->vlan_id));
1050 #define foreach_create_subif_bit \
1057 _(outer_vlan_id_any) \
1058 _(inner_vlan_id_any)
1060 static void *vl_api_create_subif_t_print
1061 (vl_api_create_subif_t * mp, void *handle)
1065 s = format (0, "SCRIPT: create_subif ");
1067 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1069 s = format (s, "sub_id %d ", ntohl (mp->sub_id));
1071 if (mp->outer_vlan_id)
1072 s = format (s, "outer_vlan_id %d ", ntohs (mp->outer_vlan_id));
1074 if (mp->inner_vlan_id)
1075 s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
1077 #define _(a) if (mp->a) s = format (s, "%s ", #a);
1078 foreach_create_subif_bit;
1084 static void *vl_api_delete_subif_t_print
1085 (vl_api_delete_subif_t * mp, void *handle)
1089 s = format (0, "SCRIPT: delete_subif ");
1090 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1095 static void *vl_api_oam_add_del_t_print
1096 (vl_api_oam_add_del_t * mp, void *handle)
1100 s = format (0, "SCRIPT: oam_add_del ");
1103 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
1105 s = format (s, "src %U ", format_ip4_address, mp->src_address);
1107 s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
1109 if (mp->is_add == 0)
1110 s = format (s, "del ");
1116 vl_api_reset_fib_t_print (vl_api_reset_fib_t * mp, void *handle)
1120 s = format (0, "SCRIPT: reset_fib ");
1123 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
1125 if (mp->is_ipv6 != 0)
1126 s = format (s, "ipv6 ");
1131 static void *vl_api_dhcp_proxy_config_t_print
1132 (vl_api_dhcp_proxy_config_t * mp, void *handle)
1136 s = format (0, "SCRIPT: dhcp_proxy_config_2 ");
1138 s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id));
1139 s = format (s, "server_vrf_id %d ", ntohl (mp->server_vrf_id));
1143 s = format (s, "svr %U ", format_ip6_address,
1144 (ip6_address_t *) mp->dhcp_server);
1145 s = format (s, "src %U ", format_ip6_address,
1146 (ip6_address_t *) mp->dhcp_src_address);
1150 s = format (s, "svr %U ", format_ip4_address,
1151 (ip4_address_t *) mp->dhcp_server);
1152 s = format (s, "src %U ", format_ip4_address,
1153 (ip4_address_t *) mp->dhcp_src_address);
1155 if (mp->is_add == 0)
1156 s = format (s, "del ");
1161 static void *vl_api_dhcp_proxy_set_vss_t_print
1162 (vl_api_dhcp_proxy_set_vss_t * mp, void *handle)
1166 s = format (0, "SCRIPT: dhcp_proxy_set_vss ");
1168 s = format (s, "tbl_id %d ", ntohl (mp->tbl_id));
1170 if (mp->vss_type == VSS_TYPE_VPN_ID)
1172 s = format (s, "fib_id %d ", ntohl (mp->vpn_index));
1173 s = format (s, "oui %d ", ntohl (mp->oui));
1175 else if (mp->vss_type == VSS_TYPE_ASCII)
1176 s = format (s, "vpn_ascii_id %s", mp->vpn_ascii_id);
1178 if (mp->is_ipv6 != 0)
1179 s = format (s, "ipv6 ");
1181 if (mp->is_add == 0)
1182 s = format (s, "del ");
1187 static void *vl_api_dhcp_client_config_t_print
1188 (vl_api_dhcp_client_config_t * mp, void *handle)
1192 s = format (0, "SCRIPT: dhcp_client_config ");
1194 s = format (s, "sw_if_index %d ", ntohl (mp->client.sw_if_index));
1196 s = format (s, "hostname %s ", mp->client.hostname);
1198 s = format (s, "want_dhcp_event %d ", mp->client.want_dhcp_event);
1200 s = format (s, "pid %d ", ntohl (mp->client.pid));
1202 if (mp->is_add == 0)
1203 s = format (s, "del ");
1209 static void *vl_api_set_ip_flow_hash_t_print
1210 (vl_api_set_ip_flow_hash_t * mp, void *handle)
1214 s = format (0, "SCRIPT: set_ip_flow_hash ");
1216 s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
1219 s = format (s, "src ");
1222 s = format (s, "dst ");
1225 s = format (s, "sport ");
1228 s = format (s, "dport ");
1231 s = format (s, "proto ");
1234 s = format (s, "reverse ");
1236 if (mp->is_ipv6 != 0)
1237 s = format (s, "ipv6 ");
1242 static void *vl_api_sw_interface_ip6_set_link_local_address_t_print
1243 (vl_api_sw_interface_ip6_set_link_local_address_t * mp, void *handle)
1247 s = format (0, "SCRIPT: sw_interface_ip6_set_link_local_address ");
1249 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1251 s = format (s, "%U ", format_ip6_address, mp->address);
1256 static void *vl_api_sw_interface_ip6nd_ra_prefix_t_print
1257 (vl_api_sw_interface_ip6nd_ra_prefix_t * mp, void *handle)
1261 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_prefix ");
1263 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1265 s = format (s, "%U/%d ", format_ip6_address, mp->address,
1266 mp->address_length);
1268 s = format (s, "val_life %d ", ntohl (mp->val_lifetime));
1270 s = format (s, "pref_life %d ", ntohl (mp->pref_lifetime));
1272 if (mp->use_default)
1273 s = format (s, "def ");
1275 if (mp->no_advertise)
1276 s = format (s, "noadv ");
1279 s = format (s, "offl ");
1281 if (mp->no_autoconfig)
1282 s = format (s, "noauto ");
1285 s = format (s, "nolink ");
1288 s = format (s, "isno ");
1293 static void *vl_api_sw_interface_ip6nd_ra_config_t_print
1294 (vl_api_sw_interface_ip6nd_ra_config_t * mp, void *handle)
1298 s = format (0, "SCRIPT: sw_interface_ip6nd_ra_config ");
1300 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1302 s = format (s, "maxint %d ", ntohl (mp->max_interval));
1304 s = format (s, "minint %d ", ntohl (mp->min_interval));
1306 s = format (s, "life %d ", ntohl (mp->lifetime));
1308 s = format (s, "count %d ", ntohl (mp->initial_count));
1310 s = format (s, "interval %d ", ntohl (mp->initial_interval));
1313 s = format (s, "suppress ");
1316 s = format (s, "managed ");
1319 s = format (s, "other ");
1322 s = format (s, "ll ");
1324 if (mp->send_unicast)
1325 s = format (s, "send ");
1328 s = format (s, "cease ");
1331 s = format (s, "isno ");
1333 if (mp->default_router)
1334 s = format (s, "def ");
1339 static void *vl_api_set_arp_neighbor_limit_t_print
1340 (vl_api_set_arp_neighbor_limit_t * mp, void *handle)
1344 s = format (0, "SCRIPT: set_arp_neighbor_limit ");
1346 s = format (s, "arp_nbr_limit %d ", ntohl (mp->arp_neighbor_limit));
1348 if (mp->is_ipv6 != 0)
1349 s = format (s, "ipv6 ");
1354 static void *vl_api_l2_patch_add_del_t_print
1355 (vl_api_l2_patch_add_del_t * mp, void *handle)
1359 s = format (0, "SCRIPT: l2_patch_add_del ");
1361 s = format (s, "rx_sw_if_index %d ", ntohl (mp->rx_sw_if_index));
1363 s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
1365 if (mp->is_add == 0)
1366 s = format (s, "del ");
1371 static void *vl_api_sr_localsid_add_del_t_print
1372 (vl_api_sr_localsid_add_del_t * mp, void *handle)
1374 vnet_main_t *vnm = vnet_get_main ();
1377 s = format (0, "SCRIPT: sr_localsid_add_del ");
1379 switch (mp->behavior)
1381 case SR_BEHAVIOR_END:
1382 s = format (s, "Address: %U\nBehavior: End",
1383 format_ip6_address, (ip6_address_t *) mp->localsid.addr);
1384 s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1389 "Address: %U\nBehavior: X (Endpoint with Layer-3 cross-connect)"
1390 "\nIface: %U\nNext hop: %U", format_ip6_address,
1391 (ip6_address_t *) mp->localsid.addr,
1392 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1393 format_ip6_address, (ip6_address_t *) mp->nh_addr6);
1394 s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1396 case SR_BEHAVIOR_DX4:
1399 "Address: %U\nBehavior: DX4 (Endpoint with decapsulation with IPv4 cross-connect)"
1400 "\nIface: %U\nNext hop: %U", format_ip6_address,
1401 (ip6_address_t *) mp->localsid.addr,
1402 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1403 format_ip4_address, (ip4_address_t *) mp->nh_addr4);
1405 case SR_BEHAVIOR_DX6:
1408 "Address: %U\nBehavior: DX6 (Endpoint with decapsulation with IPv6 cross-connect)"
1409 "\nIface: %UNext hop: %U", format_ip6_address,
1410 (ip6_address_t *) mp->localsid.addr,
1411 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1412 format_ip6_address, (ip6_address_t *) mp->nh_addr6);
1414 case SR_BEHAVIOR_DX2:
1417 "Address: %U\nBehavior: DX2 (Endpoint with decapulation and Layer-2 cross-connect)"
1418 "\nIface: %U", format_ip6_address,
1419 (ip6_address_t *) mp->localsid.addr,
1420 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index));
1422 case SR_BEHAVIOR_DT6:
1425 "Address: %U\nBehavior: DT6 (Endpoint with decapsulation and specific IPv6 table lookup)"
1426 "\nTable: %u", format_ip6_address,
1427 (ip6_address_t *) mp->localsid.addr, ntohl (mp->fib_table));
1429 case SR_BEHAVIOR_DT4:
1432 "Address: %U\nBehavior: DT4 (Endpoint with decapsulation and specific IPv4 table lookup)"
1433 "\nTable: %u", format_ip6_address,
1434 (ip6_address_t *) mp->localsid.addr, ntohl (mp->fib_table));
1437 if (mp->behavior >= SR_BEHAVIOR_LAST)
1439 s = format (s, "Address: %U\n Behavior: %u",
1440 format_ip6_address, (ip6_address_t *) mp->localsid.addr,
1444 //Should never get here...
1445 s = format (s, "Internal error");
1451 static void *vl_api_sr_steering_add_del_t_print
1452 (vl_api_sr_steering_add_del_t * mp, void *handle)
1456 s = format (0, "SCRIPT: sr_steering_add_del ");
1458 s = format (s, (mp->is_del ? "Del: True" : "Del: False"));
1460 switch (mp->traffic_type)
1463 s = format (s, "Traffic type: L2 iface: %u", ntohl (mp->sw_if_index));
1466 s = format (s, "Traffic type: IPv4 %U/%u", format_ip4_address,
1467 (ip4_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1470 s = format (s, "Traffic type: IPv6 %U/%u", format_ip6_address,
1471 (ip6_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1474 s = format (s, "Traffic type: Unknown(%u)", mp->traffic_type);
1477 s = format (s, "BindingSID: %U", format_ip6_address,
1478 (ip6_address_t *) mp->bsid_addr);
1480 s = format (s, "SR Policy Index: %u", ntohl (mp->sr_policy_index));
1482 s = format (s, "FIB_table: %u", ntohl (mp->table_id));
1487 static void *vl_api_sr_policy_add_t_print
1488 (vl_api_sr_policy_add_t * mp, void *handle)
1492 ip6_address_t *segments = 0, *seg;
1493 ip6_address_t *this_address = (ip6_address_t *) mp->sids.sids;
1496 for (i = 0; i < mp->sids.num_sids; i++)
1498 vec_add2 (segments, seg, 1);
1499 clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1503 s = format (0, "SCRIPT: sr_policy_add ");
1505 s = format (s, "BSID: %U", format_ip6_address,
1506 (ip6_address_t *) mp->bsid_addr);
1510 (mp->is_encap ? "Behavior: Encapsulation" :
1511 "Behavior: SRH insertion"));
1513 s = format (s, "FIB_table: %u", ntohl (mp->fib_table));
1515 s = format (s, (mp->type ? "Type: Default" : "Type: Spray"));
1517 s = format (s, "SID list weight: %u", ntohl (mp->weight));
1519 s = format (s, "{");
1520 vec_foreach (seg, segments)
1522 s = format (s, "%U, ", format_ip6_address, seg);
1524 s = format (s, "\b\b } ");
1529 static void *vl_api_sr_policy_mod_t_print
1530 (vl_api_sr_policy_mod_t * mp, void *handle)
1534 ip6_address_t *segments = 0, *seg;
1535 ip6_address_t *this_address = (ip6_address_t *) mp->sids.sids;
1538 for (i = 0; i < mp->sids.num_sids; i++)
1540 vec_add2 (segments, seg, 1);
1541 clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1545 s = format (0, "SCRIPT: sr_policy_mod ");
1547 s = format (s, "BSID: %U", format_ip6_address,
1548 (ip6_address_t *) mp->bsid_addr);
1550 s = format (s, "SR Policy index: %u", ntohl (mp->sr_policy_index));
1552 s = format (s, "Operation: %u", mp->operation);
1554 s = format (s, "SID list index: %u", ntohl (mp->sl_index));
1556 s = format (s, "SID list weight: %u", ntohl (mp->weight));
1558 s = format (s, "{");
1559 vec_foreach (seg, segments)
1561 s = format (s, "%U, ", format_ip6_address, seg);
1563 s = format (s, "\b\b } ");
1568 static void *vl_api_sr_policy_del_t_print
1569 (vl_api_sr_policy_del_t * mp, void *handle)
1573 s = format (0, "SCRIPT: sr_policy_del ");
1574 s = format (s, "To be delivered. Good luck.");
1578 static void *vl_api_classify_add_del_table_t_print
1579 (vl_api_classify_add_del_table_t * mp, void *handle)
1584 s = format (0, "SCRIPT: classify_add_del_table ");
1586 if (mp->is_add == 0)
1588 s = format (s, "table %d ", ntohl (mp->table_index));
1589 s = format (s, "%s ", mp->del_chain ? "del-chain" : "del");
1593 s = format (s, "nbuckets %d ", ntohl (mp->nbuckets));
1594 s = format (s, "memory_size %d ", ntohl (mp->memory_size));
1595 s = format (s, "skip %d ", ntohl (mp->skip_n_vectors));
1596 s = format (s, "match %d ", ntohl (mp->match_n_vectors));
1597 s = format (s, "next-table %d ", ntohl (mp->next_table_index));
1598 s = format (s, "miss-next %d ", ntohl (mp->miss_next_index));
1599 s = format (s, "current-data-flag %d ", ntohl (mp->current_data_flag));
1600 if (mp->current_data_flag)
1601 s = format (s, "current-data-offset %d ",
1602 ntohl (mp->current_data_offset));
1603 s = format (s, "mask hex ");
1604 for (i = 0; i < ntohl (mp->match_n_vectors) * sizeof (u32x4); i++)
1605 s = format (s, "%02x", mp->mask[i]);
1612 static void *vl_api_classify_add_del_session_t_print
1613 (vl_api_classify_add_del_session_t * mp, void *handle)
1618 s = format (0, "SCRIPT: classify_add_del_session ");
1620 s = format (s, "table_index %d ", ntohl (mp->table_index));
1621 s = format (s, "hit_next_index %d ", ntohl (mp->hit_next_index));
1622 s = format (s, "opaque_index %d ", ntohl (mp->opaque_index));
1623 s = format (s, "advance %d ", ntohl (mp->advance));
1624 s = format (s, "action %d ", mp->action);
1626 s = format (s, "metadata %d ", ntohl (mp->metadata));
1627 if (mp->is_add == 0)
1628 s = format (s, "del ");
1630 s = format (s, "match hex ");
1631 for (i = 5 * sizeof (u32x4) - 1; i > 0; i--)
1633 if (mp->match[i] != 0)
1640 for (i = 0; i < limit; i++)
1641 s = format (s, "%02x", mp->match[i]);
1646 static void *vl_api_classify_set_interface_ip_table_t_print
1647 (vl_api_classify_set_interface_ip_table_t * mp, void *handle)
1651 s = format (0, "SCRIPT: classify_set_interface_ip_table ");
1654 s = format (s, "ipv6 ");
1656 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1657 s = format (s, "table %d ", ntohl (mp->table_index));
1662 static void *vl_api_classify_set_interface_l2_tables_t_print
1663 (vl_api_classify_set_interface_l2_tables_t * mp, void *handle)
1667 s = format (0, "SCRIPT: classify_set_interface_l2_tables ");
1669 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1670 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1671 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1672 s = format (s, "other-table %d ", ntohl (mp->other_table_index));
1673 s = format (s, "is-input %d ", mp->is_input);
1678 static void *vl_api_add_node_next_t_print
1679 (vl_api_add_node_next_t * mp, void *handle)
1683 s = format (0, "SCRIPT: add_node_next ");
1685 s = format (0, "node %s next %s ", mp->node_name, mp->next_name);
1690 static void *vl_api_l2tpv3_create_tunnel_t_print
1691 (vl_api_l2tpv3_create_tunnel_t * mp, void *handle)
1695 s = format (0, "SCRIPT: l2tpv3_create_tunnel ");
1697 s = format (s, "client_address %U our_address %U ",
1698 format_ip6_address, (ip6_address_t *) (mp->client_address),
1699 format_ip6_address, (ip6_address_t *) (mp->our_address));
1700 s = format (s, "local_session_id %d ", ntohl (mp->local_session_id));
1701 s = format (s, "remote_session_id %d ", ntohl (mp->remote_session_id));
1702 s = format (s, "local_cookie %lld ",
1703 clib_net_to_host_u64 (mp->local_cookie));
1704 s = format (s, "remote_cookie %lld ",
1705 clib_net_to_host_u64 (mp->remote_cookie));
1706 if (mp->l2_sublayer_present)
1707 s = format (s, "l2-sublayer-present ");
1712 static void *vl_api_l2tpv3_set_tunnel_cookies_t_print
1713 (vl_api_l2tpv3_set_tunnel_cookies_t * mp, void *handle)
1717 s = format (0, "SCRIPT: l2tpv3_set_tunnel_cookies ");
1719 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1721 s = format (s, "new_local_cookie %llu ",
1722 clib_net_to_host_u64 (mp->new_local_cookie));
1724 s = format (s, "new_remote_cookie %llu ",
1725 clib_net_to_host_u64 (mp->new_remote_cookie));
1730 static void *vl_api_l2tpv3_interface_enable_disable_t_print
1731 (vl_api_l2tpv3_interface_enable_disable_t * mp, void *handle)
1735 s = format (0, "SCRIPT: l2tpv3_interface_enable_disable ");
1737 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1739 if (mp->enable_disable == 0)
1740 s = format (s, "del ");
1745 static void *vl_api_l2tpv3_set_lookup_key_t_print
1746 (vl_api_l2tpv3_set_lookup_key_t * mp, void *handle)
1749 char *str = "unknown";
1751 s = format (0, "SCRIPT: l2tpv3_set_lookup_key ");
1755 case L2T_LOOKUP_SRC_ADDRESS:
1756 str = "lookup_v6_src";
1758 case L2T_LOOKUP_DST_ADDRESS:
1759 str = "lookup_v6_dst";
1761 case L2T_LOOKUP_SESSION_ID:
1762 str = "lookup_session_id";
1768 s = format (s, "%s ", str);
1773 static void *vl_api_sw_if_l2tpv3_tunnel_dump_t_print
1774 (vl_api_sw_if_l2tpv3_tunnel_dump_t * mp, void *handle)
1778 s = format (0, "SCRIPT: sw_if_l2tpv3_tunnel_dump ");
1783 static void *vl_api_vxlan_add_del_tunnel_t_print
1784 (vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
1787 s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
1789 ip46_address_t src = to_ip46 (mp->is_ipv6, mp->src_address);
1790 ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->dst_address);
1792 u8 is_grp = ip46_address_is_multicast (&dst);
1793 char *dst_name = is_grp ? "group" : "dst";
1795 s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY);
1796 s = format (s, "%s %U ", dst_name, format_ip46_address,
1797 &dst, IP46_TYPE_ANY);
1800 s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1802 if (mp->encap_vrf_id)
1803 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1805 s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1807 s = format (s, "vni %d ", ntohl (mp->vni));
1809 s = format (s, "instance %d ", ntohl (mp->instance));
1811 if (mp->is_add == 0)
1812 s = format (s, "del ");
1817 static void *vl_api_vxlan_offload_rx_t_print
1818 (vl_api_vxlan_offload_rx_t * mp, void *handle)
1821 s = format (0, "SCRIPT: vxlan_offload_rx ");
1823 s = format (s, "hw hw_if_index %d ", ntohl (mp->hw_if_index));
1824 s = format (s, "rx sw_if_index %d ", ntohl (mp->sw_if_index));
1826 s = format (s, "del ");
1831 static void *vl_api_vxlan_tunnel_dump_t_print
1832 (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1836 s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1838 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1843 static void *vl_api_geneve_add_del_tunnel_t_print
1844 (vl_api_geneve_add_del_tunnel_t * mp, void *handle)
1847 s = format (0, "SCRIPT: geneve_add_del_tunnel ");
1849 ip46_address_t local = to_ip46 (mp->is_ipv6, mp->local_address);
1850 ip46_address_t remote = to_ip46 (mp->is_ipv6, mp->remote_address);
1852 u8 is_grp = ip46_address_is_multicast (&remote);
1853 char *remote_name = is_grp ? "group" : "dst";
1855 s = format (s, "src %U ", format_ip46_address, &local, IP46_TYPE_ANY);
1856 s = format (s, "%s %U ", remote_name, format_ip46_address,
1857 &remote, IP46_TYPE_ANY);
1860 s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1862 if (mp->encap_vrf_id)
1863 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1865 s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1867 s = format (s, "vni %d ", ntohl (mp->vni));
1869 if (mp->is_add == 0)
1870 s = format (s, "del ");
1875 static void *vl_api_geneve_tunnel_dump_t_print
1876 (vl_api_geneve_tunnel_dump_t * mp, void *handle)
1880 s = format (0, "SCRIPT: geneve_tunnel_dump ");
1882 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1887 static void *vl_api_gre_add_del_tunnel_t_print
1888 (vl_api_gre_add_del_tunnel_t * mp, void *handle)
1892 s = format (0, "SCRIPT: gre_add_del_tunnel ");
1894 s = format (s, "dst %U ", format_ip46_address,
1895 (ip46_address_t *) & (mp->dst_address),
1896 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1898 s = format (s, "src %U ", format_ip46_address,
1899 (ip46_address_t *) & (mp->src_address),
1900 mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1902 s = format (s, "instance %d ", ntohl (mp->instance));
1904 if (mp->tunnel_type == GRE_TUNNEL_TYPE_TEB)
1905 s = format (s, "teb ");
1907 if (mp->tunnel_type == GRE_TUNNEL_TYPE_ERSPAN)
1908 s = format (s, "erspan %d ", ntohs (mp->session_id));
1910 if (mp->outer_fib_id)
1911 s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
1913 if (mp->is_add == 0)
1914 s = format (s, "del ");
1919 static void *vl_api_gre_tunnel_dump_t_print
1920 (vl_api_gre_tunnel_dump_t * mp, void *handle)
1924 s = format (0, "SCRIPT: gre_tunnel_dump ");
1926 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1931 static void *vl_api_l2_fib_clear_table_t_print
1932 (vl_api_l2_fib_clear_table_t * mp, void *handle)
1936 s = format (0, "SCRIPT: l2_fib_clear_table ");
1941 static void *vl_api_l2_interface_efp_filter_t_print
1942 (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1946 s = format (0, "SCRIPT: l2_interface_efp_filter ");
1948 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1949 if (mp->enable_disable)
1950 s = format (s, "enable ");
1952 s = format (s, "disable ");
1957 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1958 (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1962 s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1964 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1965 s = format (s, "vtr_op %d ", ntohl (mp->vtr_op));
1966 s = format (s, "push_dot1q %d ", ntohl (mp->push_dot1q));
1967 s = format (s, "tag1 %d ", ntohl (mp->tag1));
1968 s = format (s, "tag2 %d ", ntohl (mp->tag2));
1973 static void *vl_api_create_vhost_user_if_t_print
1974 (vl_api_create_vhost_user_if_t * mp, void *handle)
1978 s = format (0, "SCRIPT: create_vhost_user_if ");
1980 s = format (s, "socket %s ", mp->sock_filename);
1982 s = format (s, "server ");
1984 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1985 if (mp->disable_mrg_rxbuf)
1986 s = format (s, "disable_mrg_rxbuf ");
1987 if (mp->disable_indirect_desc)
1988 s = format (s, "disable_indirect_desc ");
1990 s = format (s, "tag %s", mp->tag);
1995 static void *vl_api_modify_vhost_user_if_t_print
1996 (vl_api_modify_vhost_user_if_t * mp, void *handle)
2000 s = format (0, "SCRIPT: modify_vhost_user_if ");
2002 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2003 s = format (s, "socket %s ", mp->sock_filename);
2005 s = format (s, "server ");
2007 s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
2012 static void *vl_api_delete_vhost_user_if_t_print
2013 (vl_api_delete_vhost_user_if_t * mp, void *handle)
2017 s = format (0, "SCRIPT: delete_vhost_user_if ");
2018 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2023 static void *vl_api_sw_interface_vhost_user_dump_t_print
2024 (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
2028 s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
2033 static void *vl_api_sw_interface_dump_t_print
2034 (vl_api_sw_interface_dump_t * mp, void *handle)
2038 s = format (0, "SCRIPT: sw_interface_dump ");
2040 if (mp->name_filter_valid)
2041 s = format (s, "name_filter %s ", mp->name_filter);
2043 s = format (s, "all ");
2048 static void *vl_api_l2_fib_table_dump_t_print
2049 (vl_api_l2_fib_table_dump_t * mp, void *handle)
2053 s = format (0, "SCRIPT: l2_fib_table_dump ");
2055 s = format (s, "bd_id %d ", ntohl (mp->bd_id));
2060 static void *vl_api_control_ping_t_print
2061 (vl_api_control_ping_t * mp, void *handle)
2065 s = format (0, "SCRIPT: control_ping ");
2070 static void *vl_api_want_interface_events_t_print
2071 (vl_api_want_interface_events_t * mp, void *handle)
2075 s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
2076 ntohl (mp->pid), ntohl (mp->enable_disable));
2082 vl_api_cli_t_print (vl_api_cli_t * mp, void *handle)
2086 s = format (0, "SCRIPT: cli ");
2091 static void *vl_api_cli_inband_t_print
2092 (vl_api_cli_inband_t * mp, void *handle)
2096 u32 length = ntohl (mp->length);
2098 vec_validate (cmd, length);
2099 clib_memcpy (cmd, mp->cmd, length);
2101 s = format (0, "SCRIPT: exec %v ", cmd);
2107 static void *vl_api_memclnt_create_t_print
2108 (vl_api_memclnt_create_t * mp, void *handle)
2112 s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
2117 static void *vl_api_sockclnt_create_t_print
2118 (vl_api_sockclnt_create_t * mp, void *handle)
2122 s = format (0, "SCRIPT: sockclnt_create name %s ", mp->name);
2127 static void *vl_api_show_version_t_print
2128 (vl_api_show_version_t * mp, void *handle)
2132 s = format (0, "SCRIPT: show_version ");
2137 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
2138 (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
2142 s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
2144 ip46_address_t local = to_ip46 (mp->is_ipv6, mp->local);
2145 ip46_address_t remote = to_ip46 (mp->is_ipv6, mp->remote);
2147 u8 is_grp = ip46_address_is_multicast (&remote);
2148 char *remote_name = is_grp ? "group" : "remote";
2150 s = format (s, "local %U ", format_ip46_address, &local, IP46_TYPE_ANY);
2151 s = format (s, "%s %U ", remote_name, format_ip46_address,
2152 &remote, IP46_TYPE_ANY);
2155 s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
2156 s = format (s, "protocol %d ", ntohl (mp->protocol));
2158 s = format (s, "vni %d ", ntohl (mp->vni));
2160 if (mp->is_add == 0)
2161 s = format (s, "del ");
2163 if (mp->encap_vrf_id)
2164 s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
2166 if (mp->decap_vrf_id)
2167 s = format (s, "decap-vrf-id %d ", ntohl (mp->decap_vrf_id));
2172 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
2173 (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
2177 s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
2179 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2184 static void *vl_api_interface_name_renumber_t_print
2185 (vl_api_interface_name_renumber_t * mp, void *handle)
2189 s = format (0, "SCRIPT: interface_renumber ");
2191 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2193 s = format (s, "new_show_dev_instance %d ",
2194 ntohl (mp->new_show_dev_instance));
2199 static void *vl_api_ip_probe_neighbor_t_print
2200 (vl_api_ip_probe_neighbor_t * mp, void *handle)
2204 s = format (0, "SCRIPT: ip_probe_neighbor ");
2205 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2207 s = format (s, "address %U ", format_ip6_address, &mp->dst_address);
2209 s = format (s, "address %U ", format_ip4_address, &mp->dst_address);
2214 static void *vl_api_ip_scan_neighbor_enable_disable_t_print
2215 (vl_api_ip_scan_neighbor_enable_disable_t * mp, void *handle)
2219 s = format (0, "SCRIPT: ip_scan_neighbor_enable_disable ");
2223 case IP_SCAN_V4_NEIGHBORS:
2224 s = format (s, "ip4 ");
2226 case IP_SCAN_V6_NEIGHBORS:
2227 s = format (s, "ip6 ");
2229 case IP_SCAN_V46_NEIGHBORS:
2230 s = format (s, "both ");
2233 s = format (s, "disable ");
2236 s = format (s, "interval %d ", mp->scan_interval);
2237 s = format (s, "max-time %d ", mp->max_proc_time);
2238 s = format (s, "max-update %d ", mp->max_update);
2239 s = format (s, "delay %d ", mp->scan_int_delay);
2240 s = format (s, "stale %d ", mp->stale_threshold);
2245 static void *vl_api_want_ip4_arp_events_t_print
2246 (vl_api_want_ip4_arp_events_t * mp, void *handle)
2250 s = format (0, "SCRIPT: want_ip4_arp_events ");
2251 s = format (s, "pid %d address %U ", ntohl (mp->pid),
2252 format_ip4_address, &mp->address);
2253 if (mp->enable_disable == 0)
2254 s = format (s, "del ");
2259 static void *vl_api_want_ip6_nd_events_t_print
2260 (vl_api_want_ip6_nd_events_t * mp, void *handle)
2264 s = format (0, "SCRIPT: want_ip6_nd_events ");
2265 s = format (s, "pid %d address %U ", ntohl (mp->pid),
2266 format_ip6_address, mp->address);
2267 if (mp->enable_disable == 0)
2268 s = format (s, "del ");
2273 static void *vl_api_want_l2_macs_events_t_print
2274 (vl_api_want_l2_macs_events_t * mp, void *handle)
2278 s = format (0, "SCRIPT: want_l2_macs_events ");
2279 s = format (s, "learn-limit %d ", ntohl (mp->learn_limit));
2280 s = format (s, "scan-delay %d ", (u32) mp->scan_delay);
2281 s = format (s, "max-entries %d ", (u32) mp->max_macs_in_event * 10);
2282 if (mp->enable_disable == 0)
2283 s = format (s, "disable");
2288 static void *vl_api_input_acl_set_interface_t_print
2289 (vl_api_input_acl_set_interface_t * mp, void *handle)
2293 s = format (0, "SCRIPT: input_acl_set_interface ");
2295 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2296 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2297 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2298 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2300 if (mp->is_add == 0)
2301 s = format (s, "del ");
2306 static void *vl_api_output_acl_set_interface_t_print
2307 (vl_api_output_acl_set_interface_t * mp, void *handle)
2311 s = format (0, "SCRIPT: output_acl_set_interface ");
2313 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2314 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2315 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2316 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2318 if (mp->is_add == 0)
2319 s = format (s, "del ");
2324 static void *vl_api_ip_address_dump_t_print
2325 (vl_api_ip_address_dump_t * mp, void *handle)
2329 s = format (0, "SCRIPT: ip6_address_dump ");
2330 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2331 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
2337 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
2341 s = format (0, "SCRIPT: ip_dump ");
2342 s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
2347 static void *vl_api_cop_interface_enable_disable_t_print
2348 (vl_api_cop_interface_enable_disable_t * mp, void *handle)
2352 s = format (0, "SCRIPT: cop_interface_enable_disable ");
2353 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2354 if (mp->enable_disable)
2355 s = format (s, "enable ");
2357 s = format (s, "disable ");
2362 static void *vl_api_cop_whitelist_enable_disable_t_print
2363 (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
2367 s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
2368 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2369 s = format (s, "fib-id %d ", ntohl (mp->fib_id));
2371 s = format (s, "ip4 ");
2373 s = format (s, "ip6 ");
2374 if (mp->default_cop)
2375 s = format (s, "default ");
2380 static void *vl_api_af_packet_create_t_print
2381 (vl_api_af_packet_create_t * mp, void *handle)
2385 s = format (0, "SCRIPT: af_packet_create ");
2386 s = format (s, "host_if_name %s ", mp->host_if_name);
2387 if (mp->use_random_hw_addr)
2388 s = format (s, "hw_addr random ");
2390 s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
2395 static void *vl_api_af_packet_delete_t_print
2396 (vl_api_af_packet_delete_t * mp, void *handle)
2400 s = format (0, "SCRIPT: af_packet_delete ");
2401 s = format (s, "host_if_name %s ", mp->host_if_name);
2406 static void *vl_api_af_packet_dump_t_print
2407 (vl_api_af_packet_dump_t * mp, void *handle)
2411 s = format (0, "SCRIPT: af_packet_dump ");
2417 format_policer_action (u8 * s, va_list * va)
2419 u32 action = va_arg (*va, u32);
2420 u32 dscp = va_arg (*va, u32);
2423 if (action == SSE2_QOS_ACTION_DROP)
2424 s = format (s, "drop");
2425 else if (action == SSE2_QOS_ACTION_TRANSMIT)
2426 s = format (s, "transmit");
2427 else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
2429 s = format (s, "mark-and-transmit ");
2432 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
2438 s = format (s, "%s", t);
2443 static void *vl_api_policer_add_del_t_print
2444 (vl_api_policer_add_del_t * mp, void *handle)
2448 s = format (0, "SCRIPT: policer_add_del ");
2449 s = format (s, "name %s ", mp->name);
2450 s = format (s, "cir %d ", mp->cir);
2451 s = format (s, "eir %d ", mp->eir);
2452 s = format (s, "cb %d ", mp->cb);
2453 s = format (s, "eb %d ", mp->eb);
2455 switch (mp->rate_type)
2457 case SSE2_QOS_RATE_KBPS:
2458 s = format (s, "rate_type kbps ");
2460 case SSE2_QOS_RATE_PPS:
2461 s = format (s, "rate_type pps ");
2467 switch (mp->round_type)
2469 case SSE2_QOS_ROUND_TO_CLOSEST:
2470 s = format (s, "round_type closest ");
2472 case SSE2_QOS_ROUND_TO_UP:
2473 s = format (s, "round_type up ");
2475 case SSE2_QOS_ROUND_TO_DOWN:
2476 s = format (s, "round_type down ");
2484 case SSE2_QOS_POLICER_TYPE_1R2C:
2485 s = format (s, "type 1r2c ");
2487 case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
2488 s = format (s, "type 1r3c ");
2490 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
2491 s = format (s, "type 2r3c-2698 ");
2493 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
2494 s = format (s, "type 2r3c-4115 ");
2496 case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
2497 s = format (s, "type 2r3c-mef5cf1 ");
2503 s = format (s, "conform_action %U ", format_policer_action,
2504 mp->conform_action_type, mp->conform_dscp);
2505 s = format (s, "exceed_action %U ", format_policer_action,
2506 mp->exceed_action_type, mp->exceed_dscp);
2507 s = format (s, "violate_action %U ", format_policer_action,
2508 mp->violate_action_type, mp->violate_dscp);
2510 if (mp->color_aware)
2511 s = format (s, "color-aware ");
2512 if (mp->is_add == 0)
2513 s = format (s, "del ");
2518 static void *vl_api_policer_dump_t_print
2519 (vl_api_policer_dump_t * mp, void *handle)
2523 s = format (0, "SCRIPT: policer_dump ");
2524 if (mp->match_name_valid)
2525 s = format (s, "name %s ", mp->match_name);
2530 static void *vl_api_policer_classify_set_interface_t_print
2531 (vl_api_policer_classify_set_interface_t * mp, void *handle)
2535 s = format (0, "SCRIPT: policer_classify_set_interface ");
2536 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2537 if (mp->ip4_table_index != ~0)
2538 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2539 if (mp->ip6_table_index != ~0)
2540 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2541 if (mp->l2_table_index != ~0)
2542 s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2543 if (mp->is_add == 0)
2544 s = format (s, "del ");
2549 static void *vl_api_policer_classify_dump_t_print
2550 (vl_api_policer_classify_dump_t * mp, void *handle)
2554 s = format (0, "SCRIPT: policer_classify_dump ");
2557 case POLICER_CLASSIFY_TABLE_IP4:
2558 s = format (s, "type ip4 ");
2560 case POLICER_CLASSIFY_TABLE_IP6:
2561 s = format (s, "type ip6 ");
2563 case POLICER_CLASSIFY_TABLE_L2:
2564 s = format (s, "type l2 ");
2573 static void *vl_api_sw_interface_clear_stats_t_print
2574 (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2578 s = format (0, "SCRIPT: sw_interface_clear_stats ");
2579 if (mp->sw_if_index != ~0)
2580 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2585 static void *vl_api_mpls_tunnel_dump_t_print
2586 (vl_api_mpls_tunnel_dump_t * mp, void *handle)
2590 s = format (0, "SCRIPT: mpls_tunnel_dump ");
2592 s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
2597 static void *vl_api_mpls_fib_dump_t_print
2598 (vl_api_mpls_fib_dump_t * mp, void *handle)
2602 s = format (0, "SCRIPT: mpls_fib_decap_dump ");
2607 static void *vl_api_ip_fib_dump_t_print
2608 (vl_api_ip_fib_dump_t * mp, void *handle)
2612 s = format (0, "SCRIPT: ip_fib_dump ");
2617 static void *vl_api_ip6_fib_dump_t_print
2618 (vl_api_ip6_fib_dump_t * mp, void *handle)
2622 s = format (0, "SCRIPT: ip6_fib_dump ");
2627 static void *vl_api_classify_table_ids_t_print
2628 (vl_api_classify_table_ids_t * mp, void *handle)
2632 s = format (0, "SCRIPT: classify_table_ids ");
2637 static void *vl_api_classify_table_by_interface_t_print
2638 (vl_api_classify_table_by_interface_t * mp, void *handle)
2642 s = format (0, "SCRIPT: classify_table_by_interface ");
2643 if (mp->sw_if_index != ~0)
2644 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2649 static void *vl_api_classify_table_info_t_print
2650 (vl_api_classify_table_info_t * mp, void *handle)
2654 s = format (0, "SCRIPT: classify_table_info ");
2655 if (mp->table_id != ~0)
2656 s = format (s, "table_id %d ", ntohl (mp->table_id));
2661 static void *vl_api_classify_session_dump_t_print
2662 (vl_api_classify_session_dump_t * mp, void *handle)
2666 s = format (0, "SCRIPT: classify_session_dump ");
2667 if (mp->table_id != ~0)
2668 s = format (s, "table_id %d ", ntohl (mp->table_id));
2673 static void *vl_api_set_ipfix_exporter_t_print
2674 (vl_api_set_ipfix_exporter_t * mp, void *handle)
2678 s = format (0, "SCRIPT: set_ipfix_exporter ");
2680 s = format (s, "collector-address %U ", format_ip4_address,
2681 (ip4_address_t *) mp->collector_address);
2682 s = format (s, "collector-port %d ", ntohs (mp->collector_port));
2683 s = format (s, "src-address %U ", format_ip4_address,
2684 (ip4_address_t *) mp->src_address);
2685 s = format (s, "vrf-id %d ", ntohl (mp->vrf_id));
2686 s = format (s, "path-mtu %d ", ntohl (mp->path_mtu));
2687 s = format (s, "template-interval %d ", ntohl (mp->template_interval));
2688 s = format (s, "udp-checksum %d ", mp->udp_checksum);
2693 static void *vl_api_ipfix_exporter_dump_t_print
2694 (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2698 s = format (0, "SCRIPT: ipfix_exporter_dump ");
2703 static void *vl_api_set_ipfix_classify_stream_t_print
2704 (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2708 s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2710 s = format (s, "domain-id %d ", ntohl (mp->domain_id));
2711 s = format (s, "src-port %d ", ntohs (mp->src_port));
2716 static void *vl_api_ipfix_classify_stream_dump_t_print
2717 (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2721 s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2726 static void *vl_api_ipfix_classify_table_add_del_t_print
2727 (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2731 s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2733 s = format (s, "table-id %d ", ntohl (mp->table_id));
2734 s = format (s, "ip-version %d ", mp->ip_version);
2735 s = format (s, "transport-protocol %d ", mp->transport_protocol);
2740 static void *vl_api_ipfix_classify_table_dump_t_print
2741 (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2745 s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2750 static void *vl_api_sw_interface_span_enable_disable_t_print
2751 (vl_api_sw_interface_span_enable_disable_t * mp, void *handle)
2755 s = format (0, "SCRIPT: sw_interface_span_enable_disable ");
2756 s = format (s, "src_sw_if_index %u ", ntohl (mp->sw_if_index_from));
2757 s = format (s, "dst_sw_if_index %u ", ntohl (mp->sw_if_index_to));
2760 s = format (s, "l2 ");
2765 s = format (s, "disable ");
2768 s = format (s, "rx ");
2771 s = format (s, "tx ");
2775 s = format (s, "both ");
2783 vl_api_sw_interface_span_dump_t_print (vl_api_sw_interface_span_dump_t * mp,
2788 s = format (0, "SCRIPT: sw_interface_span_dump ");
2791 s = format (s, "l2 ");
2796 static void *vl_api_get_next_index_t_print
2797 (vl_api_get_next_index_t * mp, void *handle)
2801 s = format (0, "SCRIPT: get_next_index ");
2802 s = format (s, "node-name %s ", mp->node_name);
2803 s = format (s, "next-node-name %s ", mp->next_name);
2808 static void *vl_api_pg_create_interface_t_print
2809 (vl_api_pg_create_interface_t * mp, void *handle)
2813 s = format (0, "SCRIPT: pg_create_interface ");
2814 s = format (0, "if_id %d", ntohl (mp->interface_id));
2819 static void *vl_api_pg_capture_t_print
2820 (vl_api_pg_capture_t * mp, void *handle)
2824 s = format (0, "SCRIPT: pg_capture ");
2825 s = format (0, "if_id %d ", ntohl (mp->interface_id));
2826 s = format (0, "pcap %s", mp->pcap_file_name);
2827 if (mp->count != ~0)
2828 s = format (s, "count %d ", ntohl (mp->count));
2829 if (!mp->is_enabled)
2830 s = format (s, "disable");
2835 static void *vl_api_pg_enable_disable_t_print
2836 (vl_api_pg_enable_disable_t * mp, void *handle)
2840 s = format (0, "SCRIPT: pg_enable_disable ");
2841 if (ntohl (mp->stream_name_length) > 0)
2842 s = format (s, "stream %s", mp->stream_name);
2843 if (!mp->is_enabled)
2844 s = format (s, "disable");
2849 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2850 (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2855 s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2857 s = format (s, "%U/%d ", format_ip6_address, mp->address,
2860 s = format (s, "%U/%d ", format_ip4_address, mp->address,
2863 for (i = 0; i < mp->number_of_ranges; i++)
2865 s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2868 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
2870 if (mp->is_add == 0)
2871 s = format (s, "del ");
2876 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2877 (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2882 s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2884 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2886 if (mp->tcp_out_vrf_id != ~0)
2887 s = format (s, "tcp-out-vrf %d ", ntohl (mp->tcp_out_vrf_id));
2889 if (mp->udp_out_vrf_id != ~0)
2890 s = format (s, "udp-out-vrf %d ", ntohl (mp->udp_out_vrf_id));
2892 if (mp->tcp_in_vrf_id != ~0)
2893 s = format (s, "tcp-in-vrf %d ", ntohl (mp->tcp_in_vrf_id));
2895 if (mp->udp_in_vrf_id != ~0)
2896 s = format (s, "udp-in-vrf %d ", ntohl (mp->udp_in_vrf_id));
2898 if (mp->is_add == 0)
2899 s = format (s, "del ");
2904 static void *vl_api_lisp_enable_disable_t_print
2905 (vl_api_lisp_enable_disable_t * mp, void *handle)
2909 s = format (0, "SCRIPT: lisp_enable_disable %s",
2910 mp->is_en ? "enable" : "disable");
2915 static void *vl_api_gpe_add_del_iface_t_print
2916 (vl_api_gpe_add_del_iface_t * mp, void *handle)
2920 s = format (0, "SCRIPT: gpe_add_del_iface ");
2922 s = format (s, "%s ", mp->is_add ? "up" : "down");
2923 s = format (s, "vni %d ", mp->vni);
2924 s = format (s, "%s %d ", mp->is_l2 ? "bd_id" : "table_id", mp->dp_table);
2929 static void *vl_api_lisp_pitr_set_locator_set_t_print
2930 (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
2934 s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
2937 s = format (s, "locator-set %s ", mp->ls_name);
2939 s = format (s, "del");
2945 format_lisp_flat_eid (u8 * s, va_list * args)
2947 u32 type = va_arg (*args, u32);
2948 u8 *eid = va_arg (*args, u8 *);
2949 u32 eid_len = va_arg (*args, u32);
2954 return format (s, "%U/%d", format_ip4_address, eid, eid_len);
2956 return format (s, "%U/%d", format_ip6_address, eid, eid_len);
2958 return format (s, "%U", format_ethernet_address, eid);
2963 static void *vl_api_lisp_add_del_remote_mapping_t_print
2964 (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
2969 s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
2972 s = format (s, "del-all ");
2974 s = format (s, "%s ", mp->is_add ? "add" : "del");
2975 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2977 s = format (s, "eid %U ", format_lisp_flat_eid,
2978 mp->eid_type, mp->eid, mp->eid_len);
2982 s = format (s, "seid %U ", format_lisp_flat_eid,
2983 mp->eid_type, mp->seid, mp->seid_len);
2985 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
2988 s = format (s, "action %d", mp->action);
2993 static void *vl_api_lisp_add_del_adjacency_t_print
2994 (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
2998 s = format (0, "SCRIPT: lisp_add_del_adjacency ");
3000 s = format (s, "%s ", mp->is_add ? "add" : "del");
3001 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
3002 s = format (s, "reid %U leid %U ",
3003 format_lisp_flat_eid, mp->eid_type, mp->reid, mp->reid_len,
3004 format_lisp_flat_eid, mp->eid_type, mp->leid, mp->leid_len);
3009 static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
3010 (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
3014 s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
3017 s = format (s, "%s", mp->locator_set_name);
3019 s = format (s, "del");
3024 static void *vl_api_lisp_eid_table_add_del_map_t_print
3025 (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
3029 s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
3032 s = format (s, "del ");
3034 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
3035 s = format (s, "%s %d ",
3036 mp->is_l2 ? "bd_index" : "vrf",
3037 clib_net_to_host_u32 (mp->dp_table));
3041 static void *vl_api_lisp_add_del_local_eid_t_print
3042 (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
3046 s = format (0, "SCRIPT: lisp_add_del_local_eid ");
3049 s = format (s, "del ");
3051 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
3052 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
3054 s = format (s, "locator-set %s ", mp->locator_set_name);
3057 u32 key_id = mp->key_id;
3058 s = format (s, "key-id %U", format_hmac_key_id, key_id);
3059 s = format (s, "secret-key %s", mp->key);
3064 static void *vl_api_gpe_add_del_fwd_entry_t_print
3065 (vl_api_gpe_add_del_fwd_entry_t * mp, void *handle)
3069 s = format (0, "SCRIPT: gpe_add_del_fwd_entry TODO");
3074 static void *vl_api_lisp_add_del_map_resolver_t_print
3075 (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
3079 s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
3082 s = format (s, "del ");
3085 s = format (s, "%U ", format_ip6_address, mp->ip_address);
3087 s = format (s, "%U ", format_ip4_address, mp->ip_address);
3092 static void *vl_api_gpe_enable_disable_t_print
3093 (vl_api_gpe_enable_disable_t * mp, void *handle)
3097 s = format (0, "SCRIPT: gpe_enable_disable ");
3099 s = format (s, "%s ", mp->is_en ? "enable" : "disable");
3104 static void *vl_api_lisp_add_del_locator_set_t_print
3105 (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
3109 s = format (0, "SCRIPT: lisp_add_del_locator_set ");
3112 s = format (s, "del ");
3114 s = format (s, "locator-set %s ", mp->locator_set_name);
3119 static void *vl_api_lisp_add_del_locator_t_print
3120 (vl_api_lisp_add_del_locator_t * mp, void *handle)
3124 s = format (0, "SCRIPT: lisp_add_del_locator ");
3127 s = format (s, "del ");
3129 s = format (s, "locator-set %s ", mp->locator_set_name);
3130 s = format (s, "sw_if_index %d ", mp->sw_if_index);
3131 s = format (s, "p %d w %d ", mp->priority, mp->weight);
3136 static void *vl_api_lisp_locator_set_dump_t_print
3137 (vl_api_lisp_locator_set_dump_t * mp, void *handle)
3141 s = format (0, "SCRIPT: lisp_locator_set_dump ");
3142 if (mp->filter == 1)
3143 s = format (s, "local");
3144 else if (mp->filter == 2)
3145 s = format (s, "remote");
3150 static void *vl_api_lisp_locator_dump_t_print
3151 (vl_api_lisp_locator_dump_t * mp, void *handle)
3155 s = format (0, "SCRIPT: lisp_locator_dump ");
3156 if (mp->is_index_set)
3157 s = format (s, "ls_index %d", clib_net_to_host_u32 (mp->ls_index));
3159 s = format (s, "ls_name %s", mp->ls_name);
3164 static void *vl_api_lisp_map_request_mode_t_print
3165 (vl_api_lisp_map_request_mode_t * mp, void *handle)
3169 s = format (0, "SCRIPT: lisp_map_request_mode ");
3174 s = format (s, "dst-only");
3177 s = format (s, "src-dst");
3185 static void *vl_api_lisp_eid_table_dump_t_print
3186 (vl_api_lisp_eid_table_dump_t * mp, void *handle)
3190 s = format (0, "SCRIPT: lisp_eid_table_dump ");
3194 s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
3195 s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
3196 mp->eid, mp->prefix_length);
3200 s = format (s, "local ");
3203 s = format (s, "remote ");
3210 static void *vl_api_lisp_rloc_probe_enable_disable_t_print
3211 (vl_api_lisp_rloc_probe_enable_disable_t * mp, void *handle)
3215 s = format (0, "SCRIPT: lisp_rloc_probe_enable_disable ");
3217 s = format (s, "enable");
3219 s = format (s, "disable");
3224 static void *vl_api_lisp_map_register_enable_disable_t_print
3225 (vl_api_lisp_map_register_enable_disable_t * mp, void *handle)
3229 s = format (0, "SCRIPT: lisp_map_register_enable_disable ");
3231 s = format (s, "enable");
3233 s = format (s, "disable");
3238 static void *vl_api_lisp_adjacencies_get_t_print
3239 (vl_api_lisp_adjacencies_get_t * mp, void *handle)
3243 s = format (0, "SCRIPT: lisp_adjacencies_get ");
3244 s = format (s, "vni %d", clib_net_to_host_u32 (mp->vni));
3249 static void *vl_api_lisp_eid_table_map_dump_t_print
3250 (vl_api_lisp_eid_table_map_dump_t * mp, void *handle)
3254 s = format (0, "SCRIPT: lisp_eid_table_map_dump ");
3257 s = format (s, "l2");
3259 s = format (s, "l3");
3264 static void *vl_api_ipsec_gre_add_del_tunnel_t_print
3265 (vl_api_ipsec_gre_add_del_tunnel_t * mp, void *handle)
3269 s = format (0, "SCRIPT: ipsec_gre_add_del_tunnel ");
3271 s = format (s, "dst %U ", format_ip4_address,
3272 (ip4_address_t *) & (mp->dst_address));
3274 s = format (s, "src %U ", format_ip4_address,
3275 (ip4_address_t *) & (mp->src_address));
3277 s = format (s, "local_sa %d ", ntohl (mp->local_sa_id));
3279 s = format (s, "remote_sa %d ", ntohl (mp->remote_sa_id));
3281 if (mp->is_add == 0)
3282 s = format (s, "del ");
3287 static void *vl_api_ipsec_gre_tunnel_dump_t_print
3288 (vl_api_ipsec_gre_tunnel_dump_t * mp, void *handle)
3292 s = format (0, "SCRIPT: ipsec_gre_tunnel_dump ");
3294 if (mp->sw_if_index != ~0)
3295 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3300 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
3301 (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
3304 u32 vtr_op = ntohl (mp->vtr_op);
3306 s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
3308 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3309 s = format (s, "vtr_op %d ", vtr_op);
3310 if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
3312 if (vtr_op == L2_VTR_TRANSLATE_2_2)
3313 s = format (s, "%d ", ntohs (mp->outer_tag));
3314 s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
3315 s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
3316 s = format (s, "sid %d ", ntohl (mp->i_sid));
3317 s = format (s, "vlanid %d ", ntohs (mp->b_vlanid));
3322 static void *vl_api_flow_classify_set_interface_t_print
3323 (vl_api_flow_classify_set_interface_t * mp, void *handle)
3327 s = format (0, "SCRIPT: flow_classify_set_interface ");
3328 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3329 if (mp->ip4_table_index != ~0)
3330 s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
3331 if (mp->ip6_table_index != ~0)
3332 s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
3333 if (mp->is_add == 0)
3334 s = format (s, "del ");
3340 vl_api_punt_t_print (vl_api_punt_t * mp, void *handle)
3344 s = format (0, "SCRIPT: punt ");
3346 if (mp->ipv != (u8) ~ 0)
3347 s = format (s, "ip %d ", mp->ipv);
3349 s = format (s, "protocol %d ", mp->l4_protocol);
3351 if (mp->l4_port != (u16) ~ 0)
3352 s = format (s, "port %d ", ntohs (mp->l4_port));
3355 s = format (s, "del ");
3360 static void *vl_api_flow_classify_dump_t_print
3361 (vl_api_flow_classify_dump_t * mp, void *handle)
3365 s = format (0, "SCRIPT: flow_classify_dump ");
3368 case FLOW_CLASSIFY_TABLE_IP4:
3369 s = format (s, "type ip4 ");
3371 case FLOW_CLASSIFY_TABLE_IP6:
3372 s = format (s, "type ip6 ");
3381 static void *vl_api_get_first_msg_id_t_print
3382 (vl_api_get_first_msg_id_t * mp, void *handle)
3386 s = format (0, "SCRIPT: get_first_msg_id %s ", mp->name);
3391 static void *vl_api_ioam_enable_t_print
3392 (vl_api_ioam_enable_t * mp, void *handle)
3396 s = format (0, "SCRIPT: ioam_enable ");
3398 if (mp->trace_enable)
3399 s = format (s, "trace enabled");
3402 s = format (s, "POT enabled");
3405 s = format (s, "Seqno enabled");
3408 s = format (s, "Analyse enabled");
3413 static void *vl_api_ioam_disable_t_print
3414 (vl_api_ioam_disable_t * mp, void *handle)
3418 s = format (0, "SCRIPT: ioam_disable ");
3419 s = format (s, "trace disabled");
3420 s = format (s, "POT disabled");
3421 s = format (s, "Seqno disabled");
3422 s = format (s, "Analyse disabled");
3427 static void *vl_api_feature_enable_disable_t_print
3428 (vl_api_feature_enable_disable_t * mp, void *handle)
3432 s = format (0, "SCRIPT: feature_enable_disable ");
3433 s = format (s, "arc_name %s ", mp->arc_name);
3434 s = format (s, "feature_name %s ", mp->feature_name);
3435 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3437 s = format (s, "disable");
3442 static void *vl_api_sw_interface_tag_add_del_t_print
3443 (vl_api_sw_interface_tag_add_del_t * mp, void *handle)
3447 s = format (0, "SCRIPT: sw_interface_tag_add_del ");
3448 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3450 s = format (s, "tag %s ", mp->tag);
3452 s = format (s, "del ");
3457 static void *vl_api_hw_interface_set_mtu_t_print
3458 (vl_api_hw_interface_set_mtu_t * mp, void *handle)
3462 s = format (0, "SCRIPT: sw_interface_set_mtu ");
3463 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3464 s = format (s, "tag %d ", ntohs (mp->mtu));
3469 static void *vl_api_p2p_ethernet_add_t_print
3470 (vl_api_p2p_ethernet_add_t * mp, void *handle)
3474 s = format (0, "SCRIPT: p2p_ethernet_add ");
3475 s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
3476 s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
3481 static void *vl_api_p2p_ethernet_del_t_print
3482 (vl_api_p2p_ethernet_del_t * mp, void *handle)
3486 s = format (0, "SCRIPT: p2p_ethernet_del ");
3487 s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
3488 s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
3493 static void *vl_api_tcp_configure_src_addresses_t_print
3494 (vl_api_tcp_configure_src_addresses_t * mp, void *handle)
3498 s = format (0, "SCRIPT: tcp_configure_src_addresses ");
3500 s = format (s, "%U - %U ",
3501 format_ip6_address, (ip6_address_t *) mp->first_address,
3502 format_ip6_address, (ip6_address_t *) mp->last_address);
3504 s = format (s, "%U - %U ",
3505 format_ip4_address, (ip4_address_t *) mp->first_address,
3506 format_ip4_address, (ip4_address_t *) mp->last_address);
3509 s = format (s, "vrf %d ", ntohl (mp->vrf_id));
3514 static void *vl_api_app_namespace_add_del_t_print
3515 (vl_api_app_namespace_add_del_t * mp, void *handle)
3518 u8 len = clib_min (mp->namespace_id_len,
3519 ARRAY_LEN (mp->namespace_id) - 1);
3520 mp->namespace_id[len] = 0;
3521 s = format (0, "SCRIPT: app_namespace_add_del ");
3522 s = format (s, "ns-id %s secret %lu sw_if_index %d ipv4_fib_id %d "
3523 "ipv6_fib_id %d", (char *) mp->namespace_id, mp->secret,
3524 clib_net_to_host_u32 (mp->sw_if_index),
3525 clib_net_to_host_u32 (mp->ip4_fib_id),
3526 clib_net_to_host_u32 (mp->ip6_fib_id));
3530 static void *vl_api_lldp_config_t_print
3531 (vl_api_lldp_config_t * mp, void *handle)
3535 s = format (0, "SCRIPT: lldp_config ");
3536 s = format (s, "system_name %s ", mp->system_name);
3537 s = format (s, "tx_hold %d ", ntohl (mp->tx_hold));
3538 s = format (s, "tx_interval %d ", ntohl (mp->tx_interval));
3542 static void *vl_api_dns_enable_disable_t_print
3543 (vl_api_dns_enable_disable_t * mp, void *handle)
3547 s = format (0, "SCRIPT: dns_enable_disable ");
3548 s = format (s, "%s ", mp->enable ? "enable" : "disable");
3553 static void *vl_api_sw_interface_set_lldp_t_print
3554 (vl_api_sw_interface_set_lldp_t * mp, void *handle)
3559 memset (null_data, 0, sizeof (null_data));
3561 s = format (0, "SCRIPT: sw_interface_set_lldp ");
3562 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3564 if (memcmp (mp->port_desc, null_data, sizeof (mp->port_desc)))
3565 s = format (s, "port_desc %s ", mp->port_desc);
3567 if (memcmp (mp->mgmt_ip4, null_data, sizeof (mp->mgmt_ip4)))
3568 s = format (s, "mgmt_ip4 %U ", format_ip4_address, mp->mgmt_ip4);
3570 if (memcmp (mp->mgmt_ip6, null_data, sizeof (mp->mgmt_ip6)))
3571 s = format (s, "mgmt_ip6 %U ", format_ip6_address, mp->mgmt_ip6);
3573 if (memcmp (mp->mgmt_oid, null_data, sizeof (mp->mgmt_oid)))
3574 s = format (s, "mgmt_oid %s ", mp->mgmt_oid);
3576 if (mp->enable == 0)
3577 s = format (s, "disable ");
3582 static void *vl_api_dns_name_server_add_del_t_print
3583 (vl_api_dns_name_server_add_del_t * mp, void *handle)
3587 s = format (0, "SCRIPT: dns_name_server_add_del ");
3589 s = format (s, "%U ", format_ip6_address,
3590 (ip6_address_t *) mp->server_address);
3592 s = format (s, "%U ", format_ip4_address,
3593 (ip4_address_t *) mp->server_address);
3595 if (mp->is_add == 0)
3596 s = format (s, "del ");
3601 static void *vl_api_dns_resolve_name_t_print
3602 (vl_api_dns_resolve_name_t * mp, void *handle)
3606 s = format (0, "SCRIPT: dns_resolve_name ");
3607 s = format (s, "%s ", mp->name);
3611 static void *vl_api_dns_resolve_ip_t_print
3612 (vl_api_dns_resolve_ip_t * mp, void *handle)
3616 s = format (0, "SCRIPT: dns_resolve_ip ");
3618 s = format (s, "%U ", format_ip6_address, mp->address);
3620 s = format (s, "%U ", format_ip4_address, mp->address);
3624 static void *vl_api_session_rule_add_del_t_print
3625 (vl_api_session_rule_add_del_t * mp, void *handle)
3628 char *proto = mp->transport_proto == 0 ? "tcp" : "udp";
3629 s = format (0, "SCRIPT: session_rule_add_del ");
3630 mp->tag[sizeof (mp->tag) - 1] = 0;
3632 s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s",
3633 mp->appns_index, mp->scope, proto, format_ip4_address,
3634 (ip4_address_t *) mp->lcl_ip, mp->lcl_plen,
3635 format_ip4_address, (ip4_address_t *) mp->rmt_ip,
3636 mp->rmt_plen, mp->action_index, mp->tag);
3638 s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s",
3639 mp->appns_index, mp->scope, proto, format_ip6_address,
3640 (ip6_address_t *) mp->lcl_ip, mp->lcl_plen,
3641 format_ip6_address, (ip6_address_t *) mp->rmt_ip,
3642 mp->rmt_plen, mp->action_index, mp->tag);
3646 static void *vl_api_ip_container_proxy_add_del_t_print
3647 (vl_api_ip_container_proxy_add_del_t * mp, void *handle)
3650 s = format (0, "SCRIPT: ip_container_proxy_add_del ");
3652 s = format (s, "is_add %d address %U/%d sw_if_index %d",
3653 mp->is_add, format_ip4_address,
3654 (ip4_address_t *) mp->ip, mp->plen, mp->sw_if_index);
3656 s = format (s, "is_add %d address %U/%d sw_if_index %d",
3657 mp->is_add, format_ip6_address,
3658 (ip6_address_t *) mp->ip, mp->plen, mp->sw_if_index);
3662 static void *vl_api_qos_record_enable_disable_t_print
3663 (vl_api_qos_record_enable_disable_t * mp, void *handle)
3667 s = format (0, "SCRIPT: qos_record_enable_disable ");
3668 s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3670 format (s, "input_source %U ", format_qos_source,
3671 ntohl (mp->input_source));
3674 s = format (s, "disable ");
3679 #define foreach_custom_print_no_arg_function \
3680 _(lisp_eid_table_vni_dump) \
3681 _(lisp_map_resolver_dump) \
3682 _(lisp_map_server_dump) \
3683 _(show_lisp_rloc_probe_state) \
3684 _(show_lisp_map_register_state) \
3685 _(show_lisp_map_request_mode)
3688 static void * vl_api_ ## f ## _t_print \
3689 (vl_api_ ## f ## _t * mp, void * handle) \
3692 s = format (0, "SCRIPT: " #f ); \
3695 foreach_custom_print_no_arg_function
3697 #define foreach_custom_print_function \
3698 _(CREATE_LOOPBACK, create_loopback) \
3699 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \
3700 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
3701 _(SW_INTERFACE_EVENT, sw_interface_event) \
3702 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \
3703 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \
3704 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable) \
3705 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath) \
3706 _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass) \
3707 _(SW_INTERFACE_SET_GENEVE_BYPASS, sw_interface_set_geneve_bypass) \
3708 _(TAP_CONNECT, tap_connect) \
3709 _(TAP_MODIFY, tap_modify) \
3710 _(TAP_DELETE, tap_delete) \
3711 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \
3712 _(BOND_CREATE, bond_create) \
3713 _(BOND_DELETE, bond_delete) \
3714 _(BOND_ENSLAVE, bond_enslave) \
3715 _(BOND_DETACH_SLAVE, bond_detach_slave) \
3716 _(TAP_CREATE_V2, tap_create_v2) \
3717 _(TAP_DELETE_V2, tap_delete_v2) \
3718 _(SW_INTERFACE_TAP_V2_DUMP, sw_interface_tap_v2_dump) \
3719 _(IP_ADD_DEL_ROUTE, ip_add_del_route) \
3720 _(IP_TABLE_ADD_DEL, ip_table_add_del) \
3721 _(MPLS_ROUTE_ADD_DEL, mpls_route_add_del) \
3722 _(MPLS_TABLE_ADD_DEL, mpls_table_add_del) \
3723 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
3724 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
3725 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \
3726 _(SR_MPLS_POLICY_ADD, sr_mpls_policy_add) \
3727 _(SR_MPLS_POLICY_DEL, sr_mpls_policy_del) \
3728 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered) \
3729 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \
3730 _(CREATE_VLAN_SUBIF, create_vlan_subif) \
3731 _(CREATE_SUBIF, create_subif) \
3732 _(OAM_ADD_DEL, oam_add_del) \
3733 _(RESET_FIB, reset_fib) \
3734 _(DHCP_PROXY_CONFIG, dhcp_proxy_config) \
3735 _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss) \
3736 _(SET_IP_FLOW_HASH, set_ip_flow_hash) \
3737 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS, \
3738 sw_interface_ip6_set_link_local_address) \
3739 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix) \
3740 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config) \
3741 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit) \
3742 _(L2_PATCH_ADD_DEL, l2_patch_add_del) \
3743 _(SR_LOCALSID_ADD_DEL, sr_localsid_add_del) \
3744 _(SR_STEERING_ADD_DEL, sr_steering_add_del) \
3745 _(SR_POLICY_ADD, sr_policy_add) \
3746 _(SR_POLICY_MOD, sr_policy_mod) \
3747 _(SR_POLICY_DEL, sr_policy_del) \
3748 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect) \
3749 _(L2FIB_ADD_DEL, l2fib_add_del) \
3750 _(L2FIB_FLUSH_ALL, l2fib_flush_all) \
3751 _(L2FIB_FLUSH_BD, l2fib_flush_bd) \
3752 _(L2FIB_FLUSH_INT, l2fib_flush_int) \
3753 _(L2_FLAGS, l2_flags) \
3754 _(BRIDGE_FLAGS, bridge_flags) \
3755 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table) \
3756 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session) \
3757 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge) \
3758 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del) \
3759 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump) \
3760 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age) \
3761 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table) \
3762 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables) \
3763 _(ADD_NODE_NEXT, add_node_next) \
3764 _(DHCP_CLIENT_CONFIG, dhcp_client_config) \
3765 _(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel) \
3766 _(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies) \
3767 _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable) \
3768 _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key) \
3769 _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump) \
3770 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel) \
3771 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump) \
3772 _(VXLAN_OFFLOAD_RX, vxlan_offload_rx) \
3773 _(GENEVE_ADD_DEL_TUNNEL, geneve_add_del_tunnel) \
3774 _(GENEVE_TUNNEL_DUMP, geneve_tunnel_dump) \
3775 _(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel) \
3776 _(GRE_TUNNEL_DUMP, gre_tunnel_dump) \
3777 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table) \
3778 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter) \
3779 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite) \
3780 _(CREATE_VHOST_USER_IF, create_vhost_user_if) \
3781 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if) \
3782 _(DELETE_VHOST_USER_IF, delete_vhost_user_if) \
3783 _(SW_INTERFACE_DUMP, sw_interface_dump) \
3784 _(CONTROL_PING, control_ping) \
3785 _(WANT_INTERFACE_EVENTS, want_interface_events) \
3787 _(CLI_INBAND, cli_inband) \
3788 _(MEMCLNT_CREATE, memclnt_create) \
3789 _(SOCKCLNT_CREATE, sockclnt_create) \
3790 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump) \
3791 _(SHOW_VERSION, show_version) \
3792 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump) \
3793 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel) \
3794 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump) \
3795 _(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
3796 _(IP_PROBE_NEIGHBOR, ip_probe_neighbor) \
3797 _(IP_SCAN_NEIGHBOR_ENABLE_DISABLE, ip_scan_neighbor_enable_disable) \
3798 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
3799 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events) \
3800 _(WANT_L2_MACS_EVENTS, want_l2_macs_events) \
3801 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface) \
3802 _(IP_ADDRESS_DUMP, ip_address_dump) \
3803 _(IP_DUMP, ip_dump) \
3804 _(DELETE_LOOPBACK, delete_loopback) \
3805 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \
3806 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \
3807 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \
3808 _(AF_PACKET_CREATE, af_packet_create) \
3809 _(AF_PACKET_DELETE, af_packet_delete) \
3810 _(AF_PACKET_DUMP, af_packet_dump) \
3811 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) \
3812 _(MPLS_FIB_DUMP, mpls_fib_dump) \
3813 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump) \
3814 _(CLASSIFY_TABLE_IDS,classify_table_ids) \
3815 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface) \
3816 _(CLASSIFY_TABLE_INFO,classify_table_info) \
3817 _(CLASSIFY_SESSION_DUMP,classify_session_dump) \
3818 _(SET_IPFIX_EXPORTER, set_ipfix_exporter) \
3819 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump) \
3820 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream) \
3821 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump) \
3822 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del) \
3823 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump) \
3824 _(SW_INTERFACE_SPAN_ENABLE_DISABLE, sw_interface_span_enable_disable) \
3825 _(SW_INTERFACE_SPAN_DUMP, sw_interface_span_dump) \
3826 _(GET_NEXT_INDEX, get_next_index) \
3827 _(PG_CREATE_INTERFACE,pg_create_interface) \
3828 _(PG_CAPTURE, pg_capture) \
3829 _(PG_ENABLE_DISABLE, pg_enable_disable) \
3830 _(POLICER_ADD_DEL, policer_add_del) \
3831 _(POLICER_DUMP, policer_dump) \
3832 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface) \
3833 _(POLICER_CLASSIFY_DUMP, policer_classify_dump) \
3834 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \
3835 ip_source_and_port_range_check_add_del) \
3836 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \
3837 ip_source_and_port_range_check_interface_add_del) \
3838 _(LISP_ENABLE_DISABLE, lisp_enable_disable) \
3839 _(GPE_ENABLE_DISABLE, gpe_enable_disable) \
3840 _(GPE_ADD_DEL_IFACE, gpe_add_del_iface) \
3841 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
3842 _(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
3843 _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
3844 _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
3845 _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
3846 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
3847 lisp_add_del_map_request_itr_rlocs) \
3848 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
3849 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
3850 _(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry) \
3851 _(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
3852 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
3853 _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
3854 _(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
3855 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
3856 _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
3857 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
3858 _(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
3859 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
3860 _(LISP_LOCATOR_DUMP, lisp_locator_dump) \
3861 _(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \
3862 _(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \
3863 _(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \
3864 _(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \
3865 _(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \
3866 _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel) \
3867 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump) \
3868 _(DELETE_SUBIF, delete_subif) \
3869 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite) \
3871 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface) \
3872 _(FLOW_CLASSIFY_DUMP, flow_classify_dump) \
3873 _(GET_FIRST_MSG_ID, get_first_msg_id) \
3874 _(IOAM_ENABLE, ioam_enable) \
3875 _(IOAM_DISABLE, ioam_disable) \
3876 _(IP_FIB_DUMP, ip_fib_dump) \
3877 _(IP6_FIB_DUMP, ip6_fib_dump) \
3878 _(FEATURE_ENABLE_DISABLE, feature_enable_disable) \
3879 _(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del) \
3880 _(HW_INTERFACE_SET_MTU, hw_interface_set_mtu) \
3881 _(P2P_ETHERNET_ADD, p2p_ethernet_add) \
3882 _(P2P_ETHERNET_DEL, p2p_ethernet_del) \
3883 _(TCP_CONFIGURE_SRC_ADDRESSES, tcp_configure_src_addresses) \
3884 _(APP_NAMESPACE_ADD_DEL, app_namespace_add_del) \
3885 _(LLDP_CONFIG, lldp_config) \
3886 _(SW_INTERFACE_SET_LLDP, sw_interface_set_lldp) \
3887 _(DNS_ENABLE_DISABLE, dns_enable_disable) \
3888 _(DNS_NAME_SERVER_ADD_DEL, dns_name_server_add_del) \
3889 _(DNS_RESOLVE_NAME, dns_resolve_name) \
3890 _(DNS_RESOLVE_IP, dns_resolve_ip) \
3891 _(SESSION_RULE_ADD_DEL, session_rule_add_del) \
3892 _(OUTPUT_ACL_SET_INTERFACE, output_acl_set_interface) \
3893 _(QOS_RECORD_ENABLE_DISABLE, qos_record_enable_disable)
3895 vl_msg_api_custom_dump_configure (api_main_t * am)
3897 #define _(n,f) am->msg_print_handlers[VL_API_##n] \
3898 = (void *) vl_api_##f##_t_print;
3899 foreach_custom_print_function;
3904 * fd.io coding-style-patch-verification: ON
3906 * Local Variables: eval: (c-set-style "gnu") End: