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