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