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