BD ARP entry use common API types
[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/ip_neighbor.h>
23 #include <vnet/unix/tuntap.h>
24 #include <vnet/mpls/mpls.h>
25 #include <vnet/dhcp/dhcp_proxy.h>
26 #include <vnet/l2tp/l2tp.h>
27 #include <vnet/l2/l2_input.h>
28 #include <vnet/srv6/sr.h>
29 #include <vnet/srmpls/sr_mpls.h>
30 #include <vnet/gre/gre.h>
31 #include <vnet/vxlan-gpe/vxlan_gpe.h>
32 #include <vnet/geneve/geneve.h>
33 #include <vnet/classify/policer_classify.h>
34 #include <vnet/policer/xlate.h>
35 #include <vnet/policer/policer.h>
36 #include <vnet/classify/flow_classify.h>
37 #include <vlib/vlib.h>
38 #include <vlib/unix/unix.h>
39 #include <vlibapi/api.h>
40 #include <vlibmemory/api.h>
41 #include <vnet/lisp-cp/lisp_types.h>
42 #include <vnet/qos/qos_types.h>
43 #include <vpp/oam/oam.h>
44
45 #include <vnet/ethernet/ethernet.h>
46 #include <vnet/l2/l2_vtr.h>
47
48 #include <vpp/api/vpe_msg_enum.h>
49 #include <vpp/api/types.h>
50
51 #include <vnet/bonding/node.h>
52
53 #define vl_typedefs             /* define message structures */
54 #include <vpp/api/vpe_all_api_h.h>
55 #undef vl_typedefs
56
57 #define vl_endianfun            /* define message structures */
58 #include <vpp/api/vpe_all_api_h.h>
59 #undef vl_endianfun
60
61 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
62
63 #define FINISH                                  \
64     vec_add1 (s, 0);                            \
65     vl_print (handle, (char *)s);               \
66     vec_free (s);                               \
67     return handle;
68
69
70 static void *vl_api_create_loopback_t_print
71   (vl_api_create_loopback_t * mp, void *handle)
72 {
73   u8 *s;
74
75   s = format (0, "SCRIPT: create_loopback ");
76   s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
77
78   FINISH;
79 }
80
81 static void *vl_api_create_loopback_instance_t_print
82   (vl_api_create_loopback_instance_t * mp, void *handle)
83 {
84   u8 *s;
85
86   s = format (0, "SCRIPT: create_loopback ");
87   s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
88   s = format (s, "instance %d ", ntohl (mp->user_instance));
89
90   FINISH;
91 }
92
93 static void *vl_api_delete_loopback_t_print
94   (vl_api_delete_loopback_t * mp, void *handle)
95 {
96   u8 *s;
97
98   s = format (0, "SCRIPT: delete_loopback ");
99   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
100
101   FINISH;
102 }
103
104 static void *vl_api_sw_interface_set_flags_t_print
105   (vl_api_sw_interface_set_flags_t * mp, void *handle)
106 {
107   u8 *s;
108   s = format (0, "SCRIPT: sw_interface_set_flags ");
109
110   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
111
112   if (mp->admin_up_down)
113     s = format (s, "admin-up ");
114   else
115     s = format (s, "admin-down ");
116
117   FINISH;
118 }
119
120 static void *vl_api_sw_interface_set_rx_placement_t_print
121   (vl_api_sw_interface_set_rx_placement_t * mp, void *handle)
122 {
123   u8 *s;
124   s = format (0, "SCRIPT: sw_interface_set_rx_placement ");
125
126   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
127
128   s = format (s, "queue %d ", ntohl (mp->queue_id));
129   if (mp->is_main)
130     s = format (s, "main ");
131   else
132     s = format (s, "worker %d ", ntohl (mp->worker_id));
133
134   FINISH;
135 }
136
137 static void *vl_api_sw_interface_rx_placement_dump_t_print
138   (vl_api_sw_interface_rx_placement_dump_t * mp, void *handle)
139 {
140   u8 *s;
141   u32 sw_if_index = ntohl (mp->sw_if_index);
142
143   s = format (0, "SCRIPT: sw_interface_rx_placement_dump ");
144
145   if (sw_if_index != ~0)
146     s = format (s, "sw_if_index %d ", sw_if_index);
147
148   FINISH;
149 }
150
151 static void *vl_api_sw_interface_event_t_print
152   (vl_api_sw_interface_event_t * mp, void *handle)
153 {
154   u8 *s;
155   s = format (0, "SCRIPT: sw_interface_event ");
156
157   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
158
159   if (mp->admin_up_down)
160     s = format (s, "admin-up ");
161   else
162     s = format (s, "admin-down ");
163
164   if (mp->link_up_down)
165     s = format (s, "link-up");
166   else
167     s = format (s, "link-down");
168
169   if (mp->deleted)
170     s = format (s, " deleted");
171
172   FINISH;
173 }
174
175 static void *vl_api_sw_interface_add_del_address_t_print
176   (vl_api_sw_interface_add_del_address_t * mp, void *handle)
177 {
178   u8 *s;
179
180   s = format (0, "SCRIPT: sw_interface_add_del_address ");
181
182   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
183
184   if (mp->is_ipv6)
185     s = format (s, "%U/%d ", format_ip6_address,
186                 (ip6_address_t *) mp->address, mp->address_length);
187   else
188     s = format (s, "%U/%d ", format_ip4_address,
189                 (ip4_address_t *) mp->address, mp->address_length);
190
191   if (mp->is_add == 0)
192     s = format (s, "del ");
193   if (mp->del_all)
194     s = format (s, "del-all ");
195
196   FINISH;
197 }
198
199 static void *vl_api_sw_interface_set_table_t_print
200   (vl_api_sw_interface_set_table_t * mp, void *handle)
201 {
202   u8 *s;
203
204   s = format (0, "SCRIPT: sw_interface_set_table ");
205
206   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
207
208   if (mp->vrf_id)
209     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
210
211   if (mp->is_ipv6)
212     s = format (s, "ipv6 ");
213
214   FINISH;
215 }
216
217 static void *vl_api_sw_interface_set_mpls_enable_t_print
218   (vl_api_sw_interface_set_mpls_enable_t * mp, void *handle)
219 {
220   u8 *s;
221
222   s = format (0, "SCRIPT: sw_interface_set_mpls_enable ");
223
224   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
225
226   if (mp->enable == 0)
227     s = format (s, "disable");
228
229   FINISH;
230 }
231
232 static void *vl_api_sw_interface_set_vpath_t_print
233   (vl_api_sw_interface_set_vpath_t * mp, void *handle)
234 {
235   u8 *s;
236
237   s = format (0, "SCRIPT: sw_interface_set_vpath ");
238
239   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
240
241   if (mp->enable)
242     s = format (s, "enable ");
243   else
244     s = format (s, "disable ");
245
246   FINISH;
247 }
248
249 static void *vl_api_sw_interface_set_vxlan_bypass_t_print
250   (vl_api_sw_interface_set_vxlan_bypass_t * mp, void *handle)
251 {
252   u8 *s;
253
254   s = format (0, "SCRIPT: sw_interface_set_vxlan_bypass ");
255
256   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
257
258   if (mp->is_ipv6)
259     s = format (s, "ip6 ");
260
261   if (mp->enable)
262     s = format (s, "enable ");
263   else
264     s = format (s, "disable ");
265
266   FINISH;
267 }
268
269 static void *vl_api_sw_interface_set_geneve_bypass_t_print
270   (vl_api_sw_interface_set_geneve_bypass_t * mp, void *handle)
271 {
272   u8 *s;
273
274   s = format (0, "SCRIPT: sw_interface_set_geneve_bypass ");
275
276   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
277
278   if (mp->is_ipv6)
279     s = format (s, "ip6 ");
280
281   if (mp->enable)
282     s = format (s, "enable ");
283   else
284     s = format (s, "disable ");
285
286   FINISH;
287 }
288
289 static void *vl_api_sw_interface_set_l2_xconnect_t_print
290   (vl_api_sw_interface_set_l2_xconnect_t * mp, void *handle)
291 {
292   u8 *s;
293
294   s = format (0, "SCRIPT: sw_interface_set_l2_xconnect ");
295
296   s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
297
298   if (mp->enable)
299     {
300       s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
301     }
302   else
303     s = format (s, "delete ");
304
305   FINISH;
306 }
307
308 static void *vl_api_sw_interface_set_l2_bridge_t_print
309   (vl_api_sw_interface_set_l2_bridge_t * mp, void *handle)
310 {
311   u8 *s;
312
313   s = format (0, "SCRIPT: sw_interface_set_l2_bridge ");
314
315   s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
316
317   if (mp->enable)
318     {
319       s = format (s, "bd_id %d shg %d ", ntohl (mp->bd_id), mp->shg);
320       if (L2_API_PORT_TYPE_BVI == ntohl (mp->port_type))
321         s = format (s, "bvi ");
322       if (L2_API_PORT_TYPE_UU_FWD == ntohl (mp->port_type))
323         s = format (s, "uu-fwd ");
324       s = format (s, "enable");
325     }
326   else
327     s = format (s, "disable ");
328
329   FINISH;
330 }
331
332 static void *vl_api_bridge_domain_add_del_t_print
333   (vl_api_bridge_domain_add_del_t * mp, void *handle)
334 {
335   u8 *s;
336
337   s = format (0, "SCRIPT: bridge_domain_add_del ");
338
339   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
340
341   if (mp->is_add)
342     {
343       if (mp->bd_tag[0])
344         s = format (s, "bd_tag %s ", mp->bd_tag);
345       s = format (s, "flood %d uu-flood %d ", mp->flood, mp->uu_flood);
346       s = format (s, "forward %d learn %d ", mp->forward, mp->learn);
347       s = format (s, "arp-term %d mac-age %d", mp->arp_term, mp->mac_age);
348     }
349   else
350     s = format (s, "del ");
351
352   FINISH;
353 }
354
355 static void *vl_api_bridge_domain_set_mac_age_t_print
356   (vl_api_bridge_domain_set_mac_age_t * mp, void *handle)
357 {
358   u8 *s;
359
360   s = format (0, "SCRIPT: bridge_domain_set_mac_age ");
361
362   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
363
364   s = format (s, "mac-age %d", mp->mac_age);
365
366   FINISH;
367 }
368
369 static void *vl_api_bridge_domain_dump_t_print
370   (vl_api_bridge_domain_dump_t * mp, void *handle)
371 {
372   u8 *s;
373   u32 bd_id = ntohl (mp->bd_id);
374
375   s = format (0, "SCRIPT: bridge_domain_dump ");
376
377   if (bd_id != ~0)
378     s = format (s, "bd_id %d ", bd_id);
379
380   FINISH;
381 }
382
383 static void *vl_api_l2fib_flush_all_t_print
384   (vl_api_l2fib_flush_all_t * mp, void *handle)
385 {
386   u8 *s;
387
388   s = format (0, "SCRIPT: l2fib_flush_all ");
389
390   FINISH;
391 }
392
393
394 static void *vl_api_l2fib_flush_bd_t_print
395   (vl_api_l2fib_flush_bd_t * mp, void *handle)
396 {
397   u8 *s;
398   u32 bd_id = ntohl (mp->bd_id);
399
400   s = format (0, "SCRIPT: l2fib_flush_bd ");
401   s = format (s, "bd_id %d ", bd_id);
402
403   FINISH;
404 }
405
406 static void *vl_api_l2fib_flush_int_t_print
407   (vl_api_l2fib_flush_int_t * mp, void *handle)
408 {
409   u8 *s;
410   u32 sw_if_index = ntohl (mp->sw_if_index);
411
412   s = format (0, "SCRIPT: l2fib_flush_int ");
413   s = format (s, "sw_if_index %d ", sw_if_index);
414
415   FINISH;
416 }
417
418 static void *vl_api_l2fib_add_del_t_print
419   (vl_api_l2fib_add_del_t * mp, void *handle)
420 {
421   u8 *s;
422
423   s = format (0, "SCRIPT: l2fib_add_del ");
424
425   s = format (s, "mac %U ", format_ethernet_address, mp->mac);
426
427   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
428
429
430   if (mp->is_add)
431     {
432       s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
433       if (mp->static_mac)
434         s = format (s, "%s", "static ");
435       if (mp->filter_mac)
436         s = format (s, "%s", "filter ");
437       if (mp->bvi_mac)
438         s = format (s, "%s", "bvi ");
439     }
440   else
441     {
442       s = format (s, "del ");
443     }
444
445   FINISH;
446 }
447
448 static void *
449 vl_api_l2_flags_t_print (vl_api_l2_flags_t * mp, void *handle)
450 {
451   u8 *s;
452   u32 flags = ntohl (mp->feature_bitmap);
453
454   s = format (0, "SCRIPT: l2_flags ");
455
456   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
457
458   if (flags & L2_LEARN)
459     s = format (s, "learn ");
460   if (flags & L2_FWD)
461     s = format (s, "forward ");
462   if (flags & L2_FLOOD)
463     s = format (s, "flood ");
464   if (flags & L2_UU_FLOOD)
465     s = format (s, "uu-flood ");
466   if (flags & L2_ARP_TERM)
467     s = format (s, "arp-term ");
468
469   if (mp->is_set == 0)
470     s = format (s, "clear ");
471
472   FINISH;
473 }
474
475 static void *vl_api_bridge_flags_t_print
476   (vl_api_bridge_flags_t * mp, void *handle)
477 {
478   u8 *s;
479   u32 flags = ntohl (mp->flags);
480
481   s = format (0, "SCRIPT: bridge_flags ");
482
483   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
484
485   if (flags & BRIDGE_API_FLAG_LEARN)
486     s = format (s, "learn ");
487   if (flags & BRIDGE_API_FLAG_FWD)
488     s = format (s, "forward ");
489   if (flags & BRIDGE_API_FLAG_FLOOD)
490     s = format (s, "flood ");
491   if (flags & BRIDGE_API_FLAG_UU_FLOOD)
492     s = format (s, "uu-flood ");
493   if (flags & BRIDGE_API_FLAG_ARP_TERM)
494     s = format (s, "arp-term ");
495
496   if (mp->is_set == 0)
497     s = format (s, "clear ");
498
499   FINISH;
500 }
501
502 static void *vl_api_bd_ip_mac_add_del_t_print
503   (vl_api_bd_ip_mac_add_del_t * mp, void *handle)
504 {
505   u8 *s;
506
507   s = format (0, "SCRIPT: bd_ip_mac_add_del ");
508   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
509
510   s = format (s, "%U ", format_vl_api_address, &mp->ip);
511   s = format (s, "%U ", format_vl_api_mac_address, &mp->mac);
512   if (mp->is_add == 0)
513     s = format (s, "del ");
514
515   FINISH;
516 }
517
518 static void *vl_api_bd_ip_mac_dump_t_print
519   (vl_api_bd_ip_mac_dump_t * mp, void *handle)
520 {
521   u8 *s;
522
523   s = format (0, "SCRIPT: bd_ip_mac_dump ");
524
525   FINISH;
526 }
527
528 static void *vl_api_tap_connect_t_print
529   (vl_api_tap_connect_t * mp, void *handle)
530 {
531   u8 *s;
532   u8 null_mac[6];
533
534   clib_memset (null_mac, 0, sizeof (null_mac));
535
536   s = format (0, "SCRIPT: tap_connect ");
537   s = format (s, "tapname %s ", mp->tap_name);
538   if (mp->use_random_mac)
539     s = format (s, "random-mac ");
540   if (mp->tag[0])
541     s = format (s, "tag %s ", mp->tag);
542   if (memcmp (mp->mac_address, null_mac, 6))
543     s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
544   if (mp->ip4_address_set)
545     s = format (s, "address %U/%d ", format_ip4_address, mp->ip4_address,
546                 mp->ip4_mask_width);
547   if (mp->ip6_address_set)
548     s = format (s, "address %U/%d ", format_ip6_address, mp->ip6_address,
549                 mp->ip6_mask_width);
550   FINISH;
551 }
552
553 static void *vl_api_tap_modify_t_print
554   (vl_api_tap_modify_t * mp, void *handle)
555 {
556   u8 *s;
557   u8 null_mac[6];
558
559   clib_memset (null_mac, 0, sizeof (null_mac));
560
561   s = format (0, "SCRIPT: tap_modify ");
562   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
563   s = format (s, "tapname %s ", mp->tap_name);
564   if (mp->use_random_mac)
565     s = format (s, "random-mac ");
566
567   if (memcmp (mp->mac_address, null_mac, 6))
568     s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
569
570   FINISH;
571 }
572
573 static void *vl_api_tap_delete_t_print
574   (vl_api_tap_delete_t * mp, void *handle)
575 {
576   u8 *s;
577
578   s = format (0, "SCRIPT: tap_delete ");
579   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
580
581   FINISH;
582 }
583
584 static void *vl_api_sw_interface_tap_dump_t_print
585   (vl_api_sw_interface_tap_dump_t * mp, void *handle)
586 {
587   u8 *s;
588
589   s = format (0, "SCRIPT: sw_interface_tap_dump ");
590
591   FINISH;
592 }
593
594 static void *vl_api_tap_create_v2_t_print
595   (vl_api_tap_create_v2_t * mp, void *handle)
596 {
597   u8 *s;
598   u8 null_mac[6];
599
600   clib_memset (null_mac, 0, sizeof (null_mac));
601
602   s = format (0, "SCRIPT: tap_create_v2 ");
603   s = format (s, "id %u ", ntohl (mp->id));
604   if (memcmp (mp->mac_address, null_mac, 6))
605     s = format (s, "mac-address %U ",
606                 format_ethernet_address, mp->mac_address);
607   if (memcmp (mp->host_mac_addr, null_mac, 6))
608     s = format (s, "host-mac-addr %U ",
609                 format_ethernet_address, mp->host_mac_addr);
610   if (mp->host_if_name_set)
611     s = format (s, "host-if-name %s ", mp->host_if_name);
612   if (mp->host_namespace_set)
613     s = format (s, "host-ns %s ", mp->host_namespace);
614   if (mp->host_bridge_set)
615     s = format (s, "host-bridge %s ", mp->host_bridge);
616   if (mp->host_ip4_addr_set)
617     s = format (s, "host-ip4-addr %U/%d ", format_ip4_address,
618                 mp->host_ip4_addr, mp->host_ip4_prefix_len);
619   if (mp->host_ip6_addr_set)
620     s = format (s, "host-ip6-addr %U/%d ", format_ip6_address,
621                 mp->host_ip6_addr, mp->host_ip6_prefix_len);
622   if (mp->host_ip4_gw_set)
623     s = format (s, "host-ip4-gw %U ", format_ip4_address, mp->host_ip4_addr);
624   if (mp->host_ip6_gw_set)
625     s = format (s, "host-ip6-gw %U ", format_ip6_address, mp->host_ip6_addr);
626   if (mp->tx_ring_sz)
627     s = format (s, "tx-ring-size %u ", ntohs (mp->tx_ring_sz));
628   if (mp->rx_ring_sz)
629     s = format (s, "rx-ring-size %u ", ntohs (mp->rx_ring_sz));
630   FINISH;
631 }
632
633 static void *vl_api_tap_delete_v2_t_print
634   (vl_api_tap_delete_v2_t * mp, void *handle)
635 {
636   u8 *s;
637
638   s = format (0, "SCRIPT: tap_delete_v2 ");
639   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
640
641   FINISH;
642 }
643
644 static void *vl_api_sw_interface_tap_v2_dump_t_print
645   (vl_api_sw_interface_tap_v2_dump_t * mp, void *handle)
646 {
647   u8 *s;
648
649   s = format (0, "SCRIPT: sw_interface_tap_v2_dump ");
650
651   FINISH;
652 }
653
654 static void *vl_api_bond_create_t_print
655   (vl_api_bond_create_t * mp, void *handle)
656 {
657   u8 *s;
658   u8 null_mac[6];
659
660   clib_memset (null_mac, 0, sizeof (null_mac));
661
662   s = format (0, "SCRIPT: bond_create ");
663   if (memcmp (mp->mac_address, null_mac, 6))
664     s = format (s, "mac-address %U ",
665                 format_ethernet_address, mp->mac_address);
666   if (mp->mode)
667     s = format (s, "mode %U", format_bond_mode, mp->mode);
668   if (mp->lb)
669     s = format (s, "lb %U", format_bond_load_balance, mp->lb);
670   FINISH;
671 }
672
673 static void *vl_api_bond_delete_t_print
674   (vl_api_bond_delete_t * mp, void *handle)
675 {
676   u8 *s;
677
678   s = format (0, "SCRIPT: bond_delete ");
679   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
680
681   FINISH;
682 }
683
684 static void *vl_api_bond_enslave_t_print
685   (vl_api_bond_enslave_t * mp, void *handle)
686 {
687   u8 *s;
688
689   s = format (0, "SCRIPT: bond_enslave ");
690   s = format (s, "bond_sw_if_index %u ", mp->bond_sw_if_index);
691   s = format (s, "sw_if_index %u ", mp->sw_if_index);
692   if (mp->is_passive)
693     s = format (s, "passive ");
694   if (mp->is_long_timeout)
695     s = format (s, "long-timeout ");
696
697   FINISH;
698 }
699
700 static void *vl_api_bond_detach_slave_t_print
701   (vl_api_bond_detach_slave_t * mp, void *handle)
702 {
703   u8 *s;
704
705   s = format (0, "SCRIPT: bond_detach_slave ");
706   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
707
708   FINISH;
709 }
710
711 static void *vl_api_sw_interface_bond_dump_t_print
712   (vl_api_sw_interface_bond_dump_t * mp, void *handle)
713 {
714   u8 *s;
715
716   s = format (0, "SCRIPT: sw_interface_bond_dump ");
717
718   FINISH;
719 }
720
721 static void *vl_api_sw_interface_slave_dump_t_print
722   (vl_api_sw_interface_slave_dump_t * mp, void *handle)
723 {
724   u8 *s;
725
726   s = format (0, "SCRIPT: sw_interface_slave_dump ");
727   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
728
729   FINISH;
730 }
731
732 static void *vl_api_ip_add_del_route_t_print
733   (vl_api_ip_add_del_route_t * mp, void *handle)
734 {
735   u8 *s;
736
737   s = format (0, "SCRIPT: ip_add_del_route ");
738   if (mp->is_add == 0)
739     s = format (s, "del ");
740
741   if (mp->is_ipv6)
742     s = format (s, "%U/%d ", format_ip6_address, mp->dst_address,
743                 mp->dst_address_length);
744   else
745     s = format (s, "%U/%d ", format_ip4_address, mp->dst_address,
746                 mp->dst_address_length);
747
748   if (mp->table_id != 0)
749     s = format (s, "vrf %d ", ntohl (mp->table_id));
750
751   if (mp->is_local)
752     s = format (s, "local ");
753   else if (mp->is_drop)
754     s = format (s, "drop ");
755   else if (mp->is_classify)
756     s = format (s, "classify %d", ntohl (mp->classify_table_index));
757   else if (mp->next_hop_via_label != htonl (MPLS_LABEL_INVALID))
758     s = format (s, "via via_label %d ", ntohl (mp->next_hop_via_label));
759   else
760     {
761       if (mp->is_ipv6)
762         s = format (s, "via %U ", format_ip6_address, mp->next_hop_address);
763       else
764         s = format (s, "via %U ", format_ip4_address, mp->next_hop_address);
765       if (mp->next_hop_sw_if_index != ~0)
766         s = format (s, "sw_if_index %d ", ntohl (mp->next_hop_sw_if_index));
767
768     }
769
770   if (mp->next_hop_weight != 1)
771     s = format (s, "weight %d ", (u32) mp->next_hop_weight);
772
773   if (mp->is_multipath)
774     s = format (s, "multipath ");
775
776   if (mp->next_hop_table_id)
777     s = format (s, "lookup-in-vrf %d ", ntohl (mp->next_hop_table_id));
778
779   if (mp->next_hop_n_out_labels)
780     {
781       u8 i;
782       for (i = 0; i < mp->next_hop_n_out_labels; i++)
783         {
784           s = format (s, "out-label %d ",
785                       ntohl (mp->next_hop_out_label_stack[i].label));
786         }
787     }
788
789   FINISH;
790 }
791
792 static void *vl_api_mpls_route_add_del_t_print
793   (vl_api_mpls_route_add_del_t * mp, void *handle)
794 {
795   u8 *s;
796
797   s = format (0, "SCRIPT: mpls_route_add_del ");
798
799   if (mp->mr_is_add)
800     s = format (s, "add ");
801   else
802     s = format (s, "del ");
803
804   s = format (s, "%d ", ntohl (mp->mr_label));
805
806   if (mp->mr_eos)
807     s = format (s, "eos ");
808   else
809     s = format (s, "non-eos ");
810
811
812   if (mp->mr_next_hop_proto == DPO_PROTO_IP4)
813     {
814       ip4_address_t ip4_null = {.as_u32 = 0, };
815       if (memcmp (mp->mr_next_hop, &ip4_null, sizeof (ip4_null)))
816         s = format (s, "via %U ", format_ip4_address, mp->mr_next_hop);
817       else
818         s = format (s, "via lookup-in-ip4-table %d ",
819                     ntohl (mp->mr_next_hop_table_id));
820     }
821   else if (mp->mr_next_hop_proto == DPO_PROTO_IP6)
822     {
823       ip6_address_t ip6_null = { {0}
824       };
825       if (memcmp (mp->mr_next_hop, &ip6_null, sizeof (ip6_null)))
826         s = format (s, "via %U ", format_ip6_address, mp->mr_next_hop);
827       else
828         s = format (s, "via lookup-in-ip6-table %d ",
829                     ntohl (mp->mr_next_hop_table_id));
830     }
831   else if (mp->mr_next_hop_proto == DPO_PROTO_ETHERNET)
832     {
833       s = format (s, "via l2-input-on ");
834     }
835   else if (mp->mr_next_hop_proto == DPO_PROTO_MPLS)
836     {
837       if (mp->mr_next_hop_via_label != htonl (MPLS_LABEL_INVALID))
838         s =
839           format (s, "via via-label %d ", ntohl (mp->mr_next_hop_via_label));
840       else
841         s = format (s, "via next-hop-table %d ",
842                     ntohl (mp->mr_next_hop_table_id));
843     }
844   if (mp->mr_next_hop_sw_if_index != ~0)
845     s = format (s, "sw_if_index %d ", ntohl (mp->mr_next_hop_sw_if_index));
846
847   if (mp->mr_next_hop_weight != 1)
848     s = format (s, "weight %d ", (u32) mp->mr_next_hop_weight);
849
850   if (mp->mr_is_multipath)
851     s = format (s, "multipath ");
852
853   if (mp->mr_is_classify)
854     s = format (s, "classify %d", ntohl (mp->mr_classify_table_index));
855
856   if (mp->mr_next_hop_n_out_labels)
857     {
858       u8 i;
859       for (i = 0; i < mp->mr_next_hop_n_out_labels; i++)
860         {
861           s = format (s, "out-label %d ",
862                       ntohl (mp->mr_next_hop_out_label_stack[i].label));
863         }
864     }
865
866   FINISH;
867 }
868
869 static void *vl_api_ip_table_add_del_t_print
870   (vl_api_ip_table_add_del_t * mp, void *handle)
871 {
872   u8 *s;
873
874   s = format (0, "SCRIPT: ip_table_add_del ");
875   if (mp->is_add)
876     s = format (s, "add ");
877   else
878     s = format (s, "del ");
879   if (mp->is_ipv6)
880     s = format (s, "ip6 ");
881   s = format (s, "table %d ", ntohl (mp->table_id));
882
883   FINISH;
884 }
885
886 static void *vl_api_mpls_table_add_del_t_print
887   (vl_api_mpls_table_add_del_t * mp, void *handle)
888 {
889   u8 *s;
890
891   s = format (0, "SCRIPT: mpls_table_add_del ");
892   if (mp->mt_is_add)
893     s = format (s, "add ");
894   else
895     s = format (s, "del ");
896   s = format (s, "table %d ", ntohl (mp->mt_table_id));
897
898   FINISH;
899 }
900
901 static void *vl_api_proxy_arp_add_del_t_print
902   (vl_api_proxy_arp_add_del_t * mp, void *handle)
903 {
904   u8 *s;
905
906   s = format (0, "SCRIPT: proxy_arp_add_del ");
907
908   s = format (s, "%U - %U ",
909               format_ip4_address, mp->proxy.low_address,
910               format_ip4_address, mp->proxy.hi_address);
911
912   if (mp->proxy.vrf_id)
913     s = format (s, "vrf %d ", ntohl (mp->proxy.vrf_id));
914
915   if (mp->is_add == 0)
916     s = format (s, "del ");
917
918   FINISH;
919 }
920
921 static void *vl_api_proxy_arp_intfc_enable_disable_t_print
922   (vl_api_proxy_arp_intfc_enable_disable_t * mp, void *handle)
923 {
924   u8 *s;
925
926   s = format (0, "SCRIPT: proxy_arp_intfc_enable_disable ");
927
928   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
929
930   s = format (s, "enable %d ", mp->enable_disable);
931
932   FINISH;
933 }
934
935 static void *vl_api_mpls_tunnel_add_del_t_print
936   (vl_api_mpls_tunnel_add_del_t * mp, void *handle)
937 {
938   u8 *s;
939
940   s = format (0, "SCRIPT: mpls_tunnel_add_del ");
941
942   if (mp->mt_is_add == 0)
943     s = format (s, "del sw_if_index %d ", ntohl (mp->mt_sw_if_index));
944
945   mpls_label_t label = ntohl (mp->mt_next_hop_via_label);
946   if (label != MPLS_LABEL_INVALID)
947     s = format (s, "via-label %d ", label);
948   else if (mp->mt_next_hop_proto_is_ip4)
949     s = format (s, "via %U ", format_ip4_address, mp->mt_next_hop);
950   else
951     s = format (s, "via %U ", format_ip6_address, mp->mt_next_hop);
952
953   if (mp->mt_next_hop_sw_if_index != ~0)
954     s = format (s, "sw_if_index %d ", ntohl (mp->mt_next_hop_sw_if_index));
955   else if (mp->mt_next_hop_table_id)
956     s = format (s, "next-hop-table %d ", ntohl (mp->mt_next_hop_table_id));
957
958   if (mp->mt_l2_only)
959     s = format (s, "l2-only ");
960
961   if (mp->mt_next_hop_n_out_labels)
962     {
963       u8 i;
964       for (i = 0; i < mp->mt_next_hop_n_out_labels; i++)
965         {
966           s = format (s, "out-label %d ",
967                       ntohl (mp->mt_next_hop_out_label_stack[i].label));
968         }
969     }
970
971   FINISH;
972 }
973
974 static void *vl_api_sr_mpls_policy_add_t_print
975   (vl_api_sr_mpls_policy_add_t * mp, void *handle)
976 {
977   u8 *s;
978
979   s = format (0, "SCRIPT: sr_mpls_policy_add ");
980
981   s = format (s, "bsid %d ", ntohl (mp->bsid));
982
983   if (mp->weight != htonl ((u32) 1))
984     s = format (s, "%d ", ntohl (mp->weight));
985
986   if (mp->type)
987     s = format (s, "spray ");
988
989   if (mp->n_segments)
990     {
991       int i;
992       for (i = 0; i < mp->n_segments; i++)
993         s = format (s, "next %d ", ntohl (mp->segments[i]));
994     }
995
996   FINISH;
997 }
998
999 static void *vl_api_sr_mpls_policy_del_t_print
1000   (vl_api_sr_mpls_policy_del_t * mp, void *handle)
1001 {
1002   u8 *s;
1003
1004   s = format (0, "SCRIPT: sr_mpls_policy_del ");
1005
1006   s = format (s, "bsid %d ", ntohl (mp->bsid));
1007
1008   FINISH;
1009 }
1010
1011 static void *vl_api_sw_interface_set_unnumbered_t_print
1012   (vl_api_sw_interface_set_unnumbered_t * mp, void *handle)
1013 {
1014   u8 *s;
1015
1016   s = format (0, "SCRIPT: sw_interface_set_unnumbered ");
1017
1018   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1019
1020   s = format (s, "unnum_if_index %d ", ntohl (mp->unnumbered_sw_if_index));
1021
1022   if (mp->is_add == 0)
1023     s = format (s, "del ");
1024
1025   FINISH;
1026 }
1027
1028 static void *vl_api_ip_neighbor_add_del_t_print
1029   (vl_api_ip_neighbor_add_del_t * mp, void *handle)
1030 {
1031   u8 *s;
1032   u8 null_mac[6];
1033
1034   clib_memset (null_mac, 0, sizeof (null_mac));
1035
1036   s = format (0, "SCRIPT: ip_neighbor_add_del ");
1037
1038   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1039
1040   if (mp->is_static)
1041     s = format (s, "is_static ");
1042
1043   if (mp->is_no_adj_fib)
1044     s = format (s, "is_no_fib_entry ");
1045
1046   if (memcmp (mp->mac_address, null_mac, 6))
1047     s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
1048
1049   if (mp->is_ipv6)
1050     s =
1051       format (s, "dst %U ", format_ip6_address,
1052               (ip6_address_t *) mp->dst_address);
1053   else
1054     s =
1055       format (s, "dst %U ", format_ip4_address,
1056               (ip4_address_t *) mp->dst_address);
1057
1058   if (mp->is_add == 0)
1059     s = format (s, "del ");
1060
1061   FINISH;
1062 }
1063
1064 static void *vl_api_create_vlan_subif_t_print
1065   (vl_api_create_vlan_subif_t * mp, void *handle)
1066 {
1067   u8 *s;
1068
1069   s = format (0, "SCRIPT: create_vlan_subif ");
1070
1071   if (mp->sw_if_index)
1072     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1073
1074   if (mp->vlan_id)
1075     s = format (s, "vlan_id %d ", ntohl (mp->vlan_id));
1076
1077   FINISH;
1078 }
1079
1080 #define foreach_create_subif_bit                \
1081 _(no_tags)                                      \
1082 _(one_tag)                                      \
1083 _(two_tags)                                     \
1084 _(dot1ad)                                       \
1085 _(exact_match)                                  \
1086 _(default_sub)                                  \
1087 _(outer_vlan_id_any)                            \
1088 _(inner_vlan_id_any)
1089
1090 static void *vl_api_create_subif_t_print
1091   (vl_api_create_subif_t * mp, void *handle)
1092 {
1093   u8 *s;
1094
1095   s = format (0, "SCRIPT: create_subif ");
1096
1097   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1098
1099   s = format (s, "sub_id %d ", ntohl (mp->sub_id));
1100
1101   if (mp->outer_vlan_id)
1102     s = format (s, "outer_vlan_id %d ", ntohs (mp->outer_vlan_id));
1103
1104   if (mp->inner_vlan_id)
1105     s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
1106
1107 #define _(a) if (mp->a) s = format (s, "%s ", #a);
1108   foreach_create_subif_bit;
1109 #undef _
1110
1111   FINISH;
1112 }
1113
1114 static void *vl_api_delete_subif_t_print
1115   (vl_api_delete_subif_t * mp, void *handle)
1116 {
1117   u8 *s;
1118
1119   s = format (0, "SCRIPT: delete_subif ");
1120   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1121
1122   FINISH;
1123 }
1124
1125 static void *vl_api_oam_add_del_t_print
1126   (vl_api_oam_add_del_t * mp, void *handle)
1127 {
1128   u8 *s;
1129
1130   s = format (0, "SCRIPT: oam_add_del ");
1131
1132   if (mp->vrf_id)
1133     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
1134
1135   s = format (s, "src %U ", format_ip4_address, mp->src_address);
1136
1137   s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
1138
1139   if (mp->is_add == 0)
1140     s = format (s, "del ");
1141
1142   FINISH;
1143 }
1144
1145 static void *
1146 vl_api_reset_fib_t_print (vl_api_reset_fib_t * mp, void *handle)
1147 {
1148   u8 *s;
1149
1150   s = format (0, "SCRIPT: reset_fib ");
1151
1152   if (mp->vrf_id)
1153     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
1154
1155   if (mp->is_ipv6 != 0)
1156     s = format (s, "ipv6 ");
1157
1158   FINISH;
1159 }
1160
1161 static void *vl_api_dhcp_proxy_config_t_print
1162   (vl_api_dhcp_proxy_config_t * mp, void *handle)
1163 {
1164   u8 *s;
1165
1166   s = format (0, "SCRIPT: dhcp_proxy_config_2 ");
1167
1168   s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id));
1169   s = format (s, "server_vrf_id %d ", ntohl (mp->server_vrf_id));
1170
1171   if (mp->is_ipv6)
1172     {
1173       s = format (s, "svr %U ", format_ip6_address,
1174                   (ip6_address_t *) mp->dhcp_server);
1175       s = format (s, "src %U ", format_ip6_address,
1176                   (ip6_address_t *) mp->dhcp_src_address);
1177     }
1178   else
1179     {
1180       s = format (s, "svr %U ", format_ip4_address,
1181                   (ip4_address_t *) mp->dhcp_server);
1182       s = format (s, "src %U ", format_ip4_address,
1183                   (ip4_address_t *) mp->dhcp_src_address);
1184     }
1185   if (mp->is_add == 0)
1186     s = format (s, "del ");
1187
1188   FINISH;
1189 }
1190
1191 static void *vl_api_dhcp_proxy_set_vss_t_print
1192   (vl_api_dhcp_proxy_set_vss_t * mp, void *handle)
1193 {
1194   u8 *s;
1195
1196   s = format (0, "SCRIPT: dhcp_proxy_set_vss ");
1197
1198   s = format (s, "tbl_id %d ", ntohl (mp->tbl_id));
1199
1200   if (mp->vss_type == VSS_TYPE_VPN_ID)
1201     {
1202       s = format (s, "fib_id %d ", ntohl (mp->vpn_index));
1203       s = format (s, "oui %d ", ntohl (mp->oui));
1204     }
1205   else if (mp->vss_type == VSS_TYPE_ASCII)
1206     s = format (s, "vpn_ascii_id %s", mp->vpn_ascii_id);
1207
1208   if (mp->is_ipv6 != 0)
1209     s = format (s, "ipv6 ");
1210
1211   if (mp->is_add == 0)
1212     s = format (s, "del ");
1213
1214   FINISH;
1215 }
1216
1217 static void *vl_api_dhcp_client_config_t_print
1218   (vl_api_dhcp_client_config_t * mp, void *handle)
1219 {
1220   u8 *s;
1221
1222   s = format (0, "SCRIPT: dhcp_client_config ");
1223
1224   s = format (s, "sw_if_index %d ", ntohl (mp->client.sw_if_index));
1225
1226   s = format (s, "hostname %s ", mp->client.hostname);
1227
1228   s = format (s, "want_dhcp_event %d ", mp->client.want_dhcp_event);
1229
1230   s = format (s, "pid %d ", ntohl (mp->client.pid));
1231
1232   if (mp->is_add == 0)
1233     s = format (s, "del ");
1234
1235   FINISH;
1236 }
1237
1238
1239 static void *vl_api_set_ip_flow_hash_t_print
1240   (vl_api_set_ip_flow_hash_t * mp, void *handle)
1241 {
1242   u8 *s;
1243
1244   s = format (0, "SCRIPT: set_ip_flow_hash ");
1245
1246   s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
1247
1248   if (mp->src)
1249     s = format (s, "src ");
1250
1251   if (mp->dst)
1252     s = format (s, "dst ");
1253
1254   if (mp->sport)
1255     s = format (s, "sport ");
1256
1257   if (mp->dport)
1258     s = format (s, "dport ");
1259
1260   if (mp->proto)
1261     s = format (s, "proto ");
1262
1263   if (mp->reverse)
1264     s = format (s, "reverse ");
1265
1266   if (mp->is_ipv6 != 0)
1267     s = format (s, "ipv6 ");
1268
1269   FINISH;
1270 }
1271
1272 static void *vl_api_sw_interface_ip6_set_link_local_address_t_print
1273   (vl_api_sw_interface_ip6_set_link_local_address_t * mp, void *handle)
1274 {
1275   u8 *s;
1276
1277   s = format (0, "SCRIPT: sw_interface_ip6_set_link_local_address ");
1278
1279   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1280
1281   s = format (s, "%U ", format_ip6_address, mp->address);
1282
1283   FINISH;
1284 }
1285
1286 static void *vl_api_sw_interface_ip6nd_ra_prefix_t_print
1287   (vl_api_sw_interface_ip6nd_ra_prefix_t * mp, void *handle)
1288 {
1289   u8 *s;
1290
1291   s = format (0, "SCRIPT: sw_interface_ip6nd_ra_prefix ");
1292
1293   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1294
1295   s = format (s, "%U/%d ", format_ip6_address, mp->address,
1296               mp->address_length);
1297
1298   s = format (s, "val_life %d ", ntohl (mp->val_lifetime));
1299
1300   s = format (s, "pref_life %d ", ntohl (mp->pref_lifetime));
1301
1302   if (mp->use_default)
1303     s = format (s, "def ");
1304
1305   if (mp->no_advertise)
1306     s = format (s, "noadv ");
1307
1308   if (mp->off_link)
1309     s = format (s, "offl ");
1310
1311   if (mp->no_autoconfig)
1312     s = format (s, "noauto ");
1313
1314   if (mp->no_onlink)
1315     s = format (s, "nolink ");
1316
1317   if (mp->is_no)
1318     s = format (s, "isno ");
1319
1320   FINISH;
1321 }
1322
1323 static void *vl_api_sw_interface_ip6nd_ra_config_t_print
1324   (vl_api_sw_interface_ip6nd_ra_config_t * mp, void *handle)
1325 {
1326   u8 *s;
1327
1328   s = format (0, "SCRIPT: sw_interface_ip6nd_ra_config ");
1329
1330   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1331
1332   s = format (s, "maxint %d ", ntohl (mp->max_interval));
1333
1334   s = format (s, "minint %d ", ntohl (mp->min_interval));
1335
1336   s = format (s, "life %d ", ntohl (mp->lifetime));
1337
1338   s = format (s, "count %d ", ntohl (mp->initial_count));
1339
1340   s = format (s, "interval %d ", ntohl (mp->initial_interval));
1341
1342   if (mp->suppress)
1343     s = format (s, "suppress ");
1344
1345   if (mp->managed)
1346     s = format (s, "managed ");
1347
1348   if (mp->other)
1349     s = format (s, "other ");
1350
1351   if (mp->ll_option)
1352     s = format (s, "ll ");
1353
1354   if (mp->send_unicast)
1355     s = format (s, "send ");
1356
1357   if (mp->cease)
1358     s = format (s, "cease ");
1359
1360   if (mp->is_no)
1361     s = format (s, "isno ");
1362
1363   if (mp->default_router)
1364     s = format (s, "def ");
1365
1366   FINISH;
1367 }
1368
1369 static void *vl_api_set_arp_neighbor_limit_t_print
1370   (vl_api_set_arp_neighbor_limit_t * mp, void *handle)
1371 {
1372   u8 *s;
1373
1374   s = format (0, "SCRIPT: set_arp_neighbor_limit ");
1375
1376   s = format (s, "arp_nbr_limit %d ", ntohl (mp->arp_neighbor_limit));
1377
1378   if (mp->is_ipv6 != 0)
1379     s = format (s, "ipv6 ");
1380
1381   FINISH;
1382 }
1383
1384 static void *vl_api_l2_patch_add_del_t_print
1385   (vl_api_l2_patch_add_del_t * mp, void *handle)
1386 {
1387   u8 *s;
1388
1389   s = format (0, "SCRIPT: l2_patch_add_del ");
1390
1391   s = format (s, "rx_sw_if_index %d ", ntohl (mp->rx_sw_if_index));
1392
1393   s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
1394
1395   if (mp->is_add == 0)
1396     s = format (s, "del ");
1397
1398   FINISH;
1399 }
1400
1401 static void *vl_api_sr_localsid_add_del_t_print
1402   (vl_api_sr_localsid_add_del_t * mp, void *handle)
1403 {
1404   vnet_main_t *vnm = vnet_get_main ();
1405   u8 *s;
1406
1407   s = format (0, "SCRIPT: sr_localsid_add_del ");
1408
1409   switch (mp->behavior)
1410     {
1411     case SR_BEHAVIOR_END:
1412       s = format (s, "Address: %U\nBehavior: End",
1413                   format_ip6_address, (ip6_address_t *) mp->localsid.addr);
1414       s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1415       break;
1416     case SR_BEHAVIOR_X:
1417       s =
1418         format (s,
1419                 "Address: %U\nBehavior: X (Endpoint with Layer-3 cross-connect)"
1420                 "\nIface: %U\nNext hop: %U", format_ip6_address,
1421                 (ip6_address_t *) mp->localsid.addr,
1422                 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1423                 format_ip6_address, (ip6_address_t *) mp->nh_addr6);
1424       s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1425       break;
1426     case SR_BEHAVIOR_DX4:
1427       s =
1428         format (s,
1429                 "Address: %U\nBehavior: DX4 (Endpoint with decapsulation with IPv4 cross-connect)"
1430                 "\nIface: %U\nNext hop: %U", format_ip6_address,
1431                 (ip6_address_t *) mp->localsid.addr,
1432                 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1433                 format_ip4_address, (ip4_address_t *) mp->nh_addr4);
1434       break;
1435     case SR_BEHAVIOR_DX6:
1436       s =
1437         format (s,
1438                 "Address: %U\nBehavior: DX6 (Endpoint with decapsulation with IPv6 cross-connect)"
1439                 "\nIface: %UNext hop: %U", format_ip6_address,
1440                 (ip6_address_t *) mp->localsid.addr,
1441                 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index),
1442                 format_ip6_address, (ip6_address_t *) mp->nh_addr6);
1443       break;
1444     case SR_BEHAVIOR_DX2:
1445       s =
1446         format (s,
1447                 "Address: %U\nBehavior: DX2 (Endpoint with decapulation and Layer-2 cross-connect)"
1448                 "\nIface: %U", format_ip6_address,
1449                 (ip6_address_t *) mp->localsid.addr,
1450                 format_vnet_sw_if_index_name, vnm, ntohl (mp->sw_if_index));
1451       break;
1452     case SR_BEHAVIOR_DT6:
1453       s =
1454         format (s,
1455                 "Address: %U\nBehavior: DT6 (Endpoint with decapsulation and specific IPv6 table lookup)"
1456                 "\nTable: %u", format_ip6_address,
1457                 (ip6_address_t *) mp->localsid.addr, ntohl (mp->fib_table));
1458       break;
1459     case SR_BEHAVIOR_DT4:
1460       s =
1461         format (s,
1462                 "Address: %U\nBehavior: DT4 (Endpoint with decapsulation and specific IPv4 table lookup)"
1463                 "\nTable: %u", format_ip6_address,
1464                 (ip6_address_t *) mp->localsid.addr, ntohl (mp->fib_table));
1465       break;
1466     default:
1467       if (mp->behavior >= SR_BEHAVIOR_LAST)
1468         {
1469           s = format (s, "Address: %U\n Behavior: %u",
1470                       format_ip6_address, (ip6_address_t *) mp->localsid.addr,
1471                       mp->behavior);
1472         }
1473       else
1474         //Should never get here...
1475         s = format (s, "Internal error");
1476       break;
1477     }
1478   FINISH;
1479 }
1480
1481 static void *vl_api_sr_steering_add_del_t_print
1482   (vl_api_sr_steering_add_del_t * mp, void *handle)
1483 {
1484   u8 *s;
1485
1486   s = format (0, "SCRIPT: sr_steering_add_del ");
1487
1488   s = format (s, (mp->is_del ? "Del: True" : "Del: False"));
1489
1490   switch (mp->traffic_type)
1491     {
1492     case SR_STEER_L2:
1493       s = format (s, "Traffic type: L2 iface: %u", ntohl (mp->sw_if_index));
1494       break;
1495     case SR_STEER_IPV4:
1496       s = format (s, "Traffic type: IPv4 %U/%u", format_ip4_address,
1497                   (ip4_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1498       break;
1499     case SR_STEER_IPV6:
1500       s = format (s, "Traffic type: IPv6 %U/%u", format_ip6_address,
1501                   (ip6_address_t *) mp->prefix_addr, ntohl (mp->mask_width));
1502       break;
1503     default:
1504       s = format (s, "Traffic type: Unknown(%u)", mp->traffic_type);
1505       break;
1506     }
1507   s = format (s, "BindingSID: %U", format_ip6_address,
1508               (ip6_address_t *) mp->bsid_addr);
1509
1510   s = format (s, "SR Policy Index: %u", ntohl (mp->sr_policy_index));
1511
1512   s = format (s, "FIB_table: %u", ntohl (mp->table_id));
1513
1514   FINISH;
1515 }
1516
1517 static void *vl_api_sr_policy_add_t_print
1518   (vl_api_sr_policy_add_t * mp, void *handle)
1519 {
1520   u8 *s;
1521
1522   ip6_address_t *segments = 0, *seg;
1523   ip6_address_t *this_address = (ip6_address_t *) mp->sids.sids;
1524
1525   int i;
1526   for (i = 0; i < mp->sids.num_sids; i++)
1527     {
1528       vec_add2 (segments, seg, 1);
1529       clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1530       this_address++;
1531     }
1532
1533   s = format (0, "SCRIPT: sr_policy_add ");
1534
1535   s = format (s, "BSID: %U", format_ip6_address,
1536               (ip6_address_t *) mp->bsid_addr);
1537
1538   s =
1539     format (s,
1540             (mp->is_encap ? "Behavior: Encapsulation" :
1541              "Behavior: SRH insertion"));
1542
1543   s = format (s, "FIB_table: %u", ntohl (mp->fib_table));
1544
1545   s = format (s, (mp->type ? "Type: Default" : "Type: Spray"));
1546
1547   s = format (s, "SID list weight: %u", ntohl (mp->weight));
1548
1549   s = format (s, "{");
1550   vec_foreach (seg, segments)
1551   {
1552     s = format (s, "%U, ", format_ip6_address, seg);
1553   }
1554   s = format (s, "\b\b } ");
1555
1556   FINISH;
1557 }
1558
1559 static void *vl_api_sr_policy_mod_t_print
1560   (vl_api_sr_policy_mod_t * mp, void *handle)
1561 {
1562   u8 *s;
1563
1564   ip6_address_t *segments = 0, *seg;
1565   ip6_address_t *this_address = (ip6_address_t *) mp->sids.sids;
1566
1567   int i;
1568   for (i = 0; i < mp->sids.num_sids; i++)
1569     {
1570       vec_add2 (segments, seg, 1);
1571       clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1572       this_address++;
1573     }
1574
1575   s = format (0, "SCRIPT: sr_policy_mod ");
1576
1577   s = format (s, "BSID: %U", format_ip6_address,
1578               (ip6_address_t *) mp->bsid_addr);
1579
1580   s = format (s, "SR Policy index: %u", ntohl (mp->sr_policy_index));
1581
1582   s = format (s, "Operation: %u", mp->operation);
1583
1584   s = format (s, "SID list index: %u", ntohl (mp->sl_index));
1585
1586   s = format (s, "SID list weight: %u", ntohl (mp->weight));
1587
1588   s = format (s, "{");
1589   vec_foreach (seg, segments)
1590   {
1591     s = format (s, "%U, ", format_ip6_address, seg);
1592   }
1593   s = format (s, "\b\b } ");
1594
1595   FINISH;
1596 }
1597
1598 static void *vl_api_sr_policy_del_t_print
1599   (vl_api_sr_policy_del_t * mp, void *handle)
1600 {
1601   u8 *s;
1602
1603   s = format (0, "SCRIPT: sr_policy_del ");
1604   s = format (s, "To be delivered. Good luck.");
1605   FINISH;
1606 }
1607
1608 static void *vl_api_classify_add_del_table_t_print
1609   (vl_api_classify_add_del_table_t * mp, void *handle)
1610 {
1611   u8 *s;
1612   int i;
1613
1614   s = format (0, "SCRIPT: classify_add_del_table ");
1615
1616   if (mp->is_add == 0)
1617     {
1618       s = format (s, "table %d ", ntohl (mp->table_index));
1619       s = format (s, "%s ", mp->del_chain ? "del-chain" : "del");
1620     }
1621   else
1622     {
1623       s = format (s, "nbuckets %d ", ntohl (mp->nbuckets));
1624       s = format (s, "memory_size %d ", ntohl (mp->memory_size));
1625       s = format (s, "skip %d ", ntohl (mp->skip_n_vectors));
1626       s = format (s, "match %d ", ntohl (mp->match_n_vectors));
1627       s = format (s, "next-table %d ", ntohl (mp->next_table_index));
1628       s = format (s, "miss-next %d ", ntohl (mp->miss_next_index));
1629       s = format (s, "current-data-flag %d ", ntohl (mp->current_data_flag));
1630       if (mp->current_data_flag)
1631         s = format (s, "current-data-offset %d ",
1632                     ntohl (mp->current_data_offset));
1633       s = format (s, "mask hex ");
1634       for (i = 0; i < ntohl (mp->match_n_vectors) * sizeof (u32x4); i++)
1635         s = format (s, "%02x", mp->mask[i]);
1636       vec_add1 (s, ' ');
1637     }
1638
1639   FINISH;
1640 }
1641
1642 static void *vl_api_classify_add_del_session_t_print
1643   (vl_api_classify_add_del_session_t * mp, void *handle)
1644 {
1645   u8 *s;
1646   int i, limit = 0;
1647
1648   s = format (0, "SCRIPT: classify_add_del_session ");
1649
1650   s = format (s, "table_index %d ", ntohl (mp->table_index));
1651   s = format (s, "hit_next_index %d ", ntohl (mp->hit_next_index));
1652   s = format (s, "opaque_index %d ", ntohl (mp->opaque_index));
1653   s = format (s, "advance %d ", ntohl (mp->advance));
1654   s = format (s, "action %d ", mp->action);
1655   if (mp->action)
1656     s = format (s, "metadata %d ", ntohl (mp->metadata));
1657   if (mp->is_add == 0)
1658     s = format (s, "del ");
1659
1660   s = format (s, "match hex ");
1661   for (i = 5 * sizeof (u32x4) - 1; i > 0; i--)
1662     {
1663       if (mp->match[i] != 0)
1664         {
1665           limit = i + 1;
1666           break;
1667         }
1668     }
1669
1670   for (i = 0; i < limit; i++)
1671     s = format (s, "%02x", mp->match[i]);
1672
1673   FINISH;
1674 }
1675
1676 static void *vl_api_classify_set_interface_ip_table_t_print
1677   (vl_api_classify_set_interface_ip_table_t * mp, void *handle)
1678 {
1679   u8 *s;
1680
1681   s = format (0, "SCRIPT: classify_set_interface_ip_table ");
1682
1683   if (mp->is_ipv6)
1684     s = format (s, "ipv6 ");
1685
1686   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1687   s = format (s, "table %d ", ntohl (mp->table_index));
1688
1689   FINISH;
1690 }
1691
1692 static void *vl_api_classify_set_interface_l2_tables_t_print
1693   (vl_api_classify_set_interface_l2_tables_t * mp, void *handle)
1694 {
1695   u8 *s;
1696
1697   s = format (0, "SCRIPT: classify_set_interface_l2_tables ");
1698
1699   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1700   s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1701   s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1702   s = format (s, "other-table %d ", ntohl (mp->other_table_index));
1703   s = format (s, "is-input %d ", mp->is_input);
1704
1705   FINISH;
1706 }
1707
1708 static void *vl_api_add_node_next_t_print
1709   (vl_api_add_node_next_t * mp, void *handle)
1710 {
1711   u8 *s;
1712
1713   s = format (0, "SCRIPT: add_node_next ");
1714
1715   s = format (0, "node %s next %s ", mp->node_name, mp->next_name);
1716
1717   FINISH;
1718 }
1719
1720 static void *vl_api_l2tpv3_create_tunnel_t_print
1721   (vl_api_l2tpv3_create_tunnel_t * mp, void *handle)
1722 {
1723   u8 *s;
1724
1725   s = format (0, "SCRIPT: l2tpv3_create_tunnel ");
1726
1727   s = format (s, "client_address %U our_address %U ",
1728               format_ip6_address, (ip6_address_t *) (mp->client_address),
1729               format_ip6_address, (ip6_address_t *) (mp->our_address));
1730   s = format (s, "local_session_id %d ", ntohl (mp->local_session_id));
1731   s = format (s, "remote_session_id %d ", ntohl (mp->remote_session_id));
1732   s = format (s, "local_cookie %lld ",
1733               clib_net_to_host_u64 (mp->local_cookie));
1734   s = format (s, "remote_cookie %lld ",
1735               clib_net_to_host_u64 (mp->remote_cookie));
1736   if (mp->l2_sublayer_present)
1737     s = format (s, "l2-sublayer-present ");
1738
1739   FINISH;
1740 }
1741
1742 static void *vl_api_l2tpv3_set_tunnel_cookies_t_print
1743   (vl_api_l2tpv3_set_tunnel_cookies_t * mp, void *handle)
1744 {
1745   u8 *s;
1746
1747   s = format (0, "SCRIPT: l2tpv3_set_tunnel_cookies ");
1748
1749   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1750
1751   s = format (s, "new_local_cookie %llu ",
1752               clib_net_to_host_u64 (mp->new_local_cookie));
1753
1754   s = format (s, "new_remote_cookie %llu ",
1755               clib_net_to_host_u64 (mp->new_remote_cookie));
1756
1757   FINISH;
1758 }
1759
1760 static void *vl_api_l2tpv3_interface_enable_disable_t_print
1761   (vl_api_l2tpv3_interface_enable_disable_t * mp, void *handle)
1762 {
1763   u8 *s;
1764
1765   s = format (0, "SCRIPT: l2tpv3_interface_enable_disable ");
1766
1767   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1768
1769   if (mp->enable_disable == 0)
1770     s = format (s, "del ");
1771
1772   FINISH;
1773 }
1774
1775 static void *vl_api_l2tpv3_set_lookup_key_t_print
1776   (vl_api_l2tpv3_set_lookup_key_t * mp, void *handle)
1777 {
1778   u8 *s;
1779   char *str = "unknown";
1780
1781   s = format (0, "SCRIPT: l2tpv3_set_lookup_key ");
1782
1783   switch (mp->key)
1784     {
1785     case L2T_LOOKUP_SRC_ADDRESS:
1786       str = "lookup_v6_src";
1787       break;
1788     case L2T_LOOKUP_DST_ADDRESS:
1789       str = "lookup_v6_dst";
1790       break;
1791     case L2T_LOOKUP_SESSION_ID:
1792       str = "lookup_session_id";
1793       break;
1794     default:
1795       break;
1796     }
1797
1798   s = format (s, "%s ", str);
1799
1800   FINISH;
1801 }
1802
1803 static void *vl_api_sw_if_l2tpv3_tunnel_dump_t_print
1804   (vl_api_sw_if_l2tpv3_tunnel_dump_t * mp, void *handle)
1805 {
1806   u8 *s;
1807
1808   s = format (0, "SCRIPT: sw_if_l2tpv3_tunnel_dump ");
1809
1810   FINISH;
1811 }
1812
1813 static void *vl_api_vxlan_add_del_tunnel_t_print
1814   (vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
1815 {
1816   u8 *s;
1817   s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
1818
1819   ip46_address_t src = to_ip46 (mp->is_ipv6, mp->src_address);
1820   ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->dst_address);
1821
1822   u8 is_grp = ip46_address_is_multicast (&dst);
1823   char *dst_name = is_grp ? "group" : "dst";
1824
1825   s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY);
1826   s = format (s, "%s %U ", dst_name, format_ip46_address,
1827               &dst, IP46_TYPE_ANY);
1828
1829   if (is_grp)
1830     s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1831
1832   if (mp->encap_vrf_id)
1833     s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1834
1835   s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1836
1837   s = format (s, "vni %d ", ntohl (mp->vni));
1838
1839   s = format (s, "instance %d ", ntohl (mp->instance));
1840
1841   if (mp->is_add == 0)
1842     s = format (s, "del ");
1843
1844   FINISH;
1845 }
1846
1847 static void *vl_api_vxlan_offload_rx_t_print
1848   (vl_api_vxlan_offload_rx_t * mp, void *handle)
1849 {
1850   u8 *s;
1851   s = format (0, "SCRIPT: vxlan_offload_rx ");
1852
1853   s = format (s, "hw hw_if_index %d ", ntohl (mp->hw_if_index));
1854   s = format (s, "rx sw_if_index %d ", ntohl (mp->sw_if_index));
1855   if (!mp->enable)
1856     s = format (s, "del ");
1857
1858   FINISH;
1859 }
1860
1861 static void *vl_api_vxlan_tunnel_dump_t_print
1862   (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1863 {
1864   u8 *s;
1865
1866   s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1867
1868   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1869
1870   FINISH;
1871 }
1872
1873 static void *vl_api_geneve_add_del_tunnel_t_print
1874   (vl_api_geneve_add_del_tunnel_t * mp, void *handle)
1875 {
1876   u8 *s;
1877   s = format (0, "SCRIPT: geneve_add_del_tunnel ");
1878
1879   ip46_address_t local = to_ip46 (mp->is_ipv6, mp->local_address);
1880   ip46_address_t remote = to_ip46 (mp->is_ipv6, mp->remote_address);
1881
1882   u8 is_grp = ip46_address_is_multicast (&remote);
1883   char *remote_name = is_grp ? "group" : "dst";
1884
1885   s = format (s, "src %U ", format_ip46_address, &local, IP46_TYPE_ANY);
1886   s = format (s, "%s %U ", remote_name, format_ip46_address,
1887               &remote, IP46_TYPE_ANY);
1888
1889   if (is_grp)
1890     s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1891
1892   if (mp->encap_vrf_id)
1893     s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1894
1895   s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1896
1897   s = format (s, "vni %d ", ntohl (mp->vni));
1898
1899   if (mp->is_add == 0)
1900     s = format (s, "del ");
1901
1902   FINISH;
1903 }
1904
1905 static void *vl_api_geneve_tunnel_dump_t_print
1906   (vl_api_geneve_tunnel_dump_t * mp, void *handle)
1907 {
1908   u8 *s;
1909
1910   s = format (0, "SCRIPT: geneve_tunnel_dump ");
1911
1912   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1913
1914   FINISH;
1915 }
1916
1917 static void *vl_api_gre_add_del_tunnel_t_print
1918   (vl_api_gre_add_del_tunnel_t * mp, void *handle)
1919 {
1920   u8 *s;
1921
1922   s = format (0, "SCRIPT: gre_add_del_tunnel ");
1923
1924   s = format (s, "dst %U ", format_ip46_address,
1925               (ip46_address_t *) & (mp->dst_address),
1926               mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1927
1928   s = format (s, "src %U ", format_ip46_address,
1929               (ip46_address_t *) & (mp->src_address),
1930               mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1931
1932   s = format (s, "instance %d ", ntohl (mp->instance));
1933
1934   if (mp->tunnel_type == GRE_TUNNEL_TYPE_TEB)
1935     s = format (s, "teb ");
1936
1937   if (mp->tunnel_type == GRE_TUNNEL_TYPE_ERSPAN)
1938     s = format (s, "erspan %d ", ntohs (mp->session_id));
1939
1940   if (mp->outer_fib_id)
1941     s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
1942
1943   if (mp->is_add == 0)
1944     s = format (s, "del ");
1945
1946   FINISH;
1947 }
1948
1949 static void *vl_api_gre_tunnel_dump_t_print
1950   (vl_api_gre_tunnel_dump_t * mp, void *handle)
1951 {
1952   u8 *s;
1953
1954   s = format (0, "SCRIPT: gre_tunnel_dump ");
1955
1956   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1957
1958   FINISH;
1959 }
1960
1961 static void *vl_api_l2_fib_clear_table_t_print
1962   (vl_api_l2_fib_clear_table_t * mp, void *handle)
1963 {
1964   u8 *s;
1965
1966   s = format (0, "SCRIPT: l2_fib_clear_table ");
1967
1968   FINISH;
1969 }
1970
1971 static void *vl_api_l2_interface_efp_filter_t_print
1972   (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1973 {
1974   u8 *s;
1975
1976   s = format (0, "SCRIPT: l2_interface_efp_filter ");
1977
1978   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1979   if (mp->enable_disable)
1980     s = format (s, "enable ");
1981   else
1982     s = format (s, "disable ");
1983
1984   FINISH;
1985 }
1986
1987 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1988   (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1989 {
1990   u8 *s;
1991
1992   s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1993
1994   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1995   s = format (s, "vtr_op %d ", ntohl (mp->vtr_op));
1996   s = format (s, "push_dot1q %d ", ntohl (mp->push_dot1q));
1997   s = format (s, "tag1 %d ", ntohl (mp->tag1));
1998   s = format (s, "tag2 %d ", ntohl (mp->tag2));
1999
2000   FINISH;
2001 }
2002
2003 static void *vl_api_create_vhost_user_if_t_print
2004   (vl_api_create_vhost_user_if_t * mp, void *handle)
2005 {
2006   u8 *s;
2007
2008   s = format (0, "SCRIPT: create_vhost_user_if ");
2009
2010   s = format (s, "socket %s ", mp->sock_filename);
2011   if (mp->is_server)
2012     s = format (s, "server ");
2013   if (mp->renumber)
2014     s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
2015   if (mp->disable_mrg_rxbuf)
2016     s = format (s, "disable_mrg_rxbuf ");
2017   if (mp->disable_indirect_desc)
2018     s = format (s, "disable_indirect_desc ");
2019   if (mp->tag[0])
2020     s = format (s, "tag %s", mp->tag);
2021
2022   FINISH;
2023 }
2024
2025 static void *vl_api_modify_vhost_user_if_t_print
2026   (vl_api_modify_vhost_user_if_t * mp, void *handle)
2027 {
2028   u8 *s;
2029
2030   s = format (0, "SCRIPT: modify_vhost_user_if ");
2031
2032   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2033   s = format (s, "socket %s ", mp->sock_filename);
2034   if (mp->is_server)
2035     s = format (s, "server ");
2036   if (mp->renumber)
2037     s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
2038
2039   FINISH;
2040 }
2041
2042 static void *vl_api_delete_vhost_user_if_t_print
2043   (vl_api_delete_vhost_user_if_t * mp, void *handle)
2044 {
2045   u8 *s;
2046
2047   s = format (0, "SCRIPT: delete_vhost_user_if ");
2048   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2049
2050   FINISH;
2051 }
2052
2053 static void *vl_api_sw_interface_vhost_user_dump_t_print
2054   (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
2055 {
2056   u8 *s;
2057
2058   s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
2059
2060   FINISH;
2061 }
2062
2063 static void *vl_api_sw_interface_dump_t_print
2064   (vl_api_sw_interface_dump_t * mp, void *handle)
2065 {
2066   u8 *s;
2067
2068   s = format (0, "SCRIPT: sw_interface_dump ");
2069
2070   if (mp->name_filter_valid)
2071     s = format (s, "name_filter %s ", mp->name_filter);
2072   else
2073     s = format (s, "all ");
2074
2075   FINISH;
2076 }
2077
2078 static void *vl_api_l2_fib_table_dump_t_print
2079   (vl_api_l2_fib_table_dump_t * mp, void *handle)
2080 {
2081   u8 *s;
2082
2083   s = format (0, "SCRIPT: l2_fib_table_dump ");
2084
2085   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
2086
2087   FINISH;
2088 }
2089
2090 static void *vl_api_control_ping_t_print
2091   (vl_api_control_ping_t * mp, void *handle)
2092 {
2093   u8 *s;
2094
2095   s = format (0, "SCRIPT: control_ping ");
2096
2097   FINISH;
2098 }
2099
2100 static void *vl_api_want_interface_events_t_print
2101   (vl_api_want_interface_events_t * mp, void *handle)
2102 {
2103   u8 *s;
2104
2105   s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
2106               ntohl (mp->pid), ntohl (mp->enable_disable));
2107
2108   FINISH;
2109 }
2110
2111 static void *
2112 vl_api_cli_t_print (vl_api_cli_t * mp, void *handle)
2113 {
2114   u8 *s;
2115
2116   s = format (0, "SCRIPT: cli ");
2117
2118   FINISH;
2119 }
2120
2121 static void *vl_api_cli_inband_t_print
2122   (vl_api_cli_inband_t * mp, void *handle)
2123 {
2124   u8 *s;
2125   u8 *cmd = 0;
2126   u32 length = ntohl (mp->length);
2127
2128   vec_validate (cmd, length);
2129   clib_memcpy (cmd, mp->cmd, length);
2130
2131   s = format (0, "SCRIPT: exec %v ", cmd);
2132
2133   vec_free (cmd);
2134   FINISH;
2135 }
2136
2137 static void *vl_api_memclnt_create_t_print
2138   (vl_api_memclnt_create_t * mp, void *handle)
2139 {
2140   u8 *s;
2141
2142   s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
2143
2144   FINISH;
2145 }
2146
2147 static void *vl_api_sockclnt_create_t_print
2148   (vl_api_sockclnt_create_t * mp, void *handle)
2149 {
2150   u8 *s;
2151
2152   s = format (0, "SCRIPT: sockclnt_create name %s ", mp->name);
2153
2154   FINISH;
2155 }
2156
2157 static void *vl_api_show_version_t_print
2158   (vl_api_show_version_t * mp, void *handle)
2159 {
2160   u8 *s;
2161
2162   s = format (0, "SCRIPT: show_version ");
2163
2164   FINISH;
2165 }
2166
2167 static void *vl_api_show_threads_t_print
2168   (vl_api_show_threads_t * mp, void *handle)
2169 {
2170   u8 *s;
2171
2172   s = format (0, "SCRIPT: show_threads ");
2173
2174   FINISH;
2175 }
2176
2177 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
2178   (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
2179 {
2180   u8 *s;
2181
2182   s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
2183
2184   ip46_address_t local = to_ip46 (mp->is_ipv6, mp->local);
2185   ip46_address_t remote = to_ip46 (mp->is_ipv6, mp->remote);
2186
2187   u8 is_grp = ip46_address_is_multicast (&remote);
2188   char *remote_name = is_grp ? "group" : "remote";
2189
2190   s = format (s, "local %U ", format_ip46_address, &local, IP46_TYPE_ANY);
2191   s = format (s, "%s %U ", remote_name, format_ip46_address,
2192               &remote, IP46_TYPE_ANY);
2193
2194   if (is_grp)
2195     s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
2196   s = format (s, "protocol %d ", ntohl (mp->protocol));
2197
2198   s = format (s, "vni %d ", ntohl (mp->vni));
2199
2200   if (mp->is_add == 0)
2201     s = format (s, "del ");
2202
2203   if (mp->encap_vrf_id)
2204     s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
2205
2206   if (mp->decap_vrf_id)
2207     s = format (s, "decap-vrf-id %d ", ntohl (mp->decap_vrf_id));
2208
2209   FINISH;
2210 }
2211
2212 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
2213   (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
2214 {
2215   u8 *s;
2216
2217   s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
2218
2219   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2220
2221   FINISH;
2222 }
2223
2224 static void *vl_api_interface_name_renumber_t_print
2225   (vl_api_interface_name_renumber_t * mp, void *handle)
2226 {
2227   u8 *s;
2228
2229   s = format (0, "SCRIPT: interface_renumber ");
2230
2231   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2232
2233   s = format (s, "new_show_dev_instance %d ",
2234               ntohl (mp->new_show_dev_instance));
2235
2236   FINISH;
2237 }
2238
2239 static void *vl_api_ip_probe_neighbor_t_print
2240   (vl_api_ip_probe_neighbor_t * mp, void *handle)
2241 {
2242   u8 *s;
2243
2244   s = format (0, "SCRIPT: ip_probe_neighbor ");
2245   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2246   if (mp->is_ipv6)
2247     s = format (s, "address %U ", format_ip6_address, &mp->dst_address);
2248   else
2249     s = format (s, "address %U ", format_ip4_address, &mp->dst_address);
2250
2251   FINISH;
2252 }
2253
2254 static void *vl_api_ip_scan_neighbor_enable_disable_t_print
2255   (vl_api_ip_scan_neighbor_enable_disable_t * mp, void *handle)
2256 {
2257   u8 *s;
2258
2259   s = format (0, "SCRIPT: ip_scan_neighbor_enable_disable ");
2260
2261   switch (mp->mode)
2262     {
2263     case IP_SCAN_V4_NEIGHBORS:
2264       s = format (s, "ip4 ");
2265       break;
2266     case IP_SCAN_V6_NEIGHBORS:
2267       s = format (s, "ip6 ");
2268       break;
2269     case IP_SCAN_V46_NEIGHBORS:
2270       s = format (s, "both ");
2271       break;
2272     default:
2273       s = format (s, "disable ");
2274     }
2275
2276   s = format (s, "interval %d ", mp->scan_interval);
2277   s = format (s, "max-time %d ", mp->max_proc_time);
2278   s = format (s, "max-update %d ", mp->max_update);
2279   s = format (s, "delay %d ", mp->scan_int_delay);
2280   s = format (s, "stale %d ", mp->stale_threshold);
2281
2282   FINISH;
2283 }
2284
2285 static void *vl_api_want_ip4_arp_events_t_print
2286   (vl_api_want_ip4_arp_events_t * mp, void *handle)
2287 {
2288   u8 *s;
2289
2290   s = format (0, "SCRIPT: want_ip4_arp_events ");
2291   s = format (s, "pid %d address %U ", ntohl (mp->pid),
2292               format_ip4_address, &mp->address);
2293   if (mp->enable_disable == 0)
2294     s = format (s, "del ");
2295
2296   FINISH;
2297 }
2298
2299 static void *vl_api_want_ip6_nd_events_t_print
2300   (vl_api_want_ip6_nd_events_t * mp, void *handle)
2301 {
2302   u8 *s;
2303
2304   s = format (0, "SCRIPT: want_ip6_nd_events ");
2305   s = format (s, "pid %d address %U ", ntohl (mp->pid),
2306               format_ip6_address, mp->address);
2307   if (mp->enable_disable == 0)
2308     s = format (s, "del ");
2309
2310   FINISH;
2311 }
2312
2313 static void *vl_api_want_l2_macs_events_t_print
2314   (vl_api_want_l2_macs_events_t * mp, void *handle)
2315 {
2316   u8 *s;
2317
2318   s = format (0, "SCRIPT: want_l2_macs_events ");
2319   s = format (s, "learn-limit %d ", ntohl (mp->learn_limit));
2320   s = format (s, "scan-delay %d ", (u32) mp->scan_delay);
2321   s = format (s, "max-entries %d ", (u32) mp->max_macs_in_event * 10);
2322   if (mp->enable_disable == 0)
2323     s = format (s, "disable");
2324
2325   FINISH;
2326 }
2327
2328 static void *vl_api_input_acl_set_interface_t_print
2329   (vl_api_input_acl_set_interface_t * mp, void *handle)
2330 {
2331   u8 *s;
2332
2333   s = format (0, "SCRIPT: input_acl_set_interface ");
2334
2335   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2336   s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2337   s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2338   s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2339
2340   if (mp->is_add == 0)
2341     s = format (s, "del ");
2342
2343   FINISH;
2344 }
2345
2346 static void *vl_api_output_acl_set_interface_t_print
2347   (vl_api_output_acl_set_interface_t * mp, void *handle)
2348 {
2349   u8 *s;
2350
2351   s = format (0, "SCRIPT: output_acl_set_interface ");
2352
2353   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2354   s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2355   s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2356   s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2357
2358   if (mp->is_add == 0)
2359     s = format (s, "del ");
2360
2361   FINISH;
2362 }
2363
2364 static void *vl_api_ip_address_dump_t_print
2365   (vl_api_ip_address_dump_t * mp, void *handle)
2366 {
2367   u8 *s;
2368
2369   s = format (0, "SCRIPT: ip6_address_dump ");
2370   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2371   s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
2372
2373   FINISH;
2374 }
2375
2376 static void *
2377 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
2378 {
2379   u8 *s;
2380
2381   s = format (0, "SCRIPT: ip_dump ");
2382   s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
2383
2384   FINISH;
2385 }
2386
2387 static void *vl_api_cop_interface_enable_disable_t_print
2388   (vl_api_cop_interface_enable_disable_t * mp, void *handle)
2389 {
2390   u8 *s;
2391
2392   s = format (0, "SCRIPT: cop_interface_enable_disable ");
2393   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2394   if (mp->enable_disable)
2395     s = format (s, "enable ");
2396   else
2397     s = format (s, "disable ");
2398
2399   FINISH;
2400 }
2401
2402 static void *vl_api_cop_whitelist_enable_disable_t_print
2403   (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
2404 {
2405   u8 *s;
2406
2407   s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
2408   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2409   s = format (s, "fib-id %d ", ntohl (mp->fib_id));
2410   if (mp->ip4)
2411     s = format (s, "ip4 ");
2412   if (mp->ip6)
2413     s = format (s, "ip6 ");
2414   if (mp->default_cop)
2415     s = format (s, "default ");
2416
2417   FINISH;
2418 }
2419
2420 static void *vl_api_af_packet_create_t_print
2421   (vl_api_af_packet_create_t * mp, void *handle)
2422 {
2423   u8 *s;
2424
2425   s = format (0, "SCRIPT: af_packet_create ");
2426   s = format (s, "host_if_name %s ", mp->host_if_name);
2427   if (mp->use_random_hw_addr)
2428     s = format (s, "hw_addr random ");
2429   else
2430     s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
2431
2432   FINISH;
2433 }
2434
2435 static void *vl_api_af_packet_delete_t_print
2436   (vl_api_af_packet_delete_t * mp, void *handle)
2437 {
2438   u8 *s;
2439
2440   s = format (0, "SCRIPT: af_packet_delete ");
2441   s = format (s, "host_if_name %s ", mp->host_if_name);
2442
2443   FINISH;
2444 }
2445
2446 static void *vl_api_af_packet_dump_t_print
2447   (vl_api_af_packet_dump_t * mp, void *handle)
2448 {
2449   u8 *s;
2450
2451   s = format (0, "SCRIPT: af_packet_dump ");
2452
2453   FINISH;
2454 }
2455
2456 static u8 *
2457 format_policer_action (u8 * s, va_list * va)
2458 {
2459   u32 action = va_arg (*va, u32);
2460   u32 dscp = va_arg (*va, u32);
2461   char *t = 0;
2462
2463   if (action == SSE2_QOS_ACTION_DROP)
2464     s = format (s, "drop");
2465   else if (action == SSE2_QOS_ACTION_TRANSMIT)
2466     s = format (s, "transmit");
2467   else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
2468     {
2469       s = format (s, "mark-and-transmit ");
2470       switch (dscp)
2471         {
2472 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
2473           foreach_vnet_dscp
2474 #undef _
2475         default:
2476           break;
2477         }
2478       s = format (s, "%s", t);
2479     }
2480   return s;
2481 }
2482
2483 static void *vl_api_policer_add_del_t_print
2484   (vl_api_policer_add_del_t * mp, void *handle)
2485 {
2486   u8 *s;
2487
2488   s = format (0, "SCRIPT: policer_add_del ");
2489   s = format (s, "name %s ", mp->name);
2490   s = format (s, "cir %d ", mp->cir);
2491   s = format (s, "eir %d ", mp->eir);
2492   s = format (s, "cb %d ", mp->cb);
2493   s = format (s, "eb %d ", mp->eb);
2494
2495   switch (mp->rate_type)
2496     {
2497     case SSE2_QOS_RATE_KBPS:
2498       s = format (s, "rate_type kbps ");
2499       break;
2500     case SSE2_QOS_RATE_PPS:
2501       s = format (s, "rate_type pps ");
2502       break;
2503     default:
2504       break;
2505     }
2506
2507   switch (mp->round_type)
2508     {
2509     case SSE2_QOS_ROUND_TO_CLOSEST:
2510       s = format (s, "round_type closest ");
2511       break;
2512     case SSE2_QOS_ROUND_TO_UP:
2513       s = format (s, "round_type up ");
2514       break;
2515     case SSE2_QOS_ROUND_TO_DOWN:
2516       s = format (s, "round_type down ");
2517       break;
2518     default:
2519       break;
2520     }
2521
2522   switch (mp->type)
2523     {
2524     case SSE2_QOS_POLICER_TYPE_1R2C:
2525       s = format (s, "type 1r2c ");
2526       break;
2527     case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
2528       s = format (s, "type 1r3c ");
2529       break;
2530     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
2531       s = format (s, "type 2r3c-2698 ");
2532       break;
2533     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
2534       s = format (s, "type 2r3c-4115 ");
2535       break;
2536     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
2537       s = format (s, "type 2r3c-mef5cf1 ");
2538       break;
2539     default:
2540       break;
2541     }
2542
2543   s = format (s, "conform_action %U ", format_policer_action,
2544               mp->conform_action_type, mp->conform_dscp);
2545   s = format (s, "exceed_action %U ", format_policer_action,
2546               mp->exceed_action_type, mp->exceed_dscp);
2547   s = format (s, "violate_action %U ", format_policer_action,
2548               mp->violate_action_type, mp->violate_dscp);
2549
2550   if (mp->color_aware)
2551     s = format (s, "color-aware ");
2552   if (mp->is_add == 0)
2553     s = format (s, "del ");
2554
2555   FINISH;
2556 }
2557
2558 static void *vl_api_policer_dump_t_print
2559   (vl_api_policer_dump_t * mp, void *handle)
2560 {
2561   u8 *s;
2562
2563   s = format (0, "SCRIPT: policer_dump ");
2564   if (mp->match_name_valid)
2565     s = format (s, "name %s ", mp->match_name);
2566
2567   FINISH;
2568 }
2569
2570 static void *vl_api_policer_classify_set_interface_t_print
2571   (vl_api_policer_classify_set_interface_t * mp, void *handle)
2572 {
2573   u8 *s;
2574
2575   s = format (0, "SCRIPT: policer_classify_set_interface ");
2576   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2577   if (mp->ip4_table_index != ~0)
2578     s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2579   if (mp->ip6_table_index != ~0)
2580     s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2581   if (mp->l2_table_index != ~0)
2582     s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2583   if (mp->is_add == 0)
2584     s = format (s, "del ");
2585
2586   FINISH;
2587 }
2588
2589 static void *vl_api_policer_classify_dump_t_print
2590   (vl_api_policer_classify_dump_t * mp, void *handle)
2591 {
2592   u8 *s;
2593
2594   s = format (0, "SCRIPT: policer_classify_dump ");
2595   switch (mp->type)
2596     {
2597     case POLICER_CLASSIFY_TABLE_IP4:
2598       s = format (s, "type ip4 ");
2599       break;
2600     case POLICER_CLASSIFY_TABLE_IP6:
2601       s = format (s, "type ip6 ");
2602       break;
2603     case POLICER_CLASSIFY_TABLE_L2:
2604       s = format (s, "type l2 ");
2605       break;
2606     default:
2607       break;
2608     }
2609
2610   FINISH;
2611 }
2612
2613 static void *vl_api_sw_interface_clear_stats_t_print
2614   (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2615 {
2616   u8 *s;
2617
2618   s = format (0, "SCRIPT: sw_interface_clear_stats ");
2619   if (mp->sw_if_index != ~0)
2620     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2621
2622   FINISH;
2623 }
2624
2625 static void *vl_api_mpls_tunnel_dump_t_print
2626   (vl_api_mpls_tunnel_dump_t * mp, void *handle)
2627 {
2628   u8 *s;
2629
2630   s = format (0, "SCRIPT: mpls_tunnel_dump ");
2631
2632   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2633
2634   FINISH;
2635 }
2636
2637 static void *vl_api_mpls_fib_dump_t_print
2638   (vl_api_mpls_fib_dump_t * mp, void *handle)
2639 {
2640   u8 *s;
2641
2642   s = format (0, "SCRIPT: mpls_fib_decap_dump ");
2643
2644   FINISH;
2645 }
2646
2647 static void *vl_api_ip_fib_dump_t_print
2648   (vl_api_ip_fib_dump_t * mp, void *handle)
2649 {
2650   u8 *s;
2651
2652   s = format (0, "SCRIPT: ip_fib_dump ");
2653
2654   FINISH;
2655 }
2656
2657 static void *vl_api_ip6_fib_dump_t_print
2658   (vl_api_ip6_fib_dump_t * mp, void *handle)
2659 {
2660   u8 *s;
2661
2662   s = format (0, "SCRIPT: ip6_fib_dump ");
2663
2664   FINISH;
2665 }
2666
2667 static void *vl_api_classify_table_ids_t_print
2668   (vl_api_classify_table_ids_t * mp, void *handle)
2669 {
2670   u8 *s;
2671
2672   s = format (0, "SCRIPT: classify_table_ids ");
2673
2674   FINISH;
2675 }
2676
2677 static void *vl_api_classify_table_by_interface_t_print
2678   (vl_api_classify_table_by_interface_t * mp, void *handle)
2679 {
2680   u8 *s;
2681
2682   s = format (0, "SCRIPT: classify_table_by_interface ");
2683   if (mp->sw_if_index != ~0)
2684     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2685
2686   FINISH;
2687 }
2688
2689 static void *vl_api_classify_table_info_t_print
2690   (vl_api_classify_table_info_t * mp, void *handle)
2691 {
2692   u8 *s;
2693
2694   s = format (0, "SCRIPT: classify_table_info ");
2695   if (mp->table_id != ~0)
2696     s = format (s, "table_id %d ", ntohl (mp->table_id));
2697
2698   FINISH;
2699 }
2700
2701 static void *vl_api_classify_session_dump_t_print
2702   (vl_api_classify_session_dump_t * mp, void *handle)
2703 {
2704   u8 *s;
2705
2706   s = format (0, "SCRIPT: classify_session_dump ");
2707   if (mp->table_id != ~0)
2708     s = format (s, "table_id %d ", ntohl (mp->table_id));
2709
2710   FINISH;
2711 }
2712
2713 static void *vl_api_set_ipfix_exporter_t_print
2714   (vl_api_set_ipfix_exporter_t * mp, void *handle)
2715 {
2716   u8 *s;
2717
2718   s = format (0, "SCRIPT: set_ipfix_exporter ");
2719
2720   s = format (s, "collector-address %U ", format_ip4_address,
2721               (ip4_address_t *) mp->collector_address);
2722   s = format (s, "collector-port %d ", ntohs (mp->collector_port));
2723   s = format (s, "src-address %U ", format_ip4_address,
2724               (ip4_address_t *) mp->src_address);
2725   s = format (s, "vrf-id %d ", ntohl (mp->vrf_id));
2726   s = format (s, "path-mtu %d ", ntohl (mp->path_mtu));
2727   s = format (s, "template-interval %d ", ntohl (mp->template_interval));
2728   s = format (s, "udp-checksum %d ", mp->udp_checksum);
2729
2730   FINISH;
2731 }
2732
2733 static void *vl_api_ipfix_exporter_dump_t_print
2734   (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2735 {
2736   u8 *s;
2737
2738   s = format (0, "SCRIPT: ipfix_exporter_dump ");
2739
2740   FINISH;
2741 }
2742
2743 static void *vl_api_set_ipfix_classify_stream_t_print
2744   (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2745 {
2746   u8 *s;
2747
2748   s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2749
2750   s = format (s, "domain-id %d ", ntohl (mp->domain_id));
2751   s = format (s, "src-port %d ", ntohs (mp->src_port));
2752
2753   FINISH;
2754 }
2755
2756 static void *vl_api_ipfix_classify_stream_dump_t_print
2757   (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2758 {
2759   u8 *s;
2760
2761   s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2762
2763   FINISH;
2764 }
2765
2766 static void *vl_api_ipfix_classify_table_add_del_t_print
2767   (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2768 {
2769   u8 *s;
2770
2771   s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2772
2773   s = format (s, "table-id %d ", ntohl (mp->table_id));
2774   s = format (s, "ip-version %d ", mp->ip_version);
2775   s = format (s, "transport-protocol %d ", mp->transport_protocol);
2776
2777   FINISH;
2778 }
2779
2780 static void *vl_api_ipfix_classify_table_dump_t_print
2781   (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2782 {
2783   u8 *s;
2784
2785   s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2786
2787   FINISH;
2788 }
2789
2790 static void *vl_api_sw_interface_span_enable_disable_t_print
2791   (vl_api_sw_interface_span_enable_disable_t * mp, void *handle)
2792 {
2793   u8 *s;
2794
2795   s = format (0, "SCRIPT: sw_interface_span_enable_disable ");
2796   s = format (s, "src_sw_if_index %u ", ntohl (mp->sw_if_index_from));
2797   s = format (s, "dst_sw_if_index %u ", ntohl (mp->sw_if_index_to));
2798
2799   if (mp->is_l2)
2800     s = format (s, "l2 ");
2801
2802   switch (mp->state)
2803     {
2804     case 0:
2805       s = format (s, "disable ");
2806       break;
2807     case 1:
2808       s = format (s, "rx ");
2809       break;
2810     case 2:
2811       s = format (s, "tx ");
2812       break;
2813     case 3:
2814     default:
2815       s = format (s, "both ");
2816       break;
2817     }
2818
2819   FINISH;
2820 }
2821
2822 static void *
2823 vl_api_sw_interface_span_dump_t_print (vl_api_sw_interface_span_dump_t * mp,
2824                                        void *handle)
2825 {
2826   u8 *s;
2827
2828   s = format (0, "SCRIPT: sw_interface_span_dump ");
2829
2830   if (mp->is_l2)
2831     s = format (s, "l2 ");
2832
2833   FINISH;
2834 }
2835
2836 static void *vl_api_get_next_index_t_print
2837   (vl_api_get_next_index_t * mp, void *handle)
2838 {
2839   u8 *s;
2840
2841   s = format (0, "SCRIPT: get_next_index ");
2842   s = format (s, "node-name %s ", mp->node_name);
2843   s = format (s, "next-node-name %s ", mp->next_name);
2844
2845   FINISH;
2846 }
2847
2848 static void *vl_api_pg_create_interface_t_print
2849   (vl_api_pg_create_interface_t * mp, void *handle)
2850 {
2851   u8 *s;
2852
2853   s = format (0, "SCRIPT: pg_create_interface ");
2854   s = format (0, "if_id %d", ntohl (mp->interface_id));
2855
2856   FINISH;
2857 }
2858
2859 static void *vl_api_pg_capture_t_print
2860   (vl_api_pg_capture_t * mp, void *handle)
2861 {
2862   u8 *s;
2863
2864   s = format (0, "SCRIPT: pg_capture ");
2865   s = format (0, "if_id %d ", ntohl (mp->interface_id));
2866   s = format (0, "pcap %s", mp->pcap_file_name);
2867   if (mp->count != ~0)
2868     s = format (s, "count %d ", ntohl (mp->count));
2869   if (!mp->is_enabled)
2870     s = format (s, "disable");
2871
2872   FINISH;
2873 }
2874
2875 static void *vl_api_pg_enable_disable_t_print
2876   (vl_api_pg_enable_disable_t * mp, void *handle)
2877 {
2878   u8 *s;
2879
2880   s = format (0, "SCRIPT: pg_enable_disable ");
2881   if (ntohl (mp->stream_name_length) > 0)
2882     s = format (s, "stream %s", mp->stream_name);
2883   if (!mp->is_enabled)
2884     s = format (s, "disable");
2885
2886   FINISH;
2887 }
2888
2889 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2890   (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2891 {
2892   u8 *s;
2893   int i;
2894
2895   s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2896   if (mp->is_ipv6)
2897     s = format (s, "%U/%d ", format_ip6_address, mp->address,
2898                 mp->mask_length);
2899   else
2900     s = format (s, "%U/%d ", format_ip4_address, mp->address,
2901                 mp->mask_length);
2902
2903   for (i = 0; i < mp->number_of_ranges; i++)
2904     {
2905       s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2906     }
2907
2908   s = format (s, "vrf %d ", ntohl (mp->vrf_id));
2909
2910   if (mp->is_add == 0)
2911     s = format (s, "del ");
2912
2913   FINISH;
2914 }
2915
2916 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2917   (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2918    void *handle)
2919 {
2920   u8 *s;
2921
2922   s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2923
2924   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2925
2926   if (mp->tcp_out_vrf_id != ~0)
2927     s = format (s, "tcp-out-vrf %d ", ntohl (mp->tcp_out_vrf_id));
2928
2929   if (mp->udp_out_vrf_id != ~0)
2930     s = format (s, "udp-out-vrf %d ", ntohl (mp->udp_out_vrf_id));
2931
2932   if (mp->tcp_in_vrf_id != ~0)
2933     s = format (s, "tcp-in-vrf %d ", ntohl (mp->tcp_in_vrf_id));
2934
2935   if (mp->udp_in_vrf_id != ~0)
2936     s = format (s, "udp-in-vrf %d ", ntohl (mp->udp_in_vrf_id));
2937
2938   if (mp->is_add == 0)
2939     s = format (s, "del ");
2940
2941   FINISH;
2942 }
2943
2944 static void *vl_api_lisp_enable_disable_t_print
2945   (vl_api_lisp_enable_disable_t * mp, void *handle)
2946 {
2947   u8 *s;
2948
2949   s = format (0, "SCRIPT: lisp_enable_disable %s",
2950               mp->is_en ? "enable" : "disable");
2951
2952   FINISH;
2953 }
2954
2955 static void *vl_api_gpe_add_del_iface_t_print
2956   (vl_api_gpe_add_del_iface_t * mp, void *handle)
2957 {
2958   u8 *s;
2959
2960   s = format (0, "SCRIPT: gpe_add_del_iface ");
2961
2962   s = format (s, "%s ", mp->is_add ? "up" : "down");
2963   s = format (s, "vni %d ", mp->vni);
2964   s = format (s, "%s %d ", mp->is_l2 ? "bd_id" : "table_id", mp->dp_table);
2965
2966   FINISH;
2967 }
2968
2969 static void *vl_api_lisp_pitr_set_locator_set_t_print
2970   (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
2971 {
2972   u8 *s;
2973
2974   s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
2975
2976   if (mp->is_add)
2977     s = format (s, "locator-set %s ", mp->ls_name);
2978   else
2979     s = format (s, "del");
2980
2981   FINISH;
2982 }
2983
2984 static u8 *
2985 format_lisp_flat_eid (u8 * s, va_list * args)
2986 {
2987   u32 type = va_arg (*args, u32);
2988   u8 *eid = va_arg (*args, u8 *);
2989   u32 eid_len = va_arg (*args, u32);
2990
2991   switch (type)
2992     {
2993     case 0:
2994       return format (s, "%U/%d", format_ip4_address, eid, eid_len);
2995     case 1:
2996       return format (s, "%U/%d", format_ip6_address, eid, eid_len);
2997     case 3:
2998       return format (s, "%U", format_ethernet_address, eid);
2999     }
3000   return 0;
3001 }
3002
3003 static void *vl_api_lisp_add_del_remote_mapping_t_print
3004   (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
3005 {
3006   u8 *s;
3007   u32 rloc_num = 0;
3008
3009   s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
3010
3011   if (mp->del_all)
3012     s = format (s, "del-all ");
3013
3014   s = format (s, "%s ", mp->is_add ? "add" : "del");
3015   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
3016
3017   s = format (s, "eid %U ", format_lisp_flat_eid,
3018               mp->eid_type, mp->eid, mp->eid_len);
3019
3020   if (mp->is_src_dst)
3021     {
3022       s = format (s, "seid %U ", format_lisp_flat_eid,
3023                   mp->eid_type, mp->seid, mp->seid_len);
3024     }
3025   rloc_num = clib_net_to_host_u32 (mp->rloc_num);
3026
3027   if (0 == rloc_num)
3028     s = format (s, "action %d", mp->action);
3029
3030   FINISH;
3031 }
3032
3033 static void *vl_api_lisp_add_del_adjacency_t_print
3034   (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
3035 {
3036   u8 *s;
3037
3038   s = format (0, "SCRIPT: lisp_add_del_adjacency ");
3039
3040   s = format (s, "%s ", mp->is_add ? "add" : "del");
3041   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
3042   s = format (s, "reid %U leid %U ",
3043               format_lisp_flat_eid, mp->eid_type, mp->reid, mp->reid_len,
3044               format_lisp_flat_eid, mp->eid_type, mp->leid, mp->leid_len);
3045
3046   FINISH;
3047 }
3048
3049 static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
3050   (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
3051 {
3052   u8 *s;
3053
3054   s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
3055
3056   if (mp->is_add)
3057     s = format (s, "%s", mp->locator_set_name);
3058   else
3059     s = format (s, "del");
3060
3061   FINISH;
3062 }
3063
3064 static void *vl_api_lisp_eid_table_add_del_map_t_print
3065   (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
3066 {
3067   u8 *s;
3068
3069   s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
3070
3071   if (!mp->is_add)
3072     s = format (s, "del ");
3073
3074   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
3075   s = format (s, "%s %d ",
3076               mp->is_l2 ? "bd_index" : "vrf",
3077               clib_net_to_host_u32 (mp->dp_table));
3078   FINISH;
3079 }
3080
3081 static void *vl_api_lisp_add_del_local_eid_t_print
3082   (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
3083 {
3084   u8 *s;
3085
3086   s = format (0, "SCRIPT: lisp_add_del_local_eid ");
3087
3088   if (!mp->is_add)
3089     s = format (s, "del ");
3090
3091   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
3092   s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
3093               mp->prefix_len);
3094   s = format (s, "locator-set %s ", mp->locator_set_name);
3095   if (*mp->key)
3096     {
3097       u32 key_id = mp->key_id;
3098       s = format (s, "key-id %U", format_hmac_key_id, key_id);
3099       s = format (s, "secret-key %s", mp->key);
3100     }
3101   FINISH;
3102 }
3103
3104 static void *vl_api_gpe_add_del_fwd_entry_t_print
3105   (vl_api_gpe_add_del_fwd_entry_t * mp, void *handle)
3106 {
3107   u8 *s;
3108
3109   s = format (0, "SCRIPT: gpe_add_del_fwd_entry TODO");
3110
3111   FINISH;
3112 }
3113
3114 static void *vl_api_lisp_add_del_map_resolver_t_print
3115   (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
3116 {
3117   u8 *s;
3118
3119   s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
3120
3121   if (!mp->is_add)
3122     s = format (s, "del ");
3123
3124   if (mp->is_ipv6)
3125     s = format (s, "%U ", format_ip6_address, mp->ip_address);
3126   else
3127     s = format (s, "%U ", format_ip4_address, mp->ip_address);
3128
3129   FINISH;
3130 }
3131
3132 static void *vl_api_gpe_enable_disable_t_print
3133   (vl_api_gpe_enable_disable_t * mp, void *handle)
3134 {
3135   u8 *s;
3136
3137   s = format (0, "SCRIPT: gpe_enable_disable ");
3138
3139   s = format (s, "%s ", mp->is_en ? "enable" : "disable");
3140
3141   FINISH;
3142 }
3143
3144 static void *vl_api_lisp_add_del_locator_set_t_print
3145   (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
3146 {
3147   u8 *s;
3148
3149   s = format (0, "SCRIPT: lisp_add_del_locator_set ");
3150
3151   if (!mp->is_add)
3152     s = format (s, "del ");
3153
3154   s = format (s, "locator-set %s ", mp->locator_set_name);
3155
3156   FINISH;
3157 }
3158
3159 static void *vl_api_lisp_add_del_locator_t_print
3160   (vl_api_lisp_add_del_locator_t * mp, void *handle)
3161 {
3162   u8 *s;
3163
3164   s = format (0, "SCRIPT: lisp_add_del_locator ");
3165
3166   if (!mp->is_add)
3167     s = format (s, "del ");
3168
3169   s = format (s, "locator-set %s ", mp->locator_set_name);
3170   s = format (s, "sw_if_index %d ", mp->sw_if_index);
3171   s = format (s, "p %d w %d ", mp->priority, mp->weight);
3172
3173   FINISH;
3174 }
3175
3176 static void *vl_api_lisp_locator_set_dump_t_print
3177   (vl_api_lisp_locator_set_dump_t * mp, void *handle)
3178 {
3179   u8 *s;
3180
3181   s = format (0, "SCRIPT: lisp_locator_set_dump ");
3182   if (mp->filter == 1)
3183     s = format (s, "local");
3184   else if (mp->filter == 2)
3185     s = format (s, "remote");
3186
3187   FINISH;
3188 }
3189
3190 static void *vl_api_lisp_locator_dump_t_print
3191   (vl_api_lisp_locator_dump_t * mp, void *handle)
3192 {
3193   u8 *s;
3194
3195   s = format (0, "SCRIPT: lisp_locator_dump ");
3196   if (mp->is_index_set)
3197     s = format (s, "ls_index %d", clib_net_to_host_u32 (mp->ls_index));
3198   else
3199     s = format (s, "ls_name %s", mp->ls_name);
3200
3201   FINISH;
3202 }
3203
3204 static void *vl_api_lisp_map_request_mode_t_print
3205   (vl_api_lisp_map_request_mode_t * mp, void *handle)
3206 {
3207   u8 *s;
3208
3209   s = format (0, "SCRIPT: lisp_map_request_mode ");
3210
3211   switch (mp->mode)
3212     {
3213     case 0:
3214       s = format (s, "dst-only");
3215       break;
3216     case 1:
3217       s = format (s, "src-dst");
3218     default:
3219       break;
3220     }
3221
3222   FINISH;
3223 }
3224
3225 static void *vl_api_lisp_eid_table_dump_t_print
3226   (vl_api_lisp_eid_table_dump_t * mp, void *handle)
3227 {
3228   u8 *s;
3229
3230   s = format (0, "SCRIPT: lisp_eid_table_dump ");
3231
3232   if (mp->eid_set)
3233     {
3234       s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
3235       s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
3236                   mp->eid, mp->prefix_length);
3237       switch (mp->filter)
3238         {
3239         case 1:
3240           s = format (s, "local ");
3241           break;
3242         case 2:
3243           s = format (s, "remote ");
3244           break;
3245         }
3246     }
3247   FINISH;
3248 }
3249
3250 static void *vl_api_lisp_rloc_probe_enable_disable_t_print
3251   (vl_api_lisp_rloc_probe_enable_disable_t * mp, void *handle)
3252 {
3253   u8 *s;
3254
3255   s = format (0, "SCRIPT: lisp_rloc_probe_enable_disable ");
3256   if (mp->is_enabled)
3257     s = format (s, "enable");
3258   else
3259     s = format (s, "disable");
3260
3261   FINISH;
3262 }
3263
3264 static void *vl_api_lisp_map_register_enable_disable_t_print
3265   (vl_api_lisp_map_register_enable_disable_t * mp, void *handle)
3266 {
3267   u8 *s;
3268
3269   s = format (0, "SCRIPT: lisp_map_register_enable_disable ");
3270   if (mp->is_enabled)
3271     s = format (s, "enable");
3272   else
3273     s = format (s, "disable");
3274
3275   FINISH;
3276 }
3277
3278 static void *vl_api_lisp_adjacencies_get_t_print
3279   (vl_api_lisp_adjacencies_get_t * mp, void *handle)
3280 {
3281   u8 *s;
3282
3283   s = format (0, "SCRIPT: lisp_adjacencies_get ");
3284   s = format (s, "vni %d", clib_net_to_host_u32 (mp->vni));
3285
3286   FINISH;
3287 }
3288
3289 static void *vl_api_lisp_eid_table_map_dump_t_print
3290   (vl_api_lisp_eid_table_map_dump_t * mp, void *handle)
3291 {
3292   u8 *s;
3293
3294   s = format (0, "SCRIPT: lisp_eid_table_map_dump ");
3295
3296   if (mp->is_l2)
3297     s = format (s, "l2");
3298   else
3299     s = format (s, "l3");
3300
3301   FINISH;
3302 }
3303
3304 static void *vl_api_ipsec_gre_add_del_tunnel_t_print
3305   (vl_api_ipsec_gre_add_del_tunnel_t * mp, void *handle)
3306 {
3307   u8 *s;
3308
3309   s = format (0, "SCRIPT: ipsec_gre_add_del_tunnel ");
3310
3311   s = format (s, "dst %U ", format_ip4_address,
3312               (ip4_address_t *) & (mp->dst_address));
3313
3314   s = format (s, "src %U ", format_ip4_address,
3315               (ip4_address_t *) & (mp->src_address));
3316
3317   s = format (s, "local_sa %d ", ntohl (mp->local_sa_id));
3318
3319   s = format (s, "remote_sa %d ", ntohl (mp->remote_sa_id));
3320
3321   if (mp->is_add == 0)
3322     s = format (s, "del ");
3323
3324   FINISH;
3325 }
3326
3327 static void *vl_api_ipsec_gre_tunnel_dump_t_print
3328   (vl_api_ipsec_gre_tunnel_dump_t * mp, void *handle)
3329 {
3330   u8 *s;
3331
3332   s = format (0, "SCRIPT: ipsec_gre_tunnel_dump ");
3333
3334   if (mp->sw_if_index != ~0)
3335     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3336
3337   FINISH;
3338 }
3339
3340 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
3341   (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
3342 {
3343   u8 *s;
3344   u32 vtr_op = ntohl (mp->vtr_op);
3345
3346   s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
3347
3348   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3349   s = format (s, "vtr_op %d ", vtr_op);
3350   if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
3351     {
3352       if (vtr_op == L2_VTR_TRANSLATE_2_2)
3353         s = format (s, "%d ", ntohs (mp->outer_tag));
3354       s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
3355       s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
3356       s = format (s, "sid %d ", ntohl (mp->i_sid));
3357       s = format (s, "vlanid %d ", ntohs (mp->b_vlanid));
3358     }
3359   FINISH;
3360 }
3361
3362 static void *vl_api_flow_classify_set_interface_t_print
3363   (vl_api_flow_classify_set_interface_t * mp, void *handle)
3364 {
3365   u8 *s;
3366
3367   s = format (0, "SCRIPT: flow_classify_set_interface ");
3368   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3369   if (mp->ip4_table_index != ~0)
3370     s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
3371   if (mp->ip6_table_index != ~0)
3372     s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
3373   if (mp->is_add == 0)
3374     s = format (s, "del ");
3375
3376   FINISH;
3377 }
3378
3379 static void *
3380 vl_api_punt_t_print (vl_api_punt_t * mp, void *handle)
3381 {
3382   u8 *s;
3383
3384   s = format (0, "SCRIPT: punt ");
3385
3386   if (mp->ipv != (u8) ~ 0)
3387     s = format (s, "ip %d ", mp->ipv);
3388
3389   s = format (s, "protocol %d ", mp->l4_protocol);
3390
3391   if (mp->l4_port != (u16) ~ 0)
3392     s = format (s, "port %d ", ntohs (mp->l4_port));
3393
3394   if (!mp->is_add)
3395     s = format (s, "del ");
3396
3397   FINISH;
3398 }
3399
3400 static void *vl_api_flow_classify_dump_t_print
3401   (vl_api_flow_classify_dump_t * mp, void *handle)
3402 {
3403   u8 *s;
3404
3405   s = format (0, "SCRIPT: flow_classify_dump ");
3406   switch (mp->type)
3407     {
3408     case FLOW_CLASSIFY_TABLE_IP4:
3409       s = format (s, "type ip4 ");
3410       break;
3411     case FLOW_CLASSIFY_TABLE_IP6:
3412       s = format (s, "type ip6 ");
3413       break;
3414     default:
3415       break;
3416     }
3417
3418   FINISH;
3419 }
3420
3421 static void *vl_api_get_first_msg_id_t_print
3422   (vl_api_get_first_msg_id_t * mp, void *handle)
3423 {
3424   u8 *s;
3425
3426   s = format (0, "SCRIPT: get_first_msg_id %s ", mp->name);
3427
3428   FINISH;
3429 }
3430
3431 static void *vl_api_ioam_enable_t_print
3432   (vl_api_ioam_enable_t * mp, void *handle)
3433 {
3434   u8 *s;
3435
3436   s = format (0, "SCRIPT: ioam_enable ");
3437
3438   if (mp->trace_enable)
3439     s = format (s, "trace enabled");
3440
3441   if (mp->pot_enable)
3442     s = format (s, "POT enabled");
3443
3444   if (mp->seqno)
3445     s = format (s, "Seqno enabled");
3446
3447   if (mp->analyse)
3448     s = format (s, "Analyse enabled");
3449
3450   FINISH;
3451 }
3452
3453 static void *vl_api_ioam_disable_t_print
3454   (vl_api_ioam_disable_t * mp, void *handle)
3455 {
3456   u8 *s;
3457
3458   s = format (0, "SCRIPT: ioam_disable ");
3459   s = format (s, "trace disabled");
3460   s = format (s, "POT disabled");
3461   s = format (s, "Seqno disabled");
3462   s = format (s, "Analyse disabled");
3463
3464   FINISH;
3465 }
3466
3467 static void *vl_api_feature_enable_disable_t_print
3468   (vl_api_feature_enable_disable_t * mp, void *handle)
3469 {
3470   u8 *s;
3471
3472   s = format (0, "SCRIPT: feature_enable_disable ");
3473   s = format (s, "arc_name %s ", mp->arc_name);
3474   s = format (s, "feature_name %s ", mp->feature_name);
3475   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3476   if (!mp->enable)
3477     s = format (s, "disable");
3478
3479   FINISH;
3480 }
3481
3482 static void *vl_api_sw_interface_tag_add_del_t_print
3483   (vl_api_sw_interface_tag_add_del_t * mp, void *handle)
3484 {
3485   u8 *s;
3486
3487   s = format (0, "SCRIPT: sw_interface_tag_add_del ");
3488   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3489   if (mp->is_add)
3490     s = format (s, "tag %s ", mp->tag);
3491   else
3492     s = format (s, "del ");
3493
3494   FINISH;
3495 }
3496
3497 static void *vl_api_hw_interface_set_mtu_t_print
3498   (vl_api_hw_interface_set_mtu_t * mp, void *handle)
3499 {
3500   u8 *s;
3501
3502   s = format (0, "SCRIPT: sw_interface_set_mtu ");
3503   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3504   s = format (s, "tag %d ", ntohs (mp->mtu));
3505
3506   FINISH;
3507 }
3508
3509 static void *vl_api_p2p_ethernet_add_t_print
3510   (vl_api_p2p_ethernet_add_t * mp, void *handle)
3511 {
3512   u8 *s;
3513
3514   s = format (0, "SCRIPT: p2p_ethernet_add ");
3515   s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
3516   s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
3517
3518   FINISH;
3519 }
3520
3521 static void *vl_api_p2p_ethernet_del_t_print
3522   (vl_api_p2p_ethernet_del_t * mp, void *handle)
3523 {
3524   u8 *s;
3525
3526   s = format (0, "SCRIPT: p2p_ethernet_del ");
3527   s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
3528   s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
3529
3530   FINISH;
3531 }
3532
3533 static void *vl_api_tcp_configure_src_addresses_t_print
3534   (vl_api_tcp_configure_src_addresses_t * mp, void *handle)
3535 {
3536   u8 *s;
3537
3538   s = format (0, "SCRIPT: tcp_configure_src_addresses ");
3539   if (mp->is_ipv6)
3540     s = format (s, "%U - %U ",
3541                 format_ip6_address, (ip6_address_t *) mp->first_address,
3542                 format_ip6_address, (ip6_address_t *) mp->last_address);
3543   else
3544     s = format (s, "%U - %U ",
3545                 format_ip4_address, (ip4_address_t *) mp->first_address,
3546                 format_ip4_address, (ip4_address_t *) mp->last_address);
3547
3548   if (mp->vrf_id)
3549     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
3550
3551   FINISH;
3552 }
3553
3554 static void *vl_api_app_namespace_add_del_t_print
3555   (vl_api_app_namespace_add_del_t * mp, void *handle)
3556 {
3557   u8 *s, *ns_id = 0;
3558   u8 len = clib_min (mp->namespace_id_len,
3559                      ARRAY_LEN (mp->namespace_id) - 1);
3560   mp->namespace_id[len] = 0;
3561   s = format (0, "SCRIPT: app_namespace_add_del ");
3562   s = format (s, "ns-id %s secret %lu sw_if_index %d ipv4_fib_id %d "
3563               "ipv6_fib_id %d", (char *) mp->namespace_id, mp->secret,
3564               clib_net_to_host_u32 (mp->sw_if_index),
3565               clib_net_to_host_u32 (mp->ip4_fib_id),
3566               clib_net_to_host_u32 (mp->ip6_fib_id));
3567   FINISH;
3568 }
3569
3570 static void *vl_api_lldp_config_t_print
3571   (vl_api_lldp_config_t * mp, void *handle)
3572 {
3573   u8 *s;
3574
3575   s = format (0, "SCRIPT: lldp_config ");
3576   s = format (s, "system_name %s ", mp->system_name);
3577   s = format (s, "tx_hold %d ", ntohl (mp->tx_hold));
3578   s = format (s, "tx_interval %d ", ntohl (mp->tx_interval));
3579   FINISH;
3580 }
3581
3582 static void *vl_api_dns_enable_disable_t_print
3583   (vl_api_dns_enable_disable_t * mp, void *handle)
3584 {
3585   u8 *s;
3586
3587   s = format (0, "SCRIPT: dns_enable_disable ");
3588   s = format (s, "%s ", mp->enable ? "enable" : "disable");
3589
3590   FINISH;
3591 }
3592
3593 static void *vl_api_sw_interface_set_lldp_t_print
3594   (vl_api_sw_interface_set_lldp_t * mp, void *handle)
3595 {
3596   u8 *s;
3597   u8 null_data[256];
3598
3599   clib_memset (null_data, 0, sizeof (null_data));
3600
3601   s = format (0, "SCRIPT: sw_interface_set_lldp ");
3602   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3603
3604   if (memcmp (mp->port_desc, null_data, sizeof (mp->port_desc)))
3605     s = format (s, "port_desc %s ", mp->port_desc);
3606
3607   if (memcmp (mp->mgmt_ip4, null_data, sizeof (mp->mgmt_ip4)))
3608     s = format (s, "mgmt_ip4 %U ", format_ip4_address, mp->mgmt_ip4);
3609
3610   if (memcmp (mp->mgmt_ip6, null_data, sizeof (mp->mgmt_ip6)))
3611     s = format (s, "mgmt_ip6 %U ", format_ip6_address, mp->mgmt_ip6);
3612
3613   if (memcmp (mp->mgmt_oid, null_data, sizeof (mp->mgmt_oid)))
3614     s = format (s, "mgmt_oid %s ", mp->mgmt_oid);
3615
3616   if (mp->enable == 0)
3617     s = format (s, "disable ");
3618
3619   FINISH;
3620 }
3621
3622 static void *vl_api_dns_name_server_add_del_t_print
3623   (vl_api_dns_name_server_add_del_t * mp, void *handle)
3624 {
3625   u8 *s;
3626
3627   s = format (0, "SCRIPT: dns_name_server_add_del ");
3628   if (mp->is_ip6)
3629     s = format (s, "%U ", format_ip6_address,
3630                 (ip6_address_t *) mp->server_address);
3631   else
3632     s = format (s, "%U ", format_ip4_address,
3633                 (ip4_address_t *) mp->server_address);
3634
3635   if (mp->is_add == 0)
3636     s = format (s, "del ");
3637
3638   FINISH;
3639 }
3640
3641 static void *vl_api_dns_resolve_name_t_print
3642   (vl_api_dns_resolve_name_t * mp, void *handle)
3643 {
3644   u8 *s;
3645
3646   s = format (0, "SCRIPT: dns_resolve_name ");
3647   s = format (s, "%s ", mp->name);
3648   FINISH;
3649 }
3650
3651 static void *vl_api_dns_resolve_ip_t_print
3652   (vl_api_dns_resolve_ip_t * mp, void *handle)
3653 {
3654   u8 *s;
3655
3656   s = format (0, "SCRIPT: dns_resolve_ip ");
3657   if (mp->is_ip6)
3658     s = format (s, "%U ", format_ip6_address, mp->address);
3659   else
3660     s = format (s, "%U ", format_ip4_address, mp->address);
3661   FINISH;
3662 }
3663
3664 static void *vl_api_session_rule_add_del_t_print
3665   (vl_api_session_rule_add_del_t * mp, void *handle)
3666 {
3667   u8 *s;
3668   char *proto = mp->transport_proto == 0 ? "tcp" : "udp";
3669   s = format (0, "SCRIPT: session_rule_add_del ");
3670   mp->tag[sizeof (mp->tag) - 1] = 0;
3671   if (mp->is_ip4)
3672     s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s",
3673                 mp->appns_index, mp->scope, proto, format_ip4_address,
3674                 (ip4_address_t *) mp->lcl_ip, mp->lcl_plen,
3675                 format_ip4_address, (ip4_address_t *) mp->rmt_ip,
3676                 mp->rmt_plen, mp->action_index, mp->tag);
3677   else
3678     s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s",
3679                 mp->appns_index, mp->scope, proto, format_ip6_address,
3680                 (ip6_address_t *) mp->lcl_ip, mp->lcl_plen,
3681                 format_ip6_address, (ip6_address_t *) mp->rmt_ip,
3682                 mp->rmt_plen, mp->action_index, mp->tag);
3683   FINISH;
3684 }
3685
3686 static void *vl_api_ip_container_proxy_add_del_t_print
3687   (vl_api_ip_container_proxy_add_del_t * mp, void *handle)
3688 {
3689   u8 *s;
3690   s = format (0, "SCRIPT: ip_container_proxy_add_del ");
3691   if (mp->is_ip4)
3692     s = format (s, "is_add %d address %U/%d sw_if_index %d",
3693                 mp->is_add, format_ip4_address,
3694                 (ip4_address_t *) mp->ip, mp->plen, mp->sw_if_index);
3695   else
3696     s = format (s, "is_add %d address %U/%d sw_if_index %d",
3697                 mp->is_add, format_ip6_address,
3698                 (ip6_address_t *) mp->ip, mp->plen, mp->sw_if_index);
3699   FINISH;
3700 }
3701
3702 static void *vl_api_qos_record_enable_disable_t_print
3703   (vl_api_qos_record_enable_disable_t * mp, void *handle)
3704 {
3705   u8 *s;
3706
3707   s = format (0, "SCRIPT: qos_record_enable_disable ");
3708   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3709   s =
3710     format (s, "input_source %U ", format_qos_source,
3711             ntohl (mp->input_source));
3712
3713   if (!mp->enable)
3714     s = format (s, "disable ");
3715
3716   FINISH;
3717 }
3718
3719 #define foreach_custom_print_no_arg_function                            \
3720 _(lisp_eid_table_vni_dump)                                              \
3721 _(lisp_map_resolver_dump)                                               \
3722 _(lisp_map_server_dump)                                                 \
3723 _(show_lisp_rloc_probe_state)                                           \
3724 _(show_lisp_map_register_state)                                         \
3725 _(show_lisp_map_request_mode)
3726
3727 #define _(f)                                                            \
3728 static void * vl_api_ ## f ## _t_print                                  \
3729   (vl_api_ ## f ## _t * mp, void * handle)                              \
3730 {                                                                       \
3731   u8 * s;                                                               \
3732   s = format (0, "SCRIPT: " #f );                                       \
3733   FINISH;                                                               \
3734 }
3735 foreach_custom_print_no_arg_function
3736 #undef _
3737 #define foreach_custom_print_function                                   \
3738 _(CREATE_LOOPBACK, create_loopback)                                     \
3739 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance)                   \
3740 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags)                       \
3741 _(SW_INTERFACE_EVENT, sw_interface_event)                               \
3742 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address)           \
3743 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table)                       \
3744 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable)           \
3745 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath)                       \
3746 _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass)         \
3747 _(SW_INTERFACE_SET_GENEVE_BYPASS, sw_interface_set_geneve_bypass)       \
3748 _(TAP_CONNECT, tap_connect)                                             \
3749 _(TAP_MODIFY, tap_modify)                                               \
3750 _(TAP_DELETE, tap_delete)                                               \
3751 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump)                         \
3752 _(BOND_CREATE, bond_create)                                             \
3753 _(BOND_DELETE, bond_delete)                                             \
3754 _(BOND_ENSLAVE, bond_enslave)                                           \
3755 _(BOND_DETACH_SLAVE, bond_detach_slave)                                 \
3756 _(TAP_CREATE_V2, tap_create_v2)                                         \
3757 _(TAP_DELETE_V2, tap_delete_v2)                                         \
3758 _(SW_INTERFACE_TAP_V2_DUMP, sw_interface_tap_v2_dump)                   \
3759 _(IP_ADD_DEL_ROUTE, ip_add_del_route)                                   \
3760 _(IP_TABLE_ADD_DEL, ip_table_add_del)                                   \
3761 _(MPLS_ROUTE_ADD_DEL, mpls_route_add_del)                               \
3762 _(MPLS_TABLE_ADD_DEL, mpls_table_add_del)                               \
3763 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del)                                 \
3764 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable)       \
3765 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del)                             \
3766 _(SR_MPLS_POLICY_ADD, sr_mpls_policy_add)                               \
3767 _(SR_MPLS_POLICY_DEL, sr_mpls_policy_del)                               \
3768 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered)             \
3769 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del)                             \
3770 _(CREATE_VLAN_SUBIF, create_vlan_subif)                                 \
3771 _(CREATE_SUBIF, create_subif)                                           \
3772 _(OAM_ADD_DEL, oam_add_del)                                             \
3773 _(RESET_FIB, reset_fib)                                                 \
3774 _(DHCP_PROXY_CONFIG, dhcp_proxy_config)                                 \
3775 _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss)                               \
3776 _(SET_IP_FLOW_HASH, set_ip_flow_hash)                                   \
3777 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS,                              \
3778   sw_interface_ip6_set_link_local_address)                              \
3779 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix)           \
3780 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config)           \
3781 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit)                       \
3782 _(L2_PATCH_ADD_DEL, l2_patch_add_del)                                   \
3783 _(SR_LOCALSID_ADD_DEL, sr_localsid_add_del)                             \
3784 _(SR_STEERING_ADD_DEL, sr_steering_add_del)                             \
3785 _(SR_POLICY_ADD, sr_policy_add)                                         \
3786 _(SR_POLICY_MOD, sr_policy_mod)                                         \
3787 _(SR_POLICY_DEL, sr_policy_del)                                         \
3788 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect)           \
3789 _(L2FIB_ADD_DEL, l2fib_add_del)                                         \
3790 _(L2FIB_FLUSH_ALL, l2fib_flush_all)                                     \
3791 _(L2FIB_FLUSH_BD, l2fib_flush_bd)                                       \
3792 _(L2FIB_FLUSH_INT, l2fib_flush_int)                                     \
3793 _(L2_FLAGS, l2_flags)                                                   \
3794 _(BRIDGE_FLAGS, bridge_flags)                                           \
3795 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table)                       \
3796 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session)                   \
3797 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge)               \
3798 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del)                         \
3799 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump)                               \
3800 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age)                 \
3801 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table)     \
3802 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables)   \
3803 _(ADD_NODE_NEXT, add_node_next)                                         \
3804 _(DHCP_CLIENT_CONFIG, dhcp_client_config)                               \
3805 _(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel)                           \
3806 _(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies)                 \
3807 _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable)     \
3808 _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key)                         \
3809 _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump)                   \
3810 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel)                           \
3811 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump)                                 \
3812 _(VXLAN_OFFLOAD_RX, vxlan_offload_rx)                                   \
3813 _(GENEVE_ADD_DEL_TUNNEL, geneve_add_del_tunnel)                         \
3814 _(GENEVE_TUNNEL_DUMP, geneve_tunnel_dump)                               \
3815 _(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel)                               \
3816 _(GRE_TUNNEL_DUMP, gre_tunnel_dump)                                     \
3817 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table)                               \
3818 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter)                     \
3819 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite)         \
3820 _(CREATE_VHOST_USER_IF, create_vhost_user_if)                           \
3821 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if)                           \
3822 _(DELETE_VHOST_USER_IF, delete_vhost_user_if)                           \
3823 _(SW_INTERFACE_DUMP, sw_interface_dump)                                 \
3824 _(CONTROL_PING, control_ping)                                           \
3825 _(WANT_INTERFACE_EVENTS, want_interface_events)                         \
3826 _(CLI, cli)                                                             \
3827 _(CLI_INBAND, cli_inband)                                               \
3828 _(MEMCLNT_CREATE, memclnt_create)                                       \
3829 _(SOCKCLNT_CREATE, sockclnt_create)                                     \
3830 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump)           \
3831 _(SHOW_VERSION, show_version)                                           \
3832 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump)                                 \
3833 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel)                   \
3834 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump)                         \
3835 _(INTERFACE_NAME_RENUMBER, interface_name_renumber)                     \
3836 _(IP_PROBE_NEIGHBOR, ip_probe_neighbor)                                 \
3837 _(IP_SCAN_NEIGHBOR_ENABLE_DISABLE, ip_scan_neighbor_enable_disable)     \
3838 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events)                             \
3839 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events)                               \
3840 _(WANT_L2_MACS_EVENTS, want_l2_macs_events)                             \
3841 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface)                     \
3842 _(IP_ADDRESS_DUMP, ip_address_dump)                                     \
3843 _(IP_DUMP, ip_dump)                                                     \
3844 _(DELETE_LOOPBACK, delete_loopback)                                     \
3845 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del)                                 \
3846 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable)           \
3847 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable)           \
3848 _(AF_PACKET_CREATE, af_packet_create)                                   \
3849 _(AF_PACKET_DELETE, af_packet_delete)                                   \
3850 _(AF_PACKET_DUMP, af_packet_dump)                                       \
3851 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats)                   \
3852 _(MPLS_FIB_DUMP, mpls_fib_dump)                                         \
3853 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump)                                   \
3854 _(CLASSIFY_TABLE_IDS,classify_table_ids)                                \
3855 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface)             \
3856 _(CLASSIFY_TABLE_INFO,classify_table_info)                              \
3857 _(CLASSIFY_SESSION_DUMP,classify_session_dump)                          \
3858 _(SET_IPFIX_EXPORTER, set_ipfix_exporter)                               \
3859 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump)                             \
3860 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream)                 \
3861 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump)               \
3862 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del)           \
3863 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump)                 \
3864 _(SW_INTERFACE_SPAN_ENABLE_DISABLE, sw_interface_span_enable_disable)   \
3865 _(SW_INTERFACE_SPAN_DUMP, sw_interface_span_dump)                       \
3866 _(GET_NEXT_INDEX, get_next_index)                                       \
3867 _(PG_CREATE_INTERFACE,pg_create_interface)                              \
3868 _(PG_CAPTURE, pg_capture)                                               \
3869 _(PG_ENABLE_DISABLE, pg_enable_disable)                                 \
3870 _(POLICER_ADD_DEL, policer_add_del)                                     \
3871 _(POLICER_DUMP, policer_dump)                                           \
3872 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface)       \
3873 _(POLICER_CLASSIFY_DUMP, policer_classify_dump)                         \
3874 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL,                               \
3875   ip_source_and_port_range_check_add_del)                               \
3876 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL,                     \
3877   ip_source_and_port_range_check_interface_add_del)                     \
3878 _(LISP_ENABLE_DISABLE, lisp_enable_disable)                             \
3879 _(GPE_ENABLE_DISABLE, gpe_enable_disable)                               \
3880 _(GPE_ADD_DEL_IFACE, gpe_add_del_iface)                                 \
3881 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set)                 \
3882 _(LISP_MAP_REQUEST_MODE, lisp_map_request_mode)                         \
3883 _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode)               \
3884 _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping)             \
3885 _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency)                       \
3886 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS,                                   \
3887   lisp_add_del_map_request_itr_rlocs)                                   \
3888 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map)               \
3889 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid)                       \
3890 _(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry)                         \
3891 _(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set)                   \
3892 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver)                 \
3893 _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator)                           \
3894 _(LISP_EID_TABLE_DUMP, lisp_eid_table_dump)                             \
3895 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump)                     \
3896 _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump)                     \
3897 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump)                       \
3898 _(LISP_MAP_SERVER_DUMP, lisp_map_server_dump)                           \
3899 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump)                         \
3900 _(LISP_LOCATOR_DUMP, lisp_locator_dump)                                 \
3901 _(LISP_ADJACENCIES_GET, lisp_adjacencies_get)                           \
3902 _(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state)               \
3903 _(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state)           \
3904 _(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable)       \
3905 _(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable)   \
3906 _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel)                   \
3907 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump)                         \
3908 _(DELETE_SUBIF, delete_subif)                                           \
3909 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite)           \
3910 _(PUNT, punt)                                                           \
3911 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface)             \
3912 _(FLOW_CLASSIFY_DUMP, flow_classify_dump)                               \
3913 _(GET_FIRST_MSG_ID, get_first_msg_id)                                   \
3914 _(IOAM_ENABLE, ioam_enable)                                             \
3915 _(IOAM_DISABLE, ioam_disable)                                           \
3916 _(IP_FIB_DUMP, ip_fib_dump)                                             \
3917 _(IP6_FIB_DUMP, ip6_fib_dump)                                           \
3918 _(FEATURE_ENABLE_DISABLE, feature_enable_disable)                       \
3919 _(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del)                   \
3920 _(HW_INTERFACE_SET_MTU, hw_interface_set_mtu)                           \
3921 _(P2P_ETHERNET_ADD, p2p_ethernet_add)                                   \
3922 _(P2P_ETHERNET_DEL, p2p_ethernet_del)                                   \
3923 _(TCP_CONFIGURE_SRC_ADDRESSES, tcp_configure_src_addresses)             \
3924 _(APP_NAMESPACE_ADD_DEL, app_namespace_add_del)                         \
3925 _(LLDP_CONFIG, lldp_config)                                             \
3926 _(SW_INTERFACE_SET_LLDP, sw_interface_set_lldp)                         \
3927 _(DNS_ENABLE_DISABLE, dns_enable_disable)                               \
3928 _(DNS_NAME_SERVER_ADD_DEL, dns_name_server_add_del)                     \
3929 _(DNS_RESOLVE_NAME, dns_resolve_name)                                   \
3930 _(DNS_RESOLVE_IP, dns_resolve_ip)                                       \
3931 _(SESSION_RULE_ADD_DEL, session_rule_add_del)                           \
3932 _(OUTPUT_ACL_SET_INTERFACE, output_acl_set_interface)                   \
3933 _(QOS_RECORD_ENABLE_DISABLE, qos_record_enable_disable)
3934   void
3935 vl_msg_api_custom_dump_configure (api_main_t * am)
3936 {
3937 #define _(n,f) am->msg_print_handlers[VL_API_##n]       \
3938     = (void *) vl_api_##f##_t_print;
3939   foreach_custom_print_function;
3940 #undef _
3941 }
3942
3943 /*
3944  * fd.io coding-style-patch-verification: ON
3945  *
3946  * Local Variables: eval: (c-set-style "gnu") End:
3947  */