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