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