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