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