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