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