virtio: add packet buffering on tx
[vpp.git] / src / vpp / api / custom_dump.c
1 /*
2  * ------------------------------------------------------------------
3  * custom_dump.c - pretty-print API messages for replay
4  *
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
8  * License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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
16  * under the License.
17  * ------------------------------------------------------------------
18  */
19
20 #include <vnet/vnet.h>
21 #include <vnet/ip/ip.h>
22 #include <vnet/ip-neighbor/ip_neighbor.h>
23 #include <vnet/ip/ip_types_api.h>
24 #include <vnet/fib/fib_api.h>
25 #include <vnet/unix/tuntap.h>
26 #include <vnet/mpls/mpls.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/classify/policer_classify.h>
33 #include <vnet/policer/xlate.h>
34 #include <vnet/policer/policer.h>
35 #include <vnet/classify/flow_classify.h>
36 #include <vlib/vlib.h>
37 #include <vlib/pci/pci.h>
38 #include <vlib/unix/unix.h>
39 #include <vlibapi/api.h>
40 #include <vlibmemory/api.h>
41 #include <vnet/qos/qos_types.h>
42
43 #include <vnet/ethernet/ethernet.h>
44 #include <vnet/ethernet/ethernet_types_api.h>
45 #include <vnet/l2/l2_vtr.h>
46
47 #include <vpp/api/vpe_msg_enum.h>
48 #include <vpp/api/types.h>
49
50 #include <vnet/bonding/node.h>
51
52 #include <vnet/format_fns.h>
53
54 #define vl_typedefs             /* define message structures */
55 #include <vpp/api/vpe_all_api_h.h>
56 #undef vl_typedefs
57
58 #define vl_endianfun            /* define message structures */
59 #include <vpp/api/vpe_all_api_h.h>
60 #undef vl_endianfun
61
62 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
63
64 #define FINISH                                  \
65     vec_add1 (s, 0);                            \
66     vl_print (handle, (char *)s);               \
67     vec_free (s);                               \
68     return handle;
69
70
71 static void *vl_api_create_loopback_t_print
72   (vl_api_create_loopback_t * mp, void *handle)
73 {
74   u8 *s;
75
76   s = format (0, "SCRIPT: create_loopback ");
77   s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
78
79   FINISH;
80 }
81
82 static void *vl_api_create_loopback_instance_t_print
83   (vl_api_create_loopback_instance_t * mp, void *handle)
84 {
85   u8 *s;
86
87   s = format (0, "SCRIPT: create_loopback ");
88   s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
89   s = format (s, "instance %d ", mp->user_instance);
90
91   FINISH;
92 }
93
94 static void *vl_api_delete_loopback_t_print
95   (vl_api_delete_loopback_t * mp, void *handle)
96 {
97   u8 *s;
98
99   s = format (0, "SCRIPT: delete_loopback ");
100   s = format (s, "sw_if_index %d ", mp->sw_if_index);
101
102   FINISH;
103 }
104
105 static void *vl_api_sw_interface_set_flags_t_print
106   (vl_api_sw_interface_set_flags_t * mp, void *handle)
107 {
108   u8 *s;
109   s = format (0, "SCRIPT: sw_interface_set_flags ");
110
111   s = format (s, "sw_if_index %d ", mp->sw_if_index);
112
113   if ((mp->flags) & IF_STATUS_API_FLAG_ADMIN_UP)
114     s = format (s, "admin-up ");
115   else
116     s = format (s, "admin-down ");
117
118   FINISH;
119 }
120
121 __clib_unused
122   static void *vl_api_sw_interface_set_rx_placement_t_print
123   (vl_api_sw_interface_set_rx_placement_t * mp, void *handle)
124 {
125   u8 *s;
126   s = format (0, "SCRIPT: sw_interface_set_rx_placement ");
127
128   s = format (s, "sw_if_index %d ", mp->sw_if_index);
129
130   s = format (s, "queue %d ", mp->queue_id);
131   if (mp->is_main)
132     s = format (s, "main ");
133   else
134     s = format (s, "worker %d ", mp->worker_id);
135
136   FINISH;
137 }
138
139 static void *vl_api_sw_interface_rx_placement_dump_t_print
140   (vl_api_sw_interface_rx_placement_dump_t * mp, void *handle)
141 {
142   u8 *s;
143   u32 sw_if_index = (mp->sw_if_index);
144
145   s = format (0, "SCRIPT: sw_interface_rx_placement_dump ");
146
147   if (sw_if_index != ~0)
148     s = format (s, "sw_if_index %d ", sw_if_index);
149
150   FINISH;
151 }
152
153 static void *vl_api_sw_interface_event_t_print
154   (vl_api_sw_interface_event_t * mp, void *handle)
155 {
156   u8 *s;
157   s = format (0, "SCRIPT: sw_interface_event ");
158
159   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
160
161   if ((mp->flags) & IF_STATUS_API_FLAG_ADMIN_UP)
162     s = format (s, "admin-up ");
163   else
164     s = format (s, "admin-down ");
165
166   if ((mp->flags) & IF_STATUS_API_FLAG_LINK_UP)
167     s = format (s, "link-up");
168   else
169     s = format (s, "link-down");
170
171   if (mp->deleted)
172     s = format (s, " deleted");
173
174   FINISH;
175 }
176
177
178 static void *vl_api_sw_interface_add_del_address_t_print
179   (vl_api_sw_interface_add_del_address_t * mp, void *handle)
180 {
181   u8 *s;
182
183   s = format (0, "SCRIPT: sw_interface_add_del_address ");
184   s = format (s, "sw_if_index %d ", mp->sw_if_index);
185   s = format (s, "%U ", format_vl_api_prefix_t, &mp->prefix);
186   if (mp->is_add == 0)
187     s = format (s, "del ");
188   if (mp->del_all)
189     s = format (s, "del-all ");
190
191   FINISH;
192 }
193
194 static void *vl_api_sw_interface_set_table_t_print
195   (vl_api_sw_interface_set_table_t * mp, void *handle)
196 {
197   u8 *s;
198
199   s = format (0, "SCRIPT: sw_interface_set_table ");
200
201   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
202
203   if (mp->vrf_id)
204     s = format (s, "vrf %d ", (mp->vrf_id));
205
206   if (mp->is_ipv6)
207     s = format (s, "ipv6 ");
208
209   FINISH;
210 }
211
212 static void *vl_api_sw_interface_set_mpls_enable_t_print
213   (vl_api_sw_interface_set_mpls_enable_t * mp, void *handle)
214 {
215   u8 *s;
216
217   s = format (0, "SCRIPT: sw_interface_set_mpls_enable ");
218
219   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
220
221   if (mp->enable == 0)
222     s = format (s, "disable");
223
224   FINISH;
225 }
226
227 static void *vl_api_sw_interface_set_vpath_t_print
228   (vl_api_sw_interface_set_vpath_t * mp, void *handle)
229 {
230   u8 *s;
231
232   s = format (0, "SCRIPT: sw_interface_set_vpath ");
233
234   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
235
236   if (mp->enable)
237     s = format (s, "enable ");
238   else
239     s = format (s, "disable ");
240
241   FINISH;
242 }
243
244 static void *vl_api_sw_interface_set_vxlan_bypass_t_print
245   (vl_api_sw_interface_set_vxlan_bypass_t * mp, void *handle)
246 {
247   u8 *s;
248
249   s = format (0, "SCRIPT: sw_interface_set_vxlan_bypass ");
250
251   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
252
253   if (mp->is_ipv6)
254     s = format (s, "ip6 ");
255
256   if (mp->enable)
257     s = format (s, "enable ");
258   else
259     s = format (s, "disable ");
260
261   FINISH;
262 }
263
264 static void *vl_api_sw_interface_set_l2_xconnect_t_print
265   (vl_api_sw_interface_set_l2_xconnect_t * mp, void *handle)
266 {
267   u8 *s;
268
269   s = format (0, "SCRIPT: sw_interface_set_l2_xconnect ");
270
271   s = format (s, "sw_if_index %d ", (mp->rx_sw_if_index));
272
273   if (mp->enable)
274     {
275       s = format (s, "tx_sw_if_index %d ", (mp->tx_sw_if_index));
276     }
277   else
278     s = format (s, "delete ");
279
280   FINISH;
281 }
282
283 static void *vl_api_sw_interface_set_l2_bridge_t_print
284   (vl_api_sw_interface_set_l2_bridge_t * mp, void *handle)
285 {
286   u8 *s;
287
288   s = format (0, "SCRIPT: sw_interface_set_l2_bridge ");
289
290   s = format (s, "sw_if_index %d ", (mp->rx_sw_if_index));
291
292   if (mp->enable)
293     {
294       s = format (s, "bd_id %d shg %d ", (mp->bd_id), mp->shg);
295       if (L2_API_PORT_TYPE_BVI == (mp->port_type))
296         s = format (s, "bvi ");
297       if (L2_API_PORT_TYPE_UU_FWD == (mp->port_type))
298         s = format (s, "uu-fwd ");
299       s = format (s, "enable");
300     }
301   else
302     s = format (s, "disable ");
303
304   FINISH;
305 }
306
307 static void *vl_api_bridge_domain_add_del_t_print
308   (vl_api_bridge_domain_add_del_t * mp, void *handle)
309 {
310   u8 *s;
311
312   s = format (0, "SCRIPT: bridge_domain_add_del ");
313
314   s = format (s, "bd_id %d ", (mp->bd_id));
315
316   if (mp->is_add)
317     {
318       if (mp->bd_tag[0])
319         s = format (s, "bd_tag %s ", mp->bd_tag);
320       s = format (s, "flood %d uu-flood %d ", mp->flood, mp->uu_flood);
321       s = format (s, "forward %d learn %d ", mp->forward, mp->learn);
322       s = format (s, "arp-term %d mac-age %d", mp->arp_term, mp->mac_age);
323     }
324   else
325     s = format (s, "del ");
326
327   FINISH;
328 }
329
330 static void *vl_api_bridge_domain_set_mac_age_t_print
331   (vl_api_bridge_domain_set_mac_age_t * mp, void *handle)
332 {
333   u8 *s;
334
335   s = format (0, "SCRIPT: bridge_domain_set_mac_age ");
336
337   s = format (s, "bd_id %d ", (mp->bd_id));
338
339   s = format (s, "mac-age %d", mp->mac_age);
340
341   FINISH;
342 }
343
344 static void *vl_api_bridge_domain_dump_t_print
345   (vl_api_bridge_domain_dump_t * mp, void *handle)
346 {
347   u8 *s;
348   u32 bd_id = (mp->bd_id);
349
350   s = format (0, "SCRIPT: bridge_domain_dump ");
351
352   if (bd_id != ~0)
353     s = format (s, "bd_id %d ", bd_id);
354
355   FINISH;
356 }
357
358 static void *vl_api_l2fib_flush_all_t_print
359   (vl_api_l2fib_flush_all_t * mp, void *handle)
360 {
361   u8 *s;
362
363   s = format (0, "SCRIPT: l2fib_flush_all ");
364
365   FINISH;
366 }
367
368
369 static void *vl_api_l2fib_flush_bd_t_print
370   (vl_api_l2fib_flush_bd_t * mp, void *handle)
371 {
372   u8 *s;
373   u32 bd_id = (mp->bd_id);
374
375   s = format (0, "SCRIPT: l2fib_flush_bd ");
376   s = format (s, "bd_id %d ", bd_id);
377
378   FINISH;
379 }
380
381 static void *vl_api_l2fib_flush_int_t_print
382   (vl_api_l2fib_flush_int_t * mp, void *handle)
383 {
384   u8 *s;
385   u32 sw_if_index = (mp->sw_if_index);
386
387   s = format (0, "SCRIPT: l2fib_flush_int ");
388   s = format (s, "sw_if_index %d ", sw_if_index);
389
390   FINISH;
391 }
392
393 static void *vl_api_l2fib_add_del_t_print
394   (vl_api_l2fib_add_del_t * mp, void *handle)
395 {
396   u8 *s;
397
398   s = format (0, "SCRIPT: l2fib_add_del ");
399
400   s = format (s, "mac %U ", format_ethernet_address, mp->mac);
401
402   s = format (s, "bd_id %d ", (mp->bd_id));
403
404
405   if (mp->is_add)
406     {
407       s = format (s, "sw_if_index %d ", (mp->sw_if_index));
408       if (mp->static_mac)
409         s = format (s, "%s", "static ");
410       if (mp->filter_mac)
411         s = format (s, "%s", "filter ");
412       if (mp->bvi_mac)
413         s = format (s, "%s", "bvi ");
414     }
415   else
416     {
417       s = format (s, "del ");
418     }
419
420   FINISH;
421 }
422
423 static void *
424 vl_api_l2_flags_t_print (vl_api_l2_flags_t * mp, void *handle)
425 {
426   u8 *s;
427   u32 flags = (mp->feature_bitmap);
428
429   s = format (0, "SCRIPT: l2_flags ");
430
431   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
432
433   if (flags & L2_LEARN)
434     s = format (s, "learn ");
435   if (flags & L2_FWD)
436     s = format (s, "forward ");
437   if (flags & L2_FLOOD)
438     s = format (s, "flood ");
439   if (flags & L2_UU_FLOOD)
440     s = format (s, "uu-flood ");
441   if (flags & L2_ARP_TERM)
442     s = format (s, "arp-term ");
443
444   if (mp->is_set == 0)
445     s = format (s, "clear ");
446
447   FINISH;
448 }
449
450 static void *vl_api_bridge_flags_t_print
451   (vl_api_bridge_flags_t * mp, void *handle)
452 {
453   u8 *s;
454   u32 flags = (mp->flags);
455
456   s = format (0, "SCRIPT: bridge_flags ");
457
458   s = format (s, "bd_id %d ", (mp->bd_id));
459
460   if (flags & BRIDGE_API_FLAG_LEARN)
461     s = format (s, "learn ");
462   if (flags & BRIDGE_API_FLAG_FWD)
463     s = format (s, "forward ");
464   if (flags & BRIDGE_API_FLAG_FLOOD)
465     s = format (s, "flood ");
466   if (flags & BRIDGE_API_FLAG_UU_FLOOD)
467     s = format (s, "uu-flood ");
468   if (flags & BRIDGE_API_FLAG_ARP_TERM)
469     s = format (s, "arp-term ");
470
471   if (mp->is_set == 0)
472     s = format (s, "clear ");
473
474   FINISH;
475 }
476
477 static void *vl_api_bd_ip_mac_add_del_t_print
478   (vl_api_bd_ip_mac_add_del_t * mp, void *handle)
479 {
480   u8 *s;
481
482   s = format (0, "SCRIPT: bd_ip_mac_add_del ");
483   s = format (s, "bd_id %d ", (mp->entry.bd_id));
484
485   s = format (s, "%U ", format_vl_api_address, &mp->entry.ip);
486   s = format (s, "%U ", format_vl_api_mac_address, &mp->entry.mac);
487   if (mp->is_add == 0)
488     s = format (s, "del ");
489
490   FINISH;
491 }
492
493 static void *vl_api_bd_ip_mac_flush_t_print
494   (vl_api_bd_ip_mac_flush_t * mp, void *handle)
495 {
496   u8 *s;
497
498   s = format (0, "SCRIPT: bd_ip_mac_flush ");
499   s = format (s, "bd_id %d ", (mp->bd_id));
500
501   FINISH;
502 }
503
504 __clib_unused
505   static void *vl_api_bd_ip_mac_dump_t_print
506   (vl_api_bd_ip_mac_dump_t * mp, void *handle)
507 {
508   u8 *s;
509
510   s = format (0, "SCRIPT: bd_ip_mac_dump ");
511
512   FINISH;
513 }
514
515 static void *vl_api_tap_create_v2_t_print
516   (vl_api_tap_create_v2_t * mp, void *handle)
517 {
518   u8 *s;
519   u8 null_mac[6];
520
521   clib_memset (null_mac, 0, sizeof (null_mac));
522
523   s = format (0, "SCRIPT: tap_create_v2 ");
524   s = format (s, "id %u ", (mp->id));
525   if (memcmp (mp->mac_address, null_mac, 6))
526     s = format (s, "mac-address %U ",
527                 format_ethernet_address, mp->mac_address);
528   if (memcmp (mp->host_mac_addr, null_mac, 6))
529     s = format (s, "host-mac-addr %U ",
530                 format_ethernet_address, mp->host_mac_addr);
531   if (mp->host_if_name_set)
532     s = format (s, "host-if-name %s ", mp->host_if_name);
533   if (mp->host_namespace_set)
534     s = format (s, "host-ns %s ", mp->host_namespace);
535   if (mp->host_bridge_set)
536     s = format (s, "host-bridge %s ", mp->host_bridge);
537   if (mp->host_ip4_prefix_set)
538     s = format (s, "host-ip4-addr %U/%d ", format_ip4_address,
539                 mp->host_ip4_prefix.address, mp->host_ip4_prefix.len);
540   if (mp->host_ip6_prefix_set)
541     s = format (s, "host-ip6-addr %U/%d ", format_ip6_address,
542                 mp->host_ip6_prefix.address, mp->host_ip6_prefix.len);
543   if (mp->host_ip4_gw_set)
544     s =
545       format (s, "host-ip4-gw %U ", format_ip4_address,
546               mp->host_ip4_prefix.address);
547   if (mp->host_ip6_gw_set)
548     s =
549       format (s, "host-ip6-gw %U ", format_ip6_address,
550               mp->host_ip6_prefix.address);
551   if (mp->num_rx_queues)
552     s = format (s, "num_rx_queues %u ", mp->num_rx_queues);
553   if (mp->tx_ring_sz)
554     s = format (s, "tx-ring-size %u ", (mp->tx_ring_sz));
555   if (mp->rx_ring_sz)
556     s = format (s, "rx-ring-size %u ", (mp->rx_ring_sz));
557   if (mp->host_mtu_set)
558     s = format (s, "host-mtu-size %u ", (mp->host_mtu_size));
559   if ((mp->tap_flags) & TAP_API_FLAG_GSO)
560     s = format (s, "gso-enabled ");
561   if ((mp->tap_flags) & TAP_API_FLAG_CSUM_OFFLOAD)
562     s = format (s, "csum-offload-enabled ");
563   if ((mp->tap_flags) & TAP_API_FLAG_PERSIST)
564     s = format (s, "persist ");
565   if ((mp->tap_flags) & TAP_API_FLAG_ATTACH)
566     s = format (s, "attach ");
567   if ((mp->tap_flags) & TAP_API_FLAG_TUN)
568     s = format (s, "tun ");
569   if ((mp->tap_flags) & TAP_API_FLAG_GRO_COALESCE)
570     s = format (s, "gro-coalesce-enabled ");
571   if ((mp->tap_flags) & TAP_API_FLAG_PACKED)
572     s = format (s, "packed ");
573   if ((mp->tap_flags) & TAP_API_FLAG_IN_ORDER)
574     s = format (s, "in-order ");
575   FINISH;
576 }
577
578 static void *vl_api_tap_delete_v2_t_print
579   (vl_api_tap_delete_v2_t * mp, void *handle)
580 {
581   u8 *s;
582
583   s = format (0, "SCRIPT: tap_delete_v2 ");
584   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
585
586   FINISH;
587 }
588
589 static void *vl_api_sw_interface_tap_v2_dump_t_print
590   (vl_api_sw_interface_tap_v2_dump_t * mp, void *handle)
591 {
592   u8 *s;
593
594   s = format (0, "SCRIPT: sw_interface_tap_v2_dump ");
595
596   FINISH;
597 }
598
599 __clib_unused
600   static void *vl_api_virtio_pci_create_t_print
601   (vl_api_virtio_pci_create_t * mp, void *handle)
602 {
603   u8 *s;
604   u8 null_mac[6];
605
606   clib_memset (null_mac, 0, sizeof (null_mac));
607
608   s = format (0, "SCRIPT: virtio_pci_create ");
609   s = format (s, "pci_addr %U ", format_vlib_pci_addr, (mp->pci_addr));
610   if (memcmp (mp->mac_address, null_mac, 6))
611     s = format (s, "mac-address %U ",
612                 format_ethernet_address, mp->mac_address);
613   if (mp->features)
614     s = format (s, "features 0x%llx ", clib_net_to_host_u64 (mp->features));
615   if (mp->gso_enabled)
616     s = format (s, "gso-enabled ");
617   if (mp->checksum_offload_enabled)
618     s = format (s, "checksum_offload_enabled");
619   FINISH;
620 }
621
622 __clib_unused
623   static void *vl_api_virtio_pci_create_v2_t_print
624   (vl_api_virtio_pci_create_v2_t * mp, void *handle)
625 {
626   u8 *s;
627   u8 null_mac[6];
628
629   clib_memset (null_mac, 0, sizeof (null_mac));
630
631   s = format (0, "SCRIPT: virtio_pci_create_v2 ");
632   s = format (s, "pci_addr %U ", format_vlib_pci_addr, (mp->pci_addr));
633   if (memcmp (mp->mac_address, null_mac, 6))
634     s = format (s, "mac-address %U ",
635                 format_ethernet_address, mp->mac_address);
636   if (mp->features)
637     s = format (s, "features 0x%llx ", clib_net_to_host_u64 (mp->features));
638   if (mp->virtio_flags & VIRTIO_API_FLAG_GSO)
639     s = format (s, "gso-enabled ");
640   if (mp->virtio_flags & VIRTIO_API_FLAG_CSUM_OFFLOAD)
641     s = format (s, "checksum_offload_enabled ");
642   if ((mp->virtio_flags) & VIRTIO_API_FLAG_GRO_COALESCE)
643     s = format (s, "gro-coalesce-enabled ");
644   if ((mp->virtio_flags) & VIRTIO_API_FLAG_PACKED)
645     s = format (s, "packed ");
646   if ((mp->virtio_flags) & VIRTIO_API_FLAG_IN_ORDER)
647     s = format (s, "in-order ");
648   if ((mp->virtio_flags) & VIRTIO_API_FLAG_BUFFERING)
649     s = format (s, "buffering ");
650   FINISH;
651 }
652
653 __clib_unused
654   static void *vl_api_virtio_pci_delete_t_print
655   (vl_api_virtio_pci_delete_t * mp, void *handle)
656 {
657   u8 *s;
658
659   s = format (0, "SCRIPT: virtio_pci_delete ");
660   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
661
662   FINISH;
663 }
664
665 __clib_unused
666   static void *vl_api_sw_interface_virtio_pci_dump_t_print
667   (vl_api_sw_interface_virtio_pci_dump_t * mp, void *handle)
668 {
669   u8 *s;
670
671   s = format (0, "SCRIPT: sw_interface_virtio_pci_dump ");
672
673   FINISH;
674 }
675
676 static void *vl_api_bond_create_t_print
677   (vl_api_bond_create_t * mp, void *handle)
678 {
679   u8 *s;
680   u8 null_mac[6];
681
682   clib_memset (null_mac, 0, sizeof (null_mac));
683
684   s = format (0, "SCRIPT: bond_create ");
685   if (memcmp (mp->mac_address, null_mac, 6))
686     s = format (s, "mac-address %U ",
687                 format_ethernet_address, mp->mac_address);
688   if (mp->mode)
689     s = format (s, "mode %U ", format_bond_mode, ntohl (mp->mode));
690   if (mp->lb)
691     s = format (s, "lb %U ", format_bond_load_balance, ntohl (mp->lb));
692   if (mp->numa_only)
693     s = format (s, "numa-only is set in lacp mode");
694   if (mp->id != ~0)
695     s = format (s, "id %u ", (mp->id));
696   FINISH;
697 }
698
699 static void *vl_api_bond_create2_t_print
700   (vl_api_bond_create2_t * mp, void *handle)
701 {
702   u8 *s;
703   u8 null_mac[6];
704
705   clib_memset (null_mac, 0, sizeof (null_mac));
706
707   s = format (0, "SCRIPT: bond_create2 ");
708   if (memcmp (mp->mac_address, null_mac, 6))
709     s = format (s, "mac-address %U ",
710                 format_ethernet_address, mp->mac_address);
711   if (mp->mode)
712     s = format (s, "mode %U ", format_bond_mode, ntohl (mp->mode));
713   if (mp->lb)
714     s = format (s, "lb %U ", format_bond_load_balance, ntohl (mp->lb));
715   if (mp->numa_only)
716     s = format (s, "numa-only ");
717   if (mp->enable_gso)
718     s = format (s, "gso ");
719   if (mp->id != ~0)
720     s = format (s, "id %u ", (mp->id));
721   FINISH;
722 }
723
724 static void *vl_api_bond_delete_t_print
725   (vl_api_bond_delete_t * mp, void *handle)
726 {
727   u8 *s;
728
729   s = format (0, "SCRIPT: bond_delete ");
730   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
731
732   FINISH;
733 }
734
735 static void *vl_api_bond_add_member_t_print
736   (vl_api_bond_add_member_t * mp, void *handle)
737 {
738   u8 *s;
739
740   s = format (0, "SCRIPT: bond_add_member ");
741   s = format (s, "bond_sw_if_index %u ", (mp->bond_sw_if_index));
742   s = format (s, "sw_if_index %u ", (mp->sw_if_index));
743   if (mp->is_passive)
744     s = format (s, "passive ");
745   if (mp->is_long_timeout)
746     s = format (s, "long-timeout ");
747
748   FINISH;
749 }
750
751 static void *vl_api_sw_interface_set_bond_weight_t_print
752   (vl_api_sw_interface_set_bond_weight_t * mp, void *handle)
753 {
754   u8 *s;
755
756   s = format (0, "SCRIPT: sw_interface_set_bond_weight ");
757   s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index));
758   s = format (s, "weight %u ", ntohl (mp->weight));
759
760   FINISH;
761 }
762
763 static void *vl_api_bond_detach_member_t_print
764   (vl_api_bond_detach_member_t * mp, void *handle)
765 {
766   u8 *s;
767
768   s = format (0, "SCRIPT: bond_detach_member ");
769   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
770
771   FINISH;
772 }
773
774 static void *vl_api_sw_bond_interface_dump_t_print
775   (vl_api_sw_bond_interface_dump_t * mp, void *handle)
776 {
777   u8 *s;
778
779   s = format (0, "SCRIPT: sw_bond_interface_dump ");
780   if (mp->sw_if_index != ~0)
781     s = format (s, "sw_if_index %d ", (mp->sw_if_index));
782
783   FINISH;
784 }
785
786 static void *vl_api_sw_member_interface_dump_t_print
787   (vl_api_sw_member_interface_dump_t * mp, void *handle)
788 {
789   u8 *s;
790
791   s = format (0, "SCRIPT: sw_member_interface_dump ");
792   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
793
794   FINISH;
795 }
796
797 static void *vl_api_ip_route_add_del_t_print
798   (vl_api_ip_route_add_del_t * mp, void *handle)
799 {
800   u8 *s, p;
801
802   s = format (0, "SCRIPT: ip_route_add_del ");
803   if (mp->is_add == 0)
804     s = format (s, "del ");
805
806   s = format (s, "%U", format_vl_api_prefix, &mp->route.prefix);
807
808   for (p = 0; p < mp->route.n_paths; p++)
809     s = format (s, " [%U]", format_vl_api_fib_path, &mp->route.paths[p]);
810
811   FINISH;
812 }
813
814 static void *vl_api_mpls_route_add_del_t_print
815   (vl_api_mpls_route_add_del_t * mp, void *handle)
816 {
817   u8 *s, p;
818
819   s = format (0, "SCRIPT: mpls_route_add_del ");
820
821   if (mp->mr_is_add)
822     s = format (s, "add ");
823   else
824     s = format (s, "del ");
825
826   s = format (s, "table %d ", (mp->mr_route.mr_table_id));
827   s = format (s, "%d ", (mp->mr_route.mr_label));
828
829   if (mp->mr_route.mr_eos)
830     s = format (s, "eos ");
831   else
832     s = format (s, "non-eos ");
833
834   if (mp->mr_route.mr_is_multicast)
835     s = format (s, "multicast ");
836
837   for (p = 0; p < mp->mr_route.mr_n_paths; p++)
838     s =
839       format (s, " [%U]", format_vl_api_fib_path, &mp->mr_route.mr_paths[p]);
840
841
842   FINISH;
843 }
844
845 static void *vl_api_ip_table_add_del_t_print
846   (vl_api_ip_table_add_del_t * mp, void *handle)
847 {
848   u8 *s;
849
850   s = format (0, "SCRIPT: ip_table_add_del ");
851   if (mp->is_add)
852     s = format (s, "add ");
853   else
854     s = format (s, "del ");
855   if (mp->table.is_ip6)
856     s = format (s, "ip6 ");
857   s = format (s, "table %d ", (mp->table.table_id));
858   s = format (s, "%s ", mp->table.name);
859
860   FINISH;
861 }
862
863 static void *vl_api_mpls_table_add_del_t_print
864   (vl_api_mpls_table_add_del_t * mp, void *handle)
865 {
866   u8 *s;
867
868   s = format (0, "SCRIPT: mpls_table_add_del ");
869   if (mp->mt_is_add)
870     s = format (s, "add ");
871   else
872     s = format (s, "del ");
873   s = format (s, "table %d ", (mp->mt_table.mt_table_id));
874
875   FINISH;
876 }
877
878 static void *vl_api_mpls_tunnel_add_del_t_print
879   (vl_api_mpls_tunnel_add_del_t * mp, void *handle)
880 {
881   u8 *s, p;
882
883   s = format (0, "SCRIPT: mpls_tunnel_add_del ");
884
885   if (mp->mt_is_add == 0)
886     s = format (s, "del sw_if_index %d ", (mp->mt_tunnel.mt_sw_if_index));
887   else
888     s = format (s, "sw_if_index %d ", (mp->mt_tunnel.mt_sw_if_index));
889
890
891   if (mp->mt_tunnel.mt_l2_only)
892     s = format (s, "l2-only ");
893   if (mp->mt_tunnel.mt_is_multicast)
894     s = format (s, "multicast ");
895   if (mp->mt_tunnel.mt_tunnel_index)
896     s = format (s, "tunnel-index ");
897
898   for (p = 0; p < mp->mt_tunnel.mt_n_paths; p++)
899     s = format (s, " [%U]", format_vl_api_fib_path,
900                 &mp->mt_tunnel.mt_paths[p]);
901
902   FINISH;
903 }
904
905 static void *vl_api_sr_mpls_policy_add_t_print
906   (vl_api_sr_mpls_policy_add_t * mp, void *handle)
907 {
908   u8 *s;
909
910   s = format (0, "SCRIPT: sr_mpls_policy_add ");
911
912   s = format (s, "bsid %d ", (mp->bsid));
913
914   if (mp->weight != htonl ((u32) 1))
915     s = format (s, "%d ", (mp->weight));
916
917   if (mp->is_spray)
918     s = format (s, "spray ");
919
920   if (mp->n_segments)
921     {
922       int i;
923       for (i = 0; i < mp->n_segments; i++)
924         s = format (s, "next %d ", (mp->segments[i]));
925     }
926
927   FINISH;
928 }
929
930 static void *vl_api_sr_mpls_policy_del_t_print
931   (vl_api_sr_mpls_policy_del_t * mp, void *handle)
932 {
933   u8 *s;
934
935   s = format (0, "SCRIPT: sr_mpls_policy_del ");
936
937   s = format (s, "bsid %d ", (mp->bsid));
938
939   FINISH;
940 }
941
942 static void *vl_api_sw_interface_set_unnumbered_t_print
943   (vl_api_sw_interface_set_unnumbered_t * mp, void *handle)
944 {
945   u8 *s;
946
947   s = format (0, "SCRIPT: sw_interface_set_unnumbered ");
948
949   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
950
951   s = format (s, "unnum_if_index %d ", (mp->unnumbered_sw_if_index));
952
953   if (mp->is_add == 0)
954     s = format (s, "del ");
955
956   FINISH;
957 }
958
959 static void *vl_api_create_vlan_subif_t_print
960   (vl_api_create_vlan_subif_t * mp, void *handle)
961 {
962   u8 *s;
963
964   s = format (0, "SCRIPT: create_vlan_subif ");
965
966   if (mp->sw_if_index)
967     s = format (s, "sw_if_index %d ", (mp->sw_if_index));
968
969   if (mp->vlan_id)
970     s = format (s, "vlan_id %d ", (mp->vlan_id));
971
972   FINISH;
973 }
974
975 #define foreach_create_subif_flag               \
976 _(0, "no_tags")                                 \
977 _(1, "one_tag")                                 \
978 _(2, "two_tags")                                \
979 _(3, "dot1ad")                                  \
980 _(4, "exact_match")                             \
981 _(5, "default_sub")                             \
982 _(6, "outer_vlan_id_any")                       \
983 _(7, "inner_vlan_id_any")
984
985 static void *vl_api_create_subif_t_print
986   (vl_api_create_subif_t * mp, void *handle)
987 {
988   u8 *s;
989
990   s = format (0, "SCRIPT: create_subif ");
991
992   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
993
994   s = format (s, "sub_id %d ", (mp->sub_id));
995
996   if (mp->outer_vlan_id)
997     s = format (s, "outer_vlan_id %d ", (mp->outer_vlan_id));
998
999   if (mp->inner_vlan_id)
1000     s = format (s, "inner_vlan_id %d ", (mp->inner_vlan_id));
1001
1002 #define _(a,b) if (mp->sub_if_flags & (1 << a)) s = format (s, "%s ", b);
1003   foreach_create_subif_flag;
1004 #undef _
1005
1006   FINISH;
1007 }
1008
1009 static void *vl_api_delete_subif_t_print
1010   (vl_api_delete_subif_t * mp, void *handle)
1011 {
1012   u8 *s;
1013
1014   s = format (0, "SCRIPT: delete_subif ");
1015   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1016
1017   FINISH;
1018 }
1019
1020 static void *
1021 vl_api_ip_table_replace_begin_t_print (vl_api_ip_table_replace_begin_t * mp,
1022                                        void *handle)
1023 {
1024   u8 *s;
1025
1026   s = format (0, "SCRIPT: ip_table_replace_begin ");
1027
1028   s = format (s, "v%s-table %d ",
1029               mp->table.is_ip6 ? "6" : "4", (mp->table.table_id));
1030
1031   FINISH;
1032 }
1033
1034 static void *
1035 vl_api_ip_table_flush_t_print (vl_api_ip_table_flush_t * mp, void *handle)
1036 {
1037   u8 *s;
1038
1039   s = format (0, "SCRIPT: ip_table_flush ");
1040
1041   s = format (s, "v%s-table %d ",
1042               mp->table.is_ip6 ? "6" : "4", (mp->table.table_id));
1043
1044   FINISH;
1045 }
1046
1047 static void *
1048 vl_api_ip_table_replace_end_t_print (vl_api_ip_table_replace_end_t * mp,
1049                                      void *handle)
1050 {
1051   u8 *s;
1052
1053   s = format (0, "SCRIPT: ip_table_replace_end ");
1054
1055   s = format (s, "v%s-table %d ",
1056               mp->table.is_ip6 ? "6" : "4", (mp->table.table_id));
1057
1058   FINISH;
1059 }
1060
1061 static void *vl_api_set_ip_flow_hash_t_print
1062   (vl_api_set_ip_flow_hash_t * mp, void *handle)
1063 {
1064   u8 *s;
1065
1066   s = format (0, "SCRIPT: set_ip_flow_hash ");
1067
1068   s = format (s, "vrf_id %d ", (mp->vrf_id));
1069
1070   if (mp->src)
1071     s = format (s, "src ");
1072
1073   if (mp->dst)
1074     s = format (s, "dst ");
1075
1076   if (mp->sport)
1077     s = format (s, "sport ");
1078
1079   if (mp->dport)
1080     s = format (s, "dport ");
1081
1082   if (mp->proto)
1083     s = format (s, "proto ");
1084
1085   if (mp->reverse)
1086     s = format (s, "reverse ");
1087
1088   if (mp->is_ipv6 != 0)
1089     s = format (s, "ipv6 ");
1090
1091   FINISH;
1092 }
1093
1094
1095 static void *vl_api_l2_patch_add_del_t_print
1096   (vl_api_l2_patch_add_del_t * mp, void *handle)
1097 {
1098   u8 *s;
1099
1100   s = format (0, "SCRIPT: l2_patch_add_del ");
1101
1102   s = format (s, "rx_sw_if_index %d ", (mp->rx_sw_if_index));
1103
1104   s = format (s, "tx_sw_if_index %d ", (mp->tx_sw_if_index));
1105
1106   if (mp->is_add == 0)
1107     s = format (s, "del ");
1108
1109   FINISH;
1110 }
1111
1112 static void *vl_api_sr_localsid_add_del_t_print
1113   (vl_api_sr_localsid_add_del_t * mp, void *handle)
1114 {
1115   vnet_main_t *vnm = vnet_get_main ();
1116   u8 *s;
1117
1118   s = format (0, "SCRIPT: sr_localsid_add_del ");
1119
1120   switch (mp->behavior)
1121     {
1122     case SR_BEHAVIOR_END:
1123       s = format (s, "Address: %U\nBehavior: End",
1124                   format_ip6_address, (ip6_address_t *) mp->localsid);
1125       s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1126       break;
1127     case SR_BEHAVIOR_X:
1128       s =
1129         format (s,
1130                 "Address: %U\nBehavior: X (Endpoint with Layer-3 cross-connect)"
1131                 "\nIface: %U\nNext hop: %U", format_ip6_address,
1132                 (ip6_address_t *) mp->localsid,
1133                 format_vnet_sw_if_index_name, vnm, (mp->sw_if_index),
1134                 format_ip6_address, (ip6_address_t *) mp->nh_addr.un.ip6);
1135       s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1136       break;
1137     case SR_BEHAVIOR_DX4:
1138       s =
1139         format (s,
1140                 "Address: %U\nBehavior: DX4 (Endpoint with decapsulation with IPv4 cross-connect)"
1141                 "\nIface: %U\nNext hop: %U", format_ip6_address,
1142                 (ip6_address_t *) mp->localsid,
1143                 format_vnet_sw_if_index_name, vnm, (mp->sw_if_index),
1144                 format_ip4_address, (ip4_address_t *) mp->nh_addr.un.ip4);
1145       break;
1146     case SR_BEHAVIOR_DX6:
1147       s =
1148         format (s,
1149                 "Address: %U\nBehavior: DX6 (Endpoint with decapsulation with IPv6 cross-connect)"
1150                 "\nIface: %UNext hop: %U", format_ip6_address,
1151                 (ip6_address_t *) mp->localsid,
1152                 format_vnet_sw_if_index_name, vnm, (mp->sw_if_index),
1153                 format_ip6_address, (ip6_address_t *) mp->nh_addr.un.ip6);
1154       break;
1155     case SR_BEHAVIOR_DX2:
1156       s =
1157         format (s,
1158                 "Address: %U\nBehavior: DX2 (Endpoint with decapulation and Layer-2 cross-connect)"
1159                 "\nIface: %U", format_ip6_address,
1160                 (ip6_address_t *) mp->localsid,
1161                 format_vnet_sw_if_index_name, vnm, (mp->sw_if_index));
1162       break;
1163     case SR_BEHAVIOR_DT6:
1164       s =
1165         format (s,
1166                 "Address: %U\nBehavior: DT6 (Endpoint with decapsulation and specific IPv6 table lookup)"
1167                 "\nTable: %u", format_ip6_address,
1168                 (ip6_address_t *) mp->localsid, (mp->fib_table));
1169       break;
1170     case SR_BEHAVIOR_DT4:
1171       s =
1172         format (s,
1173                 "Address: %U\nBehavior: DT4 (Endpoint with decapsulation and specific IPv4 table lookup)"
1174                 "\nTable: %u", format_ip6_address,
1175                 (ip6_address_t *) mp->localsid, (mp->fib_table));
1176       break;
1177     default:
1178       if (mp->behavior >= SR_BEHAVIOR_LAST)
1179         {
1180           s = format (s, "Address: %U\n Behavior: %u",
1181                       format_ip6_address, (ip6_address_t *) mp->localsid,
1182                       mp->behavior);
1183         }
1184       else
1185         //Should never get here...
1186         s = format (s, "Internal error");
1187       break;
1188     }
1189   FINISH;
1190 }
1191
1192 static void *vl_api_sr_steering_add_del_t_print
1193   (vl_api_sr_steering_add_del_t * mp, void *handle)
1194 {
1195   u8 *s;
1196
1197   s = format (0, "SCRIPT: sr_steering_add_del ");
1198
1199   s = format (s, (mp->is_del ? "Del: True" : "Del: False"));
1200
1201   switch (mp->traffic_type)
1202     {
1203     case SR_STEER_L2:
1204       s = format (s, "Traffic type: L2 iface: %u", (mp->sw_if_index));
1205       break;
1206     case SR_STEER_IPV4:
1207       s = format (s, "Traffic type: IPv4 %U/%u", format_ip4_address,
1208                   (ip4_address_t *) mp->prefix.address.un.ip4,
1209                   (mp->prefix.len));
1210       break;
1211     case SR_STEER_IPV6:
1212       s = format (s, "Traffic type: IPv6 %U/%u", format_ip6_address,
1213                   (ip6_address_t *) mp->prefix.address.un.ip6,
1214                   (mp->prefix.len));
1215       break;
1216     default:
1217       s = format (s, "Traffic type: Unknown(%u)", mp->traffic_type);
1218       break;
1219     }
1220   s = format (s, "BindingSID: %U", format_ip6_address,
1221               (ip6_address_t *) mp->bsid_addr);
1222
1223   s = format (s, "SR Policy Index: %u", (mp->sr_policy_index));
1224
1225   s = format (s, "FIB_table: %u", (mp->table_id));
1226
1227   FINISH;
1228 }
1229
1230 static void *vl_api_sr_policy_add_t_print
1231   (vl_api_sr_policy_add_t * mp, void *handle)
1232 {
1233   u8 *s;
1234
1235   ip6_address_t *segments = 0, *seg;
1236   ip6_address_t *this_address = (ip6_address_t *) mp->sids.sids;
1237
1238   int i;
1239   for (i = 0; i < mp->sids.num_sids; i++)
1240     {
1241       vec_add2 (segments, seg, 1);
1242       clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1243       this_address++;
1244     }
1245
1246   s = format (0, "SCRIPT: sr_policy_add ");
1247
1248   s = format (s, "BSID: %U", format_ip6_address,
1249               (ip6_address_t *) mp->bsid_addr);
1250
1251   s =
1252     format (s,
1253             (mp->is_encap ? "Behavior: Encapsulation" :
1254              "Behavior: SRH insertion"));
1255
1256   s = format (s, "FIB_table: %u", (mp->fib_table));
1257
1258   s = format (s, (mp->is_spray ? "Type: Default" : "Type: Spray"));
1259
1260   s = format (s, "SID list weight: %u", (mp->weight));
1261
1262   s = format (s, "{");
1263   vec_foreach (seg, segments)
1264   {
1265     s = format (s, "%U, ", format_ip6_address, seg);
1266   }
1267   s = format (s, "\b\b } ");
1268
1269   FINISH;
1270 }
1271
1272 static void *vl_api_sr_policy_mod_t_print
1273   (vl_api_sr_policy_mod_t * mp, void *handle)
1274 {
1275   u8 *s;
1276
1277   ip6_address_t *segments = 0, *seg;
1278   ip6_address_t *this_address = (ip6_address_t *) mp->sids.sids;
1279
1280   int i;
1281   for (i = 0; i < mp->sids.num_sids; i++)
1282     {
1283       vec_add2 (segments, seg, 1);
1284       clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1285       this_address++;
1286     }
1287
1288   s = format (0, "SCRIPT: sr_policy_mod ");
1289
1290   s = format (s, "BSID: %U", format_ip6_address,
1291               (ip6_address_t *) mp->bsid_addr);
1292
1293   s = format (s, "SR Policy index: %u", (mp->sr_policy_index));
1294
1295   s = format (s, "Operation: %u", mp->operation);
1296
1297   s = format (s, "SID list index: %u", (mp->sl_index));
1298
1299   s = format (s, "SID list weight: %u", (mp->weight));
1300
1301   s = format (s, "{");
1302   vec_foreach (seg, segments)
1303   {
1304     s = format (s, "%U, ", format_ip6_address, seg);
1305   }
1306   s = format (s, "\b\b } ");
1307
1308   FINISH;
1309 }
1310
1311 static void *vl_api_sr_policy_del_t_print
1312   (vl_api_sr_policy_del_t * mp, void *handle)
1313 {
1314   u8 *s;
1315
1316   s = format (0, "SCRIPT: sr_policy_del ");
1317   s = format (s, "To be delivered. Good luck.");
1318   FINISH;
1319 }
1320
1321 static void *vl_api_classify_add_del_table_t_print
1322   (vl_api_classify_add_del_table_t * mp, void *handle)
1323 {
1324   u8 *s;
1325   int i;
1326
1327   s = format (0, "SCRIPT: classify_add_del_table ");
1328
1329   if (mp->is_add == 0)
1330     {
1331       s = format (s, "table %d ", (mp->table_index));
1332       s = format (s, "%s ", mp->del_chain ? "del-chain" : "del");
1333     }
1334   else
1335     {
1336       s = format (s, "nbuckets %d ", (mp->nbuckets));
1337       s = format (s, "memory_size %d ", (mp->memory_size));
1338       s = format (s, "skip %d ", (mp->skip_n_vectors));
1339       s = format (s, "match %d ", (mp->match_n_vectors));
1340       s = format (s, "next-table %d ", (mp->next_table_index));
1341       s = format (s, "miss-next %d ", (mp->miss_next_index));
1342       s = format (s, "current-data-flag %d ", (mp->current_data_flag));
1343       if (mp->current_data_flag)
1344         s = format (s, "current-data-offset %d ", (mp->current_data_offset));
1345       s = format (s, "mask hex ");
1346       for (i = 0; i < (mp->match_n_vectors) * sizeof (u32x4); i++)
1347         s = format (s, "%02x", mp->mask[i]);
1348       vec_add1 (s, ' ');
1349     }
1350
1351   FINISH;
1352 }
1353
1354 static void *vl_api_classify_add_del_session_t_print
1355   (vl_api_classify_add_del_session_t * mp, void *handle)
1356 {
1357   u8 *s;
1358   int i, limit = 0;
1359
1360   s = format (0, "SCRIPT: classify_add_del_session ");
1361
1362   s = format (s, "table_index %d ", (mp->table_index));
1363   s = format (s, "hit_next_index %d ", (mp->hit_next_index));
1364   s = format (s, "opaque_index %d ", (mp->opaque_index));
1365   s = format (s, "advance %d ", (mp->advance));
1366   s = format (s, "action %d ", mp->action);
1367   if (mp->action)
1368     s = format (s, "metadata %d ", (mp->metadata));
1369   if (mp->is_add == 0)
1370     s = format (s, "del ");
1371
1372   s = format (s, "match hex ");
1373   for (i = 5 * sizeof (u32x4) - 1; i > 0; i--)
1374     {
1375       if (mp->match[i] != 0)
1376         {
1377           limit = i + 1;
1378           break;
1379         }
1380     }
1381
1382   for (i = 0; i < limit; i++)
1383     s = format (s, "%02x", mp->match[i]);
1384
1385   FINISH;
1386 }
1387
1388 static void *vl_api_classify_set_interface_ip_table_t_print
1389   (vl_api_classify_set_interface_ip_table_t * mp, void *handle)
1390 {
1391   u8 *s;
1392
1393   s = format (0, "SCRIPT: classify_set_interface_ip_table ");
1394
1395   if (mp->is_ipv6)
1396     s = format (s, "ipv6 ");
1397
1398   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1399   s = format (s, "table %d ", (mp->table_index));
1400
1401   FINISH;
1402 }
1403
1404 static void *vl_api_classify_set_interface_l2_tables_t_print
1405   (vl_api_classify_set_interface_l2_tables_t * mp, void *handle)
1406 {
1407   u8 *s;
1408
1409   s = format (0, "SCRIPT: classify_set_interface_l2_tables ");
1410
1411   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1412   s = format (s, "ip4-table %d ", (mp->ip4_table_index));
1413   s = format (s, "ip6-table %d ", (mp->ip6_table_index));
1414   s = format (s, "other-table %d ", (mp->other_table_index));
1415   s = format (s, "is-input %d ", mp->is_input);
1416
1417   FINISH;
1418 }
1419
1420 static void *vl_api_add_node_next_t_print
1421   (vl_api_add_node_next_t * mp, void *handle)
1422 {
1423   u8 *s;
1424
1425   s = format (0, "SCRIPT: add_node_next ");
1426
1427   s = format (s, "node %s next %s ", mp->node_name, mp->next_name);
1428
1429   FINISH;
1430 }
1431
1432 static void *vl_api_vxlan_add_del_tunnel_t_print
1433   (vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
1434 {
1435   u8 *s;
1436   s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
1437
1438   ip46_address_t src =
1439     to_ip46 (mp->src_address.af, (u8 *) & mp->src_address.un);
1440   ip46_address_t dst =
1441     to_ip46 (mp->dst_address.af, (u8 *) & mp->dst_address.un);
1442
1443   u8 is_grp = ip46_address_is_multicast (&dst);
1444   char *dst_name = is_grp ? "group" : "dst";
1445
1446   s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY);
1447   s = format (s, "%s %U ", dst_name, format_ip46_address,
1448               &dst, IP46_TYPE_ANY);
1449
1450   if (is_grp)
1451     s = format (s, "mcast_sw_if_index %d ", (mp->mcast_sw_if_index));
1452
1453   if (mp->encap_vrf_id)
1454     s = format (s, "encap-vrf-id %d ", (mp->encap_vrf_id));
1455
1456   s = format (s, "decap-next %d ", (mp->decap_next_index));
1457
1458   s = format (s, "vni %d ", (mp->vni));
1459
1460   s = format (s, "instance %d ", (mp->instance));
1461
1462   if (mp->is_add == 0)
1463     s = format (s, "del ");
1464
1465   FINISH;
1466 }
1467
1468 static void *vl_api_vxlan_offload_rx_t_print
1469   (vl_api_vxlan_offload_rx_t * mp, void *handle)
1470 {
1471   u8 *s;
1472   s = format (0, "SCRIPT: vxlan_offload_rx ");
1473
1474   s = format (s, "hw hw_if_index %d ", (mp->hw_if_index));
1475   s = format (s, "rx sw_if_index %d ", (mp->sw_if_index));
1476   if (!mp->enable)
1477     s = format (s, "del ");
1478
1479   FINISH;
1480 }
1481
1482 static void *vl_api_vxlan_tunnel_dump_t_print
1483   (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1484 {
1485   u8 *s;
1486
1487   s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1488
1489   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1490
1491   FINISH;
1492 }
1493
1494 static void *vl_api_vxlan_gbp_tunnel_add_del_t_print
1495   (vl_api_vxlan_gbp_tunnel_add_del_t * mp, void *handle)
1496 {
1497   u8 *s;
1498   s = format (0, "SCRIPT: vxlan_gbp_tunnel_add_del ");
1499
1500   if (mp->is_add)
1501     s = format (s, "add ");
1502   else
1503     s = format (s, "del ");
1504
1505   s = format (s, "instance %d ", (mp->tunnel.instance));
1506   s = format (s, "src %U ", format_vl_api_address, &mp->tunnel.src);
1507   s = format (s, "dst %U ", format_vl_api_address, &mp->tunnel.dst);
1508   s = format (s, "mcast_sw_if_index %d ", (mp->tunnel.mcast_sw_if_index));
1509   s = format (s, "encap_table_id %d ", (mp->tunnel.encap_table_id));
1510   s = format (s, "vni %d ", (mp->tunnel.vni));
1511   s = format (s, "sw_if_index %d ", (mp->tunnel.sw_if_index));
1512
1513   FINISH;
1514 }
1515
1516 static void *vl_api_vxlan_gbp_tunnel_dump_t_print
1517   (vl_api_vxlan_gbp_tunnel_dump_t * mp, void *handle)
1518 {
1519   u8 *s;
1520
1521   s = format (0, "SCRIPT: vxlan_gbp_tunnel_dump ");
1522
1523   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1524
1525   FINISH;
1526 }
1527
1528 static void *vl_api_sw_interface_set_vxlan_gbp_bypass_t_print
1529   (vl_api_sw_interface_set_vxlan_gbp_bypass_t * mp, void *handle)
1530 {
1531   u8 *s;
1532
1533   s = format (0, "SCRIPT: sw_interface_set_vxlan_gbp_bypass ");
1534
1535   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1536   s = format (s, "%s ", (mp->is_ipv6 != 0) ? "ipv6" : "ipv4");
1537   s = format (s, "%s ", (mp->enable != 0) ? "enable" : "disable");
1538
1539   FINISH;
1540 }
1541
1542 static void *vl_api_gre_tunnel_add_del_t_print
1543   (vl_api_gre_tunnel_add_del_t * mp, void *handle)
1544 {
1545   u8 *s;
1546
1547   s = format (0, "SCRIPT: gre_tunnel_add_del ");
1548
1549   s = format (s, "dst %U ", format_vl_api_address, &mp->tunnel.dst);
1550   s = format (s, "src %U ", format_vl_api_address, &mp->tunnel.src);
1551
1552   s = format (s, "instance %d ", (mp->tunnel.instance));
1553
1554   if (mp->tunnel.type == GRE_API_TUNNEL_TYPE_TEB)
1555     s = format (s, "teb ");
1556
1557   if (mp->tunnel.type == GRE_API_TUNNEL_TYPE_ERSPAN)
1558     s = format (s, "erspan %d ", (mp->tunnel.session_id));
1559
1560   if (mp->tunnel.outer_table_id)
1561     s = format (s, "outer-table-id %d ", mp->tunnel.outer_table_id);
1562
1563   if (mp->is_add == 0)
1564     s = format (s, "del ");
1565
1566   FINISH;
1567 }
1568
1569 static void *vl_api_gre_tunnel_dump_t_print
1570   (vl_api_gre_tunnel_dump_t * mp, void *handle)
1571 {
1572   u8 *s;
1573
1574   s = format (0, "SCRIPT: gre_tunnel_dump ");
1575
1576   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1577
1578   FINISH;
1579 }
1580
1581 static void *vl_api_l2_fib_clear_table_t_print
1582   (vl_api_l2_fib_clear_table_t * mp, void *handle)
1583 {
1584   u8 *s;
1585
1586   s = format (0, "SCRIPT: l2_fib_clear_table ");
1587
1588   FINISH;
1589 }
1590
1591 static void *vl_api_l2_interface_efp_filter_t_print
1592   (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1593 {
1594   u8 *s;
1595
1596   s = format (0, "SCRIPT: l2_interface_efp_filter ");
1597
1598   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1599   if (mp->enable_disable)
1600     s = format (s, "enable ");
1601   else
1602     s = format (s, "disable ");
1603
1604   FINISH;
1605 }
1606
1607 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1608   (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1609 {
1610   u8 *s;
1611
1612   s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1613
1614   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1615   s = format (s, "vtr_op %d ", (mp->vtr_op));
1616   s = format (s, "push_dot1q %d ", (mp->push_dot1q));
1617   s = format (s, "tag1 %d ", (mp->tag1));
1618   s = format (s, "tag2 %d ", (mp->tag2));
1619
1620   FINISH;
1621 }
1622
1623 static void *vl_api_create_vhost_user_if_t_print
1624   (vl_api_create_vhost_user_if_t * mp, void *handle)
1625 {
1626   u8 *s;
1627
1628   s = format (0, "SCRIPT: create_vhost_user_if ");
1629
1630   s = format (s, "socket %s ", mp->sock_filename);
1631   if (mp->is_server)
1632     s = format (s, "server ");
1633   if (mp->renumber)
1634     s = format (s, "renumber %d ", (mp->custom_dev_instance));
1635   if (mp->disable_mrg_rxbuf)
1636     s = format (s, "disable_mrg_rxbuf ");
1637   if (mp->disable_indirect_desc)
1638     s = format (s, "disable_indirect_desc ");
1639   if (mp->tag[0])
1640     s = format (s, "tag %s ", mp->tag);
1641   if (mp->enable_gso)
1642     s = format (s, "gso ");
1643   if (mp->enable_packed)
1644     s = format (s, "packed");
1645
1646   FINISH;
1647 }
1648
1649 static void *vl_api_modify_vhost_user_if_t_print
1650   (vl_api_modify_vhost_user_if_t * mp, void *handle)
1651 {
1652   u8 *s;
1653
1654   s = format (0, "SCRIPT: modify_vhost_user_if ");
1655
1656   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1657   s = format (s, "socket %s ", mp->sock_filename);
1658   if (mp->is_server)
1659     s = format (s, "server ");
1660   if (mp->renumber)
1661     s = format (s, "renumber %d ", (mp->custom_dev_instance));
1662   if (mp->enable_gso)
1663     s = format (s, "gso ");
1664   if (mp->enable_packed)
1665     s = format (s, "packed");
1666
1667   FINISH;
1668 }
1669
1670 static void *vl_api_delete_vhost_user_if_t_print
1671   (vl_api_delete_vhost_user_if_t * mp, void *handle)
1672 {
1673   u8 *s;
1674
1675   s = format (0, "SCRIPT: delete_vhost_user_if ");
1676   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1677
1678   FINISH;
1679 }
1680
1681 static void *vl_api_sw_interface_vhost_user_dump_t_print
1682   (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
1683 {
1684   u8 *s;
1685
1686   s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
1687   if (mp->sw_if_index != ~0)
1688     s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1689
1690   FINISH;
1691 }
1692
1693 static void *vl_api_sw_interface_dump_t_print
1694   (vl_api_sw_interface_dump_t * mp, void *handle)
1695 {
1696   u8 *s;
1697
1698   s = format (0, "SCRIPT: sw_interface_dump ");
1699
1700   if (mp->name_filter_valid)
1701     {
1702       u8 *v = vl_api_from_api_to_new_vec (mp, &mp->name_filter);
1703       s = format (s, "name_filter %v ", v);
1704       vec_free (v);
1705     }
1706   else
1707     s = format (s, "all ");
1708
1709   FINISH;
1710 }
1711
1712 static void *vl_api_l2_fib_table_dump_t_print
1713   (vl_api_l2_fib_table_dump_t * mp, void *handle)
1714 {
1715   u8 *s;
1716
1717   s = format (0, "SCRIPT: l2_fib_table_dump ");
1718
1719   s = format (s, "bd_id %d ", (mp->bd_id));
1720
1721   FINISH;
1722 }
1723
1724 static void *vl_api_control_ping_t_print
1725   (vl_api_control_ping_t * mp, void *handle)
1726 {
1727   u8 *s;
1728
1729   s = format (0, "SCRIPT: control_ping ");
1730
1731   FINISH;
1732 }
1733
1734 static void *vl_api_want_interface_events_t_print
1735   (vl_api_want_interface_events_t * mp, void *handle)
1736 {
1737   u8 *s;
1738
1739   s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
1740               (mp->pid), ntohl (mp->enable_disable));
1741
1742   FINISH;
1743 }
1744
1745 static void *
1746 vl_api_cli_t_print (vl_api_cli_t * mp, void *handle)
1747 {
1748   u8 *s;
1749
1750   s = format (0, "SCRIPT: cli ");
1751
1752   FINISH;
1753 }
1754
1755 static void *vl_api_cli_inband_t_print
1756   (vl_api_cli_inband_t * mp, void *handle)
1757 {
1758   u8 *s;
1759   u8 *cmd = 0;
1760
1761   cmd = vl_api_from_api_to_new_vec (mp, &mp->cmd);
1762
1763   s = format (0, "SCRIPT: exec %v ", cmd);
1764
1765   vec_free (cmd);
1766   FINISH;
1767 }
1768
1769 static void *vl_api_memclnt_create_t_print
1770   (vl_api_memclnt_create_t * mp, void *handle)
1771 {
1772   u8 *s;
1773
1774   s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
1775
1776   FINISH;
1777 }
1778
1779 static void *vl_api_sockclnt_create_t_print
1780   (vl_api_sockclnt_create_t * mp, void *handle)
1781 {
1782   u8 *s;
1783
1784   s = format (0, "SCRIPT: sockclnt_create name %s ", mp->name);
1785
1786   FINISH;
1787 }
1788
1789 static void *vl_api_show_version_t_print
1790   (vl_api_show_version_t * mp, void *handle)
1791 {
1792   u8 *s;
1793
1794   s = format (0, "SCRIPT: show_version ");
1795
1796   FINISH;
1797 }
1798
1799 __clib_unused
1800   static void *vl_api_show_threads_t_print
1801   (vl_api_show_threads_t * mp, void *handle)
1802 {
1803   u8 *s;
1804
1805   s = format (0, "SCRIPT: show_threads ");
1806
1807   FINISH;
1808 }
1809
1810 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
1811   (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
1812 {
1813   u8 *s;
1814
1815   s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
1816
1817   ip46_address_t local, remote;
1818
1819   ip_address_decode (&mp->local, &local);
1820   ip_address_decode (&mp->remote, &remote);
1821
1822   u8 is_grp = ip46_address_is_multicast (&remote);
1823   char *remote_name = is_grp ? "group" : "remote";
1824
1825   s = format (s, "local %U ", format_ip46_address, &local, IP46_TYPE_ANY);
1826   s = format (s, "%s %U ", remote_name, format_ip46_address,
1827               &remote, IP46_TYPE_ANY);
1828
1829   if (is_grp)
1830     s = format (s, "mcast_sw_if_index %d ", (mp->mcast_sw_if_index));
1831   s = format (s, "protocol %d ", (mp->protocol));
1832
1833   s = format (s, "vni %d ", (mp->vni));
1834
1835   if (mp->is_add == 0)
1836     s = format (s, "del ");
1837
1838   if (mp->encap_vrf_id)
1839     s = format (s, "encap-vrf-id %d ", (mp->encap_vrf_id));
1840
1841   if (mp->decap_vrf_id)
1842     s = format (s, "decap-vrf-id %d ", (mp->decap_vrf_id));
1843
1844   FINISH;
1845 }
1846
1847 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
1848   (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
1849 {
1850   u8 *s;
1851
1852   s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
1853
1854   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1855
1856   FINISH;
1857 }
1858
1859 static void *vl_api_interface_name_renumber_t_print
1860   (vl_api_interface_name_renumber_t * mp, void *handle)
1861 {
1862   u8 *s;
1863
1864   s = format (0, "SCRIPT: interface_renumber ");
1865
1866   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1867
1868   s = format (s, "new_show_dev_instance %d ", (mp->new_show_dev_instance));
1869
1870   FINISH;
1871 }
1872
1873 static void *vl_api_want_l2_macs_events_t_print
1874   (vl_api_want_l2_macs_events_t * mp, void *handle)
1875 {
1876   u8 *s;
1877
1878   s = format (0, "SCRIPT: want_l2_macs_events ");
1879   s = format (s, "learn-limit %d ", (mp->learn_limit));
1880   s = format (s, "scan-delay %d ", (u32) mp->scan_delay);
1881   s = format (s, "max-entries %d ", (u32) mp->max_macs_in_event * 10);
1882   if (mp->enable_disable == 0)
1883     s = format (s, "disable");
1884
1885   FINISH;
1886 }
1887
1888 static void *vl_api_input_acl_set_interface_t_print
1889   (vl_api_input_acl_set_interface_t * mp, void *handle)
1890 {
1891   u8 *s;
1892
1893   s = format (0, "SCRIPT: input_acl_set_interface ");
1894
1895   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1896   s = format (s, "ip4-table %d ", (mp->ip4_table_index));
1897   s = format (s, "ip6-table %d ", (mp->ip6_table_index));
1898   s = format (s, "l2-table %d ", (mp->l2_table_index));
1899
1900   if (mp->is_add == 0)
1901     s = format (s, "del ");
1902
1903   FINISH;
1904 }
1905
1906 static void *vl_api_output_acl_set_interface_t_print
1907   (vl_api_output_acl_set_interface_t * mp, void *handle)
1908 {
1909   u8 *s;
1910
1911   s = format (0, "SCRIPT: output_acl_set_interface ");
1912
1913   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1914   s = format (s, "ip4-table %d ", (mp->ip4_table_index));
1915   s = format (s, "ip6-table %d ", (mp->ip6_table_index));
1916   s = format (s, "l2-table %d ", (mp->l2_table_index));
1917
1918   if (mp->is_add == 0)
1919     s = format (s, "del ");
1920
1921   FINISH;
1922 }
1923
1924 static void *vl_api_ip_address_dump_t_print
1925   (vl_api_ip_address_dump_t * mp, void *handle)
1926 {
1927   u8 *s;
1928
1929   s = format (0, "SCRIPT: ip6_address_dump ");
1930   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1931   s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1932
1933   FINISH;
1934 }
1935
1936 static void *
1937 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
1938 {
1939   u8 *s;
1940
1941   s = format (0, "SCRIPT: ip_dump ");
1942   s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1943
1944   FINISH;
1945 }
1946
1947 static void *vl_api_cop_interface_enable_disable_t_print
1948   (vl_api_cop_interface_enable_disable_t * mp, void *handle)
1949 {
1950   u8 *s;
1951
1952   s = format (0, "SCRIPT: cop_interface_enable_disable ");
1953   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1954   if (mp->enable_disable)
1955     s = format (s, "enable ");
1956   else
1957     s = format (s, "disable ");
1958
1959   FINISH;
1960 }
1961
1962 static void *vl_api_cop_whitelist_enable_disable_t_print
1963   (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
1964 {
1965   u8 *s;
1966
1967   s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
1968   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1969   s = format (s, "fib-id %d ", (mp->fib_id));
1970   if (mp->ip4)
1971     s = format (s, "ip4 ");
1972   if (mp->ip6)
1973     s = format (s, "ip6 ");
1974   if (mp->default_cop)
1975     s = format (s, "default ");
1976
1977   FINISH;
1978 }
1979
1980 static void *vl_api_af_packet_create_t_print
1981   (vl_api_af_packet_create_t * mp, void *handle)
1982 {
1983   u8 *s;
1984
1985   s = format (0, "SCRIPT: af_packet_create ");
1986   s = format (s, "host_if_name %s ", mp->host_if_name);
1987   if (mp->use_random_hw_addr)
1988     s = format (s, "hw_addr random ");
1989   else
1990     s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
1991
1992   FINISH;
1993 }
1994
1995 static void *vl_api_af_packet_delete_t_print
1996   (vl_api_af_packet_delete_t * mp, void *handle)
1997 {
1998   u8 *s;
1999
2000   s = format (0, "SCRIPT: af_packet_delete ");
2001   s = format (s, "host_if_name %s ", mp->host_if_name);
2002
2003   FINISH;
2004 }
2005
2006 static void *vl_api_af_packet_dump_t_print
2007   (vl_api_af_packet_dump_t * mp, void *handle)
2008 {
2009   u8 *s;
2010
2011   s = format (0, "SCRIPT: af_packet_dump ");
2012
2013   FINISH;
2014 }
2015
2016 static u8 *
2017 format_policer_action (u8 * s, va_list * va)
2018 {
2019   u32 action = va_arg (*va, u32);
2020   u32 dscp = va_arg (*va, u32);
2021   char *t = 0;
2022
2023   if (action == SSE2_QOS_ACTION_DROP)
2024     s = format (s, "drop");
2025   else if (action == SSE2_QOS_ACTION_TRANSMIT)
2026     s = format (s, "transmit");
2027   else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
2028     {
2029       s = format (s, "mark-and-transmit ");
2030       switch (dscp)
2031         {
2032 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
2033           foreach_vnet_dscp
2034 #undef _
2035         default:
2036           break;
2037         }
2038       s = format (s, "%s", t);
2039     }
2040   return s;
2041 }
2042
2043 static void *vl_api_policer_add_del_t_print
2044   (vl_api_policer_add_del_t * mp, void *handle)
2045 {
2046   u8 *s;
2047
2048   s = format (0, "SCRIPT: policer_add_del ");
2049   s = format (s, "name %s ", mp->name);
2050   s = format (s, "cir %d ", mp->cir);
2051   s = format (s, "eir %d ", mp->eir);
2052   s = format (s, "cb %d ", mp->cb);
2053   s = format (s, "eb %d ", mp->eb);
2054
2055   switch (mp->rate_type)
2056     {
2057     case SSE2_QOS_RATE_KBPS:
2058       s = format (s, "rate_type kbps ");
2059       break;
2060     case SSE2_QOS_RATE_PPS:
2061       s = format (s, "rate_type pps ");
2062       break;
2063     default:
2064       break;
2065     }
2066
2067   switch (mp->round_type)
2068     {
2069     case SSE2_QOS_ROUND_TO_CLOSEST:
2070       s = format (s, "round_type closest ");
2071       break;
2072     case SSE2_QOS_ROUND_TO_UP:
2073       s = format (s, "round_type up ");
2074       break;
2075     case SSE2_QOS_ROUND_TO_DOWN:
2076       s = format (s, "round_type down ");
2077       break;
2078     default:
2079       break;
2080     }
2081
2082   switch (mp->type)
2083     {
2084     case SSE2_QOS_POLICER_TYPE_1R2C:
2085       s = format (s, "type 1r2c ");
2086       break;
2087     case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
2088       s = format (s, "type 1r3c ");
2089       break;
2090     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
2091       s = format (s, "type 2r3c-2698 ");
2092       break;
2093     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
2094       s = format (s, "type 2r3c-4115 ");
2095       break;
2096     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
2097       s = format (s, "type 2r3c-mef5cf1 ");
2098       break;
2099     default:
2100       break;
2101     }
2102
2103   s = format (s, "conform_action %U ", format_policer_action,
2104               mp->conform_action.type, mp->conform_action.dscp);
2105   s = format (s, "exceed_action %U ", format_policer_action,
2106               mp->exceed_action.type, mp->exceed_action.dscp);
2107   s = format (s, "violate_action %U ", format_policer_action,
2108               mp->violate_action.type, mp->violate_action.dscp);
2109
2110   if (mp->color_aware)
2111     s = format (s, "color-aware ");
2112   if (mp->is_add == 0)
2113     s = format (s, "del ");
2114
2115   FINISH;
2116 }
2117
2118 static void *vl_api_policer_dump_t_print
2119   (vl_api_policer_dump_t * mp, void *handle)
2120 {
2121   u8 *s;
2122
2123   s = format (0, "SCRIPT: policer_dump ");
2124   if (mp->match_name_valid)
2125     s = format (s, "name %s ", mp->match_name);
2126
2127   FINISH;
2128 }
2129
2130 static void *vl_api_policer_classify_set_interface_t_print
2131   (vl_api_policer_classify_set_interface_t * mp, void *handle)
2132 {
2133   u8 *s;
2134
2135   s = format (0, "SCRIPT: policer_classify_set_interface ");
2136   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2137   if (mp->ip4_table_index != ~0)
2138     s = format (s, "ip4-table %d ", (mp->ip4_table_index));
2139   if (mp->ip6_table_index != ~0)
2140     s = format (s, "ip6-table %d ", (mp->ip6_table_index));
2141   if (mp->l2_table_index != ~0)
2142     s = format (s, "l2-table %d ", (mp->l2_table_index));
2143   if (mp->is_add == 0)
2144     s = format (s, "del ");
2145
2146   FINISH;
2147 }
2148
2149 static void *vl_api_policer_classify_dump_t_print
2150   (vl_api_policer_classify_dump_t * mp, void *handle)
2151 {
2152   u8 *s;
2153
2154   s = format (0, "SCRIPT: policer_classify_dump ");
2155   switch (mp->type)
2156     {
2157     case POLICER_CLASSIFY_API_TABLE_IP4:
2158       s = format (s, "type ip4 ");
2159       break;
2160     case POLICER_CLASSIFY_API_TABLE_IP6:
2161       s = format (s, "type ip6 ");
2162       break;
2163     case POLICER_CLASSIFY_API_TABLE_L2:
2164       s = format (s, "type l2 ");
2165       break;
2166     default:
2167       break;
2168     }
2169
2170   FINISH;
2171 }
2172
2173 static void *vl_api_sw_interface_clear_stats_t_print
2174   (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2175 {
2176   u8 *s;
2177
2178   s = format (0, "SCRIPT: sw_interface_clear_stats ");
2179   if (mp->sw_if_index != ~0)
2180     s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2181
2182   FINISH;
2183 }
2184
2185 static void *vl_api_mpls_tunnel_dump_t_print
2186   (vl_api_mpls_tunnel_dump_t * mp, void *handle)
2187 {
2188   u8 *s;
2189
2190   s = format (0, "SCRIPT: mpls_tunnel_dump ");
2191   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2192
2193   FINISH;
2194 }
2195
2196 static void *vl_api_mpls_table_dump_t_print
2197   (vl_api_mpls_table_dump_t * mp, void *handle)
2198 {
2199   u8 *s;
2200
2201   s = format (0, "SCRIPT: mpls_table_decap_dump ");
2202
2203   FINISH;
2204 }
2205
2206 static void *vl_api_mpls_route_dump_t_print
2207   (vl_api_mpls_route_dump_t * mp, void *handle)
2208 {
2209   u8 *s;
2210
2211   s = format (0, "SCRIPT: mpls_route_decap_dump ");
2212
2213   FINISH;
2214 }
2215
2216 static void *vl_api_ip_table_dump_t_print
2217   (vl_api_ip_table_dump_t * mp, void *handle)
2218 {
2219   u8 *s;
2220
2221   s = format (0, "SCRIPT: ip_table_dump ");
2222
2223   FINISH;
2224 }
2225
2226 static void *vl_api_ip_route_dump_t_print
2227   (vl_api_ip_route_dump_t * mp, void *handle)
2228 {
2229   u8 *s;
2230
2231   s = format (0, "SCRIPT: ip_route_dump ");
2232
2233   FINISH;
2234 }
2235
2236 static void *vl_api_classify_table_ids_t_print
2237   (vl_api_classify_table_ids_t * mp, void *handle)
2238 {
2239   u8 *s;
2240
2241   s = format (0, "SCRIPT: classify_table_ids ");
2242
2243   FINISH;
2244 }
2245
2246 static void *vl_api_classify_table_by_interface_t_print
2247   (vl_api_classify_table_by_interface_t * mp, void *handle)
2248 {
2249   u8 *s;
2250
2251   s = format (0, "SCRIPT: classify_table_by_interface ");
2252   if (mp->sw_if_index != ~0)
2253     s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2254
2255   FINISH;
2256 }
2257
2258 static void *vl_api_classify_table_info_t_print
2259   (vl_api_classify_table_info_t * mp, void *handle)
2260 {
2261   u8 *s;
2262
2263   s = format (0, "SCRIPT: classify_table_info ");
2264   if (mp->table_id != ~0)
2265     s = format (s, "table_id %d ", (mp->table_id));
2266
2267   FINISH;
2268 }
2269
2270 static void *vl_api_classify_session_dump_t_print
2271   (vl_api_classify_session_dump_t * mp, void *handle)
2272 {
2273   u8 *s;
2274
2275   s = format (0, "SCRIPT: classify_session_dump ");
2276   if (mp->table_id != ~0)
2277     s = format (s, "table_id %d ", (mp->table_id));
2278
2279   FINISH;
2280 }
2281
2282 static void *vl_api_set_ipfix_exporter_t_print
2283   (vl_api_set_ipfix_exporter_t * mp, void *handle)
2284 {
2285   u8 *s;
2286
2287   s = format (0, "SCRIPT: set_ipfix_exporter ");
2288
2289   s = format (s, "collector-address %U ", format_ip4_address,
2290               (ip4_address_t *) mp->collector_address.un.ip4);
2291   s = format (s, "collector-port %d ", (mp->collector_port));
2292   s = format (s, "src-address %U ", format_ip4_address,
2293               (ip4_address_t *) mp->src_address.un.ip4);
2294   s = format (s, "vrf-id %d ", (mp->vrf_id));
2295   s = format (s, "path-mtu %d ", (mp->path_mtu));
2296   s = format (s, "template-interval %d ", (mp->template_interval));
2297   s = format (s, "udp-checksum %d ", mp->udp_checksum);
2298
2299   FINISH;
2300 }
2301
2302 static void *vl_api_ipfix_exporter_dump_t_print
2303   (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2304 {
2305   u8 *s;
2306
2307   s = format (0, "SCRIPT: ipfix_exporter_dump ");
2308
2309   FINISH;
2310 }
2311
2312 static void *vl_api_set_ipfix_classify_stream_t_print
2313   (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2314 {
2315   u8 *s;
2316
2317   s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2318
2319   s = format (s, "domain-id %d ", (mp->domain_id));
2320   s = format (s, "src-port %d ", (mp->src_port));
2321
2322   FINISH;
2323 }
2324
2325 static void *vl_api_ipfix_classify_stream_dump_t_print
2326   (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2327 {
2328   u8 *s;
2329
2330   s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2331
2332   FINISH;
2333 }
2334
2335 static void *vl_api_ipfix_classify_table_add_del_t_print
2336   (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2337 {
2338   u8 *s;
2339
2340   s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2341
2342   s = format (s, "table-id %d ", (mp->table_id));
2343   s = format (s, "ip-version %d ", mp->ip_version);
2344   s = format (s, "transport-protocol %d ", mp->transport_protocol);
2345
2346   FINISH;
2347 }
2348
2349 static void *vl_api_ipfix_classify_table_dump_t_print
2350   (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2351 {
2352   u8 *s;
2353
2354   s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2355
2356   FINISH;
2357 }
2358
2359 static void *vl_api_sw_interface_span_enable_disable_t_print
2360   (vl_api_sw_interface_span_enable_disable_t * mp, void *handle)
2361 {
2362   u8 *s;
2363
2364   s = format (0, "SCRIPT: sw_interface_span_enable_disable ");
2365   s = format (s, "src_sw_if_index %u ", (mp->sw_if_index_from));
2366   s = format (s, "dst_sw_if_index %u ", (mp->sw_if_index_to));
2367
2368   if (mp->is_l2)
2369     s = format (s, "l2 ");
2370
2371   switch (mp->state)
2372     {
2373     case 0:
2374       s = format (s, "disable ");
2375       break;
2376     case 1:
2377       s = format (s, "rx ");
2378       break;
2379     case 2:
2380       s = format (s, "tx ");
2381       break;
2382     case 3:
2383     default:
2384       s = format (s, "both ");
2385       break;
2386     }
2387
2388   FINISH;
2389 }
2390
2391 static void *
2392 vl_api_sw_interface_span_dump_t_print (vl_api_sw_interface_span_dump_t * mp,
2393                                        void *handle)
2394 {
2395   u8 *s;
2396
2397   s = format (0, "SCRIPT: sw_interface_span_dump ");
2398
2399   if (mp->is_l2)
2400     s = format (s, "l2 ");
2401
2402   FINISH;
2403 }
2404
2405 static void *vl_api_get_next_index_t_print
2406   (vl_api_get_next_index_t * mp, void *handle)
2407 {
2408   u8 *s;
2409
2410   s = format (0, "SCRIPT: get_next_index ");
2411   s = format (s, "node-name %s ", mp->node_name);
2412   s = format (s, "next-node-name %s ", mp->next_name);
2413
2414   FINISH;
2415 }
2416
2417 static void *vl_api_pg_create_interface_t_print
2418   (vl_api_pg_create_interface_t * mp, void *handle)
2419 {
2420   u8 *s;
2421
2422   s = format (0, "SCRIPT: pg_create_interface ");
2423   s = format (s, "if_id %d ", (mp->interface_id));
2424   s = format (s, "gso-enabled %u ", mp->gso_enabled);
2425   s = format (s, "gso-size %u", (mp->gso_size));
2426
2427   FINISH;
2428 }
2429
2430 static void *vl_api_pg_capture_t_print
2431   (vl_api_pg_capture_t * mp, void *handle)
2432 {
2433   u8 *s;
2434
2435   s = format (0, "SCRIPT: pg_capture ");
2436   s = format (s, "if_id %d ", (mp->interface_id));
2437   s = format (s, "pcap %s", mp->pcap_file_name);
2438   if (mp->count != ~0)
2439     s = format (s, "count %d ", (mp->count));
2440   if (!mp->is_enabled)
2441     s = format (s, "disable");
2442
2443   FINISH;
2444 }
2445
2446 static void *vl_api_pg_enable_disable_t_print
2447   (vl_api_pg_enable_disable_t * mp, void *handle)
2448 {
2449   u8 *s;
2450
2451   s = format (0, "SCRIPT: pg_enable_disable ");
2452   if (vl_api_string_len (&mp->stream_name) > 0)
2453     s =
2454       format (s, "stream %s",
2455               vl_api_from_api_to_new_c_string (&mp->stream_name));
2456   if (!mp->is_enabled)
2457     s = format (s, "disable");
2458
2459   FINISH;
2460 }
2461
2462 static void *vl_api_pg_interface_enable_disable_coalesce_t_print
2463   (vl_api_pg_interface_enable_disable_coalesce_t * mp, void *handle)
2464 {
2465   u8 *s;
2466
2467   s = format (0, "SCRIPT: pg_interface_enable_disable_coalesce ");
2468   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2469   if (!mp->coalesce_enabled)
2470     s = format (s, "disable");
2471   else
2472     s = format (s, "enable");
2473   FINISH;
2474 }
2475
2476
2477 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2478   (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2479 {
2480   u8 *s;
2481   int i;
2482
2483   s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2484   s = format (s, "%U ", format_vl_api_prefix, &mp->prefix);
2485
2486   for (i = 0; i < mp->number_of_ranges; i++)
2487     {
2488       s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2489     }
2490
2491   s = format (s, "vrf %d ", (mp->vrf_id));
2492
2493   if (mp->is_add == 0)
2494     s = format (s, "del ");
2495
2496   FINISH;
2497 }
2498
2499 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2500   (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2501    void *handle)
2502 {
2503   u8 *s;
2504
2505   s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2506
2507   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2508
2509   if (mp->tcp_out_vrf_id != ~0)
2510     s = format (s, "tcp-out-vrf %d ", (mp->tcp_out_vrf_id));
2511
2512   if (mp->udp_out_vrf_id != ~0)
2513     s = format (s, "udp-out-vrf %d ", (mp->udp_out_vrf_id));
2514
2515   if (mp->tcp_in_vrf_id != ~0)
2516     s = format (s, "tcp-in-vrf %d ", (mp->tcp_in_vrf_id));
2517
2518   if (mp->udp_in_vrf_id != ~0)
2519     s = format (s, "udp-in-vrf %d ", (mp->udp_in_vrf_id));
2520
2521   if (mp->is_add == 0)
2522     s = format (s, "del ");
2523
2524   FINISH;
2525 }
2526
2527 static void *vl_api_ipsec_tunnel_if_add_del_t_print
2528   (vl_api_ipsec_tunnel_if_add_del_t * mp, void *handle)
2529 {
2530   u8 *s;
2531
2532   s = format (0, "SCRIPT: ipsec_tunnel_if_add_del ");
2533
2534   if (mp->esn)
2535     s = format (s, "esn");
2536   if (mp->anti_replay)
2537     s = format (s, "anti-replay");
2538   if (mp->udp_encap)
2539     s = format (s, "udp-encap");
2540
2541   s = format (s, "local-ip %U ", format_vl_api_address, &mp->remote_ip);
2542
2543   s = format (s, "remote-ip %U ", format_vl_api_address, &mp->local_ip);
2544   s = format (s, "tx-table-id %d ", (mp->tx_table_id));
2545
2546   s = format (s, "local-spi %d ", (mp->local_spi));
2547
2548   s = format (s, "remote-spi %d ", (mp->remote_spi));
2549
2550   s = format (s, "local-crypto-key-len %d ", mp->local_crypto_key_len);
2551   s = format (s, "local-crypto-key %U ", format_hex_bytes,
2552               mp->local_crypto_key, mp->local_crypto_key_len, 0);
2553   s = format (s, "remote-crypto-key-len %d ", mp->remote_crypto_key_len);
2554   s = format (s, "remote-crypto-key %U ", format_hex_bytes,
2555               mp->remote_crypto_key, mp->remote_crypto_key_len, 0);
2556   s = format (s, "local-integ-key-len %d ", mp->local_integ_key_len);
2557   s = format (s, "local-integ-key %U ", format_hex_bytes,
2558               mp->local_integ_key, mp->local_integ_key_len, 0);
2559   s = format (s, "remote-integ-key-len %d ", mp->remote_integ_key_len);
2560   s = format (s, "remote-integ-key %U ", format_hex_bytes,
2561               mp->remote_integ_key, mp->remote_integ_key_len, 0);
2562
2563   if (mp->is_add == 0)
2564     s = format (s, "del ");
2565
2566   FINISH;
2567 }
2568
2569 /* static u8 * */
2570 /* format_nsh_address_vat (u8 * s, va_list * args) */
2571 /* { */
2572 /*   nsh_t *a = va_arg (*args, nsh_t *); */
2573 /*   return format (s, "SPI:%d SI:%d", clib_net_to_host_u32 (a->spi), a->si); */
2574 /* } */
2575
2576 static const char *policy_strs[] = {
2577   "BYPASS",
2578   "DISCARD",
2579   "RESOLVE",
2580   "PROTECT",
2581 };
2582
2583 static const char *algo_strs[] = {
2584   "NONE",
2585   "AES_CBC_128",
2586   "AES_CBC_192",
2587   "AES_CBC_256",
2588   "AES_CTR_128",
2589   "AES_CTR_192",
2590   "AES_CTR_256",
2591   "AES_GCM_128",
2592   "AES_GCM_192",
2593   "AES_GCM_256",
2594   "DES_CBC",
2595   "3DES_CBC",
2596 };
2597
2598
2599 static const char *integ_strs[] = {
2600   "NONE",
2601   "MD5_96",
2602   "SHA1_96",
2603   "SHA_256_96",
2604   "SHA_256_128",
2605   "SHA_384_192",
2606   "SHA_512_256",
2607 };
2608
2609 static void *vl_api_ipsec_spd_entry_add_del_t_print
2610   (vl_api_ipsec_spd_entry_add_del_t * mp, void *handle)
2611 {
2612   u8 *s;
2613   const char *str;
2614   vl_api_ipsec_spd_entry_t *ep;
2615   int policy_host_byte_order;
2616
2617   ep = (vl_api_ipsec_spd_entry_t *) & mp->entry;
2618
2619   s = format (0, "SCRIPT: ipsec_spd_entry ");
2620   s = format (s, "is_add %d spd_id %u priority %d is_outbound %d sa_id %u\n",
2621               mp->is_add,
2622               (ep->spd_id), ntohl (ep->priority), ep->is_outbound,
2623               (ep->sa_id));
2624
2625   policy_host_byte_order = (ep->policy);
2626
2627   if (policy_host_byte_order < ARRAY_LEN (policy_strs))
2628     str = policy_strs[policy_host_byte_order];
2629   else
2630     str = "BOGUS!";
2631
2632   s = format (s, "  policy: %s protocol %d\n", str, ep->protocol);
2633
2634   s = format (s, "  remote_address_start %U remote_address_stop %U\n",
2635               format_vl_api_address,
2636               &ep->remote_address_start,
2637               format_vl_api_address, &ep->remote_address_stop);
2638
2639   s = format (s, "  local_address_start %U local_address_stop %U\n",
2640               format_vl_api_address,
2641               &ep->local_address_start,
2642               format_vl_api_address, &ep->local_address_stop);
2643
2644   s = format (s, "  remote_port_start %d remote_port_stop %d\n",
2645               (ep->remote_port_start), ntohs (ep->remote_port_stop));
2646
2647   s = format (s, "  local_port_start %d local_port_stop %d ",
2648               (ep->local_port_start), ntohs (ep->local_port_stop));
2649
2650   FINISH;
2651 }
2652
2653 static void *vl_api_ipsec_interface_add_del_spd_t_print
2654   (vl_api_ipsec_interface_add_del_spd_t * mp, void *handle)
2655 {
2656   u8 *s;
2657
2658   s = format (0, "SCRIPT: ipsec_interface_add_del_spd ");
2659   s = format (s, "is_add %d sw_if_index %d spd_id %u ",
2660               mp->is_add, (mp->sw_if_index), ntohl (mp->spd_id));
2661   FINISH;
2662 }
2663
2664 static void *vl_api_ipsec_spd_add_del_t_print
2665   (vl_api_ipsec_spd_add_del_t * mp, void *handle)
2666 {
2667   u8 *s;
2668
2669   s = format (0, "SCRIPT: ipsec_spd_add_del ");
2670   s = format (s, "spd_id %u is_add %d ", (mp->spd_id), mp->is_add);
2671   FINISH;
2672 }
2673
2674 static void *vl_api_ipsec_sad_entry_add_del_t_print
2675   (vl_api_ipsec_sad_entry_add_del_t * mp, void *handle)
2676 {
2677   u8 *s;
2678   int tmp;
2679   vl_api_ipsec_sad_entry_t *ep;
2680   const char *protocol_str, *algo_str, *integ_str;
2681
2682   protocol_str = "BOGUS protocol!";
2683   algo_str = "BOGUS crypto_algorithm!";
2684   integ_str = "BOGUS integrity_algorithm!";
2685
2686   ep = (vl_api_ipsec_sad_entry_t *) & mp->entry;
2687
2688   s = format (0, "SCRIPT: ipsec_sad_entry_add_del is_add %d ", mp->is_add);
2689
2690   tmp = (ep->protocol);
2691   if (tmp == IPSEC_API_PROTO_ESP)
2692     protocol_str = "ESP";
2693   else if (tmp == IPSEC_API_PROTO_AH)
2694     protocol_str = "AH";
2695
2696   tmp = (ep->crypto_algorithm);
2697   if (tmp < ARRAY_LEN (algo_strs))
2698     algo_str = algo_strs[tmp];
2699
2700   tmp = (ep->integrity_algorithm);
2701   if (tmp < ARRAY_LEN (integ_strs))
2702     integ_str = integ_strs[tmp];
2703
2704   s = format (s, "proto %s crypto alg %s integ alg %s\n",
2705               protocol_str, algo_str, integ_str);
2706   s = format (s, " crypto_key len %d value %U\n",
2707               ep->crypto_key.length, format_hex_bytes, ep->crypto_key.data,
2708               (int) (ep->crypto_key.length));
2709   s = format (s, " integ_key len %d value %U\n",
2710               ep->integrity_key.length, format_hex_bytes,
2711               ep->integrity_key.data, (int) (ep->integrity_key.length));
2712   s = format (s, " flags 0x%x ", (ep->flags));
2713
2714   s = format (s, "tunnel_src %U tunnel_dst %U\n",
2715               format_vl_api_address,
2716               &ep->tunnel_src, format_vl_api_address, &ep->tunnel_dst);
2717   s = format (s, " tx_table_id %u salt %u ",
2718               (ep->tx_table_id), ntohl (ep->salt));
2719   FINISH;
2720 }
2721
2722
2723 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
2724   (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
2725 {
2726   u8 *s;
2727   u32 vtr_op = (mp->vtr_op);
2728
2729   s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
2730
2731   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2732   s = format (s, "vtr_op %d ", vtr_op);
2733   if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
2734     {
2735       if (vtr_op == L2_VTR_TRANSLATE_2_2)
2736         s = format (s, "%d ", (mp->outer_tag));
2737       s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
2738       s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
2739       s = format (s, "sid %d ", (mp->i_sid));
2740       s = format (s, "vlanid %d ", (mp->b_vlanid));
2741     }
2742   FINISH;
2743 }
2744
2745 static void *vl_api_flow_classify_set_interface_t_print
2746   (vl_api_flow_classify_set_interface_t * mp, void *handle)
2747 {
2748   u8 *s;
2749
2750   s = format (0, "SCRIPT: flow_classify_set_interface ");
2751   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2752   if (mp->ip4_table_index != ~0)
2753     s = format (s, "ip4-table %d ", (mp->ip4_table_index));
2754   if (mp->ip6_table_index != ~0)
2755     s = format (s, "ip6-table %d ", (mp->ip6_table_index));
2756   if (mp->is_add == 0)
2757     s = format (s, "del ");
2758
2759   FINISH;
2760 }
2761
2762 static void *
2763 vl_api_set_punt_t_print (vl_api_set_punt_t * mp, void *handle)
2764 {
2765   u8 *s;
2766
2767   s = format (0, "SCRIPT: punt ");
2768
2769   switch (mp->punt.type)
2770     {
2771     case PUNT_API_TYPE_L4:
2772       s = format (s, "%U", format_vl_api_address_family, mp->punt.punt.l4.af);
2773
2774       s = format (s, "protocol %d ", mp->punt.punt.l4.protocol);
2775
2776       if (mp->punt.punt.l4.port != (u16) ~ 0)
2777         s = format (s, "port %d ", (mp->punt.punt.l4.port));
2778       break;
2779     default:
2780       break;
2781
2782     }
2783
2784   if (!mp->is_add)
2785     s = format (s, "del ");
2786
2787   FINISH;
2788 }
2789
2790 static void *vl_api_flow_classify_dump_t_print
2791   (vl_api_flow_classify_dump_t * mp, void *handle)
2792 {
2793   u8 *s;
2794
2795   s = format (0, "SCRIPT: flow_classify_dump ");
2796   switch (mp->type)
2797     {
2798     case FLOW_CLASSIFY_API_TABLE_IP4:
2799       s = format (s, "type ip4 ");
2800       break;
2801     case FLOW_CLASSIFY_API_TABLE_IP6:
2802       s = format (s, "type ip6 ");
2803       break;
2804     default:
2805       break;
2806     }
2807
2808   FINISH;
2809 }
2810
2811 static void *vl_api_get_first_msg_id_t_print
2812   (vl_api_get_first_msg_id_t * mp, void *handle)
2813 {
2814   u8 *s;
2815
2816   s = format (0, "SCRIPT: get_first_msg_id %s ", mp->name);
2817
2818   FINISH;
2819 }
2820
2821 static void *vl_api_ioam_enable_t_print
2822   (vl_api_ioam_enable_t * mp, void *handle)
2823 {
2824   u8 *s;
2825
2826   s = format (0, "SCRIPT: ioam_enable ");
2827
2828   if (mp->trace_enable)
2829     s = format (s, "trace enabled");
2830
2831   if (mp->pot_enable)
2832     s = format (s, "POT enabled");
2833
2834   if (mp->seqno)
2835     s = format (s, "Seqno enabled");
2836
2837   if (mp->analyse)
2838     s = format (s, "Analyse enabled");
2839
2840   FINISH;
2841 }
2842
2843 static void *vl_api_ioam_disable_t_print
2844   (vl_api_ioam_disable_t * mp, void *handle)
2845 {
2846   u8 *s;
2847
2848   s = format (0, "SCRIPT: ioam_disable ");
2849   s = format (s, "trace disabled");
2850   s = format (s, "POT disabled");
2851   s = format (s, "Seqno disabled");
2852   s = format (s, "Analyse disabled");
2853
2854   FINISH;
2855 }
2856
2857 static void *vl_api_feature_enable_disable_t_print
2858   (vl_api_feature_enable_disable_t * mp, void *handle)
2859 {
2860   u8 *s;
2861
2862   s = format (0, "SCRIPT: feature_enable_disable ");
2863   s = format (s, "arc_name %s ", mp->arc_name);
2864   s = format (s, "feature_name %s ", mp->feature_name);
2865   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2866   if (!mp->enable)
2867     s = format (s, "disable");
2868
2869   FINISH;
2870 }
2871
2872 static void *vl_api_feature_gso_enable_disable_t_print
2873   (vl_api_feature_gso_enable_disable_t * mp, void *handle)
2874 {
2875   u8 *s;
2876
2877   s = format (0, "SCRIPT: feature_gso_enable_disable ");
2878   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2879   if (mp->enable_disable)
2880     s = format (s, "enable");
2881   if (!mp->enable_disable)
2882     s = format (s, "disable");
2883
2884   FINISH;
2885 }
2886
2887 static void *vl_api_sw_interface_tag_add_del_t_print
2888   (vl_api_sw_interface_tag_add_del_t * mp, void *handle)
2889 {
2890   u8 *s;
2891
2892   s = format (0, "SCRIPT: sw_interface_tag_add_del ");
2893   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2894   if (mp->is_add)
2895     s = format (s, "tag %s ", mp->tag);
2896   else
2897     s = format (s, "del ");
2898
2899   FINISH;
2900 }
2901
2902 static void *vl_api_hw_interface_set_mtu_t_print
2903   (vl_api_hw_interface_set_mtu_t * mp, void *handle)
2904 {
2905   u8 *s;
2906
2907   s = format (0, "SCRIPT: sw_interface_set_mtu ");
2908   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2909   s = format (s, "tag %d ", (mp->mtu));
2910
2911   FINISH;
2912 }
2913
2914 static void *vl_api_p2p_ethernet_add_t_print
2915   (vl_api_p2p_ethernet_add_t * mp, void *handle)
2916 {
2917   u8 *s;
2918
2919   s = format (0, "SCRIPT: p2p_ethernet_add ");
2920   s = format (s, "sw_if_index %d ", (mp->parent_if_index));
2921   s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
2922
2923   FINISH;
2924 }
2925
2926 static void *vl_api_p2p_ethernet_del_t_print
2927   (vl_api_p2p_ethernet_del_t * mp, void *handle)
2928 {
2929   u8 *s;
2930
2931   s = format (0, "SCRIPT: p2p_ethernet_del ");
2932   s = format (s, "sw_if_index %d ", (mp->parent_if_index));
2933   s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
2934
2935   FINISH;
2936 }
2937
2938 static void *vl_api_tcp_configure_src_addresses_t_print
2939   (vl_api_tcp_configure_src_addresses_t * mp, void *handle)
2940 {
2941   u8 *s;
2942
2943   s = format (0, "SCRIPT: tcp_configure_src_addresses ");
2944   s = format (s, "%U - %U ",
2945               format_vl_api_address, &mp->first_address,
2946               format_vl_api_address, &mp->last_address);
2947
2948   if (mp->vrf_id)
2949     s = format (s, "vrf %d ", (mp->vrf_id));
2950
2951   FINISH;
2952 }
2953
2954 static void *vl_api_app_namespace_add_del_t_print
2955   (vl_api_app_namespace_add_del_t * mp, void *handle)
2956 {
2957   u8 *s;
2958
2959   s = format (0, "SCRIPT: app_namespace_add_del ");
2960   s = format (s, "ns-id %s secret %lu sw_if_index %d ipv4_fib_id %d "
2961               "ipv6_fib_id %d",
2962               vl_api_from_api_to_new_c_string (&mp->namespace_id),
2963               mp->secret, (mp->sw_if_index), (mp->ip4_fib_id),
2964               (mp->ip6_fib_id));
2965   FINISH;
2966 }
2967
2968 static void *vl_api_session_rule_add_del_t_print
2969   (vl_api_session_rule_add_del_t * mp, void *handle)
2970 {
2971   u8 *s;
2972   fib_prefix_t lcl, rmt;
2973   char *proto = mp->transport_proto == 0 ? "tcp" : "udp";
2974   s = format (0, "SCRIPT: session_rule_add_del ");
2975   mp->tag[sizeof (mp->tag) - 1] = 0;
2976   ip_prefix_decode (&mp->lcl, &lcl);
2977   ip_prefix_decode (&mp->rmt, &rmt);
2978
2979   if (lcl.fp_proto == FIB_PROTOCOL_IP4)
2980     s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s",
2981                 mp->appns_index, mp->scope, proto, format_ip4_address,
2982                 &lcl.fp_addr.ip4, lcl.fp_len,
2983                 format_ip4_address, &rmt.fp_addr.ip4,
2984                 rmt.fp_len, mp->action_index, mp->tag);
2985   else
2986     s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s",
2987                 mp->appns_index, mp->scope, proto, format_ip6_address,
2988                 &lcl.fp_addr.ip6, lcl.fp_len,
2989                 format_ip6_address, &rmt.fp_addr.ip6,
2990                 rmt.fp_len, mp->action_index, mp->tag);
2991   FINISH;
2992 }
2993
2994 __clib_unused
2995   static void *vl_api_ip_container_proxy_add_del_t_print
2996   (vl_api_ip_container_proxy_add_del_t * mp, void *handle)
2997 {
2998   u8 *s;
2999   s = format (0, "SCRIPT: ip_container_proxy_add_del ");
3000   s = format (s, "is_add %d prefix %U sw_if_index %d",
3001               mp->is_add, format_vl_api_prefix, mp->sw_if_index);
3002
3003   FINISH;
3004 }
3005
3006 static void *vl_api_qos_record_enable_disable_t_print
3007   (vl_api_qos_record_enable_disable_t * mp, void *handle)
3008 {
3009   u8 *s;
3010
3011   s = format (0, "SCRIPT: qos_record_enable_disable ");
3012   s = format (s, "sw_if_index %d ", (mp->record.sw_if_index));
3013   s = format (s, "input_source %U ", format_qos_source,
3014               mp->record.input_source);
3015
3016   if (!mp->enable)
3017     s = format (s, "disable ");
3018
3019   FINISH;
3020 }
3021
3022 #define foreach_no_print_function               \
3023 _(memclnt_keepalive_reply)
3024
3025 #define _(f)                                    \
3026 static void * vl_api_ ## f ## _t_print          \
3027   (vl_api_ ## f ## _t * mp, void * handle)      \
3028 {                                               \
3029   return handle;                                \
3030 }
3031 foreach_no_print_function;
3032 #undef _
3033
3034 #define foreach_custom_print_function                                   \
3035 _(CREATE_LOOPBACK, create_loopback)                                     \
3036 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance)                   \
3037 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags)                       \
3038 _(SW_INTERFACE_EVENT, sw_interface_event)                               \
3039 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address)           \
3040 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table)                       \
3041 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable)           \
3042 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath)                       \
3043 _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass)         \
3044 _(BOND_CREATE, bond_create)                                             \
3045 _(BOND_CREATE2, bond_create2)                                           \
3046 _(BOND_DELETE, bond_delete)                                             \
3047 _(BOND_ADD_MEMBER, bond_add_member)                                     \
3048 _(BOND_DETACH_MEMBER, bond_detach_member)                               \
3049 _(SW_INTERFACE_SET_BOND_WEIGHT, sw_interface_set_bond_weight)           \
3050 _(SW_MEMBER_INTERFACE_DUMP, sw_member_interface_dump)                   \
3051 _(SW_BOND_INTERFACE_DUMP, sw_bond_interface_dump)                       \
3052 _(SW_INTERFACE_RX_PLACEMENT_DUMP, sw_interface_rx_placement_dump)       \
3053 _(TAP_CREATE_V2, tap_create_v2)                                         \
3054 _(TAP_DELETE_V2, tap_delete_v2)                                         \
3055 _(SW_INTERFACE_TAP_V2_DUMP, sw_interface_tap_v2_dump)                   \
3056 _(IP_TABLE_ADD_DEL, ip_table_add_del)                                   \
3057 _(MPLS_ROUTE_ADD_DEL, mpls_route_add_del)                               \
3058 _(MPLS_TABLE_ADD_DEL, mpls_table_add_del)                               \
3059 _(IP_ROUTE_ADD_DEL, ip_route_add_del)                                   \
3060 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del)                             \
3061 _(SR_MPLS_POLICY_ADD, sr_mpls_policy_add)                               \
3062 _(SR_MPLS_POLICY_DEL, sr_mpls_policy_del)                               \
3063 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered)             \
3064 _(CREATE_VLAN_SUBIF, create_vlan_subif)                                 \
3065 _(CREATE_SUBIF, create_subif)                                           \
3066 _(IP_TABLE_REPLACE_BEGIN, ip_table_replace_begin)                       \
3067 _(IP_TABLE_FLUSH, ip_table_flush)                                       \
3068 _(IP_TABLE_REPLACE_END, ip_table_replace_end)                           \
3069 _(SET_IP_FLOW_HASH, set_ip_flow_hash)                                   \
3070 _(L2_PATCH_ADD_DEL, l2_patch_add_del)                                   \
3071 _(SR_LOCALSID_ADD_DEL, sr_localsid_add_del)                             \
3072 _(SR_STEERING_ADD_DEL, sr_steering_add_del)                             \
3073 _(SR_POLICY_ADD, sr_policy_add)                                         \
3074 _(SR_POLICY_MOD, sr_policy_mod)                                         \
3075 _(SR_POLICY_DEL, sr_policy_del)                                         \
3076 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect)           \
3077 _(L2FIB_ADD_DEL, l2fib_add_del)                                         \
3078 _(L2FIB_FLUSH_ALL, l2fib_flush_all)                                     \
3079 _(L2FIB_FLUSH_BD, l2fib_flush_bd)                                       \
3080 _(L2FIB_FLUSH_INT, l2fib_flush_int)                                     \
3081 _(L2_FLAGS, l2_flags)                                                   \
3082 _(BRIDGE_FLAGS, bridge_flags)                                           \
3083 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table)                       \
3084 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session)                   \
3085 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge)               \
3086 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del)                         \
3087 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump)                               \
3088 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age)                 \
3089 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table)     \
3090 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables)   \
3091 _(ADD_NODE_NEXT, add_node_next)                                         \
3092 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel)                           \
3093 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump)                                 \
3094 _(VXLAN_OFFLOAD_RX, vxlan_offload_rx)                                   \
3095 _(GRE_TUNNEL_ADD_DEL, gre_tunnel_add_del)                               \
3096 _(GRE_TUNNEL_DUMP, gre_tunnel_dump)                                     \
3097 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table)                               \
3098 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter)                     \
3099 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite)         \
3100 _(CREATE_VHOST_USER_IF, create_vhost_user_if)                           \
3101 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if)                           \
3102 _(DELETE_VHOST_USER_IF, delete_vhost_user_if)                           \
3103 _(SW_INTERFACE_DUMP, sw_interface_dump)                                 \
3104 _(CONTROL_PING, control_ping)                                           \
3105 _(WANT_INTERFACE_EVENTS, want_interface_events)                         \
3106 _(CLI, cli)                                                             \
3107 _(CLI_INBAND, cli_inband)                                               \
3108 _(MEMCLNT_CREATE, memclnt_create)                                       \
3109 _(SOCKCLNT_CREATE, sockclnt_create)                                     \
3110 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump)           \
3111 _(SHOW_VERSION, show_version)                                           \
3112 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump)                                 \
3113 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel)                   \
3114 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump)                         \
3115 _(VXLAN_GBP_TUNNEL_ADD_DEL, vxlan_gbp_tunnel_add_del)                   \
3116 _(VXLAN_GBP_TUNNEL_DUMP, vxlan_gbp_tunnel_dump)                         \
3117 _(SW_INTERFACE_SET_VXLAN_GBP_BYPASS, sw_interface_set_vxlan_gbp_bypass) \
3118 _(INTERFACE_NAME_RENUMBER, interface_name_renumber)                     \
3119 _(WANT_L2_MACS_EVENTS, want_l2_macs_events)                             \
3120 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface)                     \
3121 _(IP_ADDRESS_DUMP, ip_address_dump)                                     \
3122 _(IP_DUMP, ip_dump)                                                     \
3123 _(DELETE_LOOPBACK, delete_loopback)                                     \
3124 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del)                                 \
3125 _(BD_IP_MAC_FLUSH, bd_ip_mac_flush)                                     \
3126 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable)           \
3127 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable)           \
3128 _(AF_PACKET_CREATE, af_packet_create)                                   \
3129 _(AF_PACKET_DELETE, af_packet_delete)                                   \
3130 _(AF_PACKET_DUMP, af_packet_dump)                                       \
3131 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats)                   \
3132 _(MPLS_TABLE_DUMP, mpls_table_dump)                                     \
3133 _(MPLS_ROUTE_DUMP, mpls_route_dump)                                     \
3134 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump)                                   \
3135 _(CLASSIFY_TABLE_IDS,classify_table_ids)                                \
3136 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface)             \
3137 _(CLASSIFY_TABLE_INFO,classify_table_info)                              \
3138 _(CLASSIFY_SESSION_DUMP,classify_session_dump)                          \
3139 _(SET_IPFIX_EXPORTER, set_ipfix_exporter)                               \
3140 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump)                             \
3141 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream)                 \
3142 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump)               \
3143 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del)           \
3144 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump)                 \
3145 _(SW_INTERFACE_SPAN_ENABLE_DISABLE, sw_interface_span_enable_disable)   \
3146 _(SW_INTERFACE_SPAN_DUMP, sw_interface_span_dump)                       \
3147 _(GET_NEXT_INDEX, get_next_index)                                       \
3148 _(PG_CREATE_INTERFACE,pg_create_interface)                              \
3149 _(PG_CAPTURE, pg_capture)                                               \
3150 _(PG_ENABLE_DISABLE, pg_enable_disable)                                 \
3151 _(PG_INTERFACE_ENABLE_DISABLE_COALESCE, pg_interface_enable_disable_coalesce) \
3152 _(POLICER_ADD_DEL, policer_add_del)                                     \
3153 _(POLICER_DUMP, policer_dump)                                           \
3154 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface)       \
3155 _(POLICER_CLASSIFY_DUMP, policer_classify_dump)                         \
3156 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL,                               \
3157   ip_source_and_port_range_check_add_del)                               \
3158 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL,                     \
3159   ip_source_and_port_range_check_interface_add_del)                     \
3160 _(IPSEC_INTERFACE_ADD_DEL_SPD, ipsec_interface_add_del_spd)             \
3161 _(IPSEC_SAD_ENTRY_ADD_DEL, ipsec_sad_entry_add_del)                     \
3162 _(IPSEC_SPD_ADD_DEL, ipsec_spd_add_del)                                 \
3163 _(IPSEC_SPD_ENTRY_ADD_DEL, ipsec_spd_entry_add_del)                     \
3164 _(IPSEC_TUNNEL_IF_ADD_DEL, ipsec_tunnel_if_add_del)                     \
3165 _(DELETE_SUBIF, delete_subif)                                           \
3166 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite)           \
3167 _(SET_PUNT, set_punt)                                                   \
3168 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface)             \
3169 _(FLOW_CLASSIFY_DUMP, flow_classify_dump)                               \
3170 _(GET_FIRST_MSG_ID, get_first_msg_id)                                   \
3171 _(IOAM_ENABLE, ioam_enable)                                             \
3172 _(IOAM_DISABLE, ioam_disable)                                           \
3173 _(IP_TABLE_DUMP, ip_table_dump)                                         \
3174 _(IP_ROUTE_DUMP, ip_route_dump)                                         \
3175 _(FEATURE_ENABLE_DISABLE, feature_enable_disable)                       \
3176 _(FEATURE_GSO_ENABLE_DISABLE, feature_gso_enable_disable)               \
3177 _(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del)                   \
3178 _(HW_INTERFACE_SET_MTU, hw_interface_set_mtu)                           \
3179 _(P2P_ETHERNET_ADD, p2p_ethernet_add)                                   \
3180 _(P2P_ETHERNET_DEL, p2p_ethernet_del)                                   \
3181 _(TCP_CONFIGURE_SRC_ADDRESSES, tcp_configure_src_addresses)             \
3182 _(APP_NAMESPACE_ADD_DEL, app_namespace_add_del)                         \
3183 _(SESSION_RULE_ADD_DEL, session_rule_add_del)                           \
3184 _(OUTPUT_ACL_SET_INTERFACE, output_acl_set_interface)                   \
3185 _(QOS_RECORD_ENABLE_DISABLE, qos_record_enable_disable)                 \
3186 _(MEMCLNT_KEEPALIVE_REPLY, memclnt_keepalive_reply)
3187
3188 void
3189 vl_msg_api_custom_dump_configure (api_main_t * am)
3190 {
3191 #define _(n,f) am->msg_print_handlers[VL_API_##n]       \
3192     = (void *) vl_api_##f##_t_print;
3193   foreach_custom_print_function;
3194 #undef _
3195 }
3196
3197 /*
3198  * fd.io coding-style-patch-verification: ON
3199  *
3200  * Local Variables:
3201  * eval: (c-set-style "gnu")
3202  * End:
3203  */