VPP-355: add PBB (802.1ah) tag rewrite
[vpp.git] / vpp / vpp-api / custom_dump.c
1 /*
2  *------------------------------------------------------------------
3  * custom_dump.c - pretty-print API messages for replay
4  *
5  * Copyright (c) 2014 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/proxy.h>
25 #include <vnet/dhcpv6/proxy.h>
26 #include <vnet/l2tp/l2tp.h>
27 #include <vnet/l2/l2_input.h>
28 #include <vnet/sr/sr_packet.h>
29 #include <vnet/vxlan-gpe/vxlan_gpe.h>
30 #include <vnet/classify/policer_classify.h>
31 #include <vnet/policer/xlate.h>
32 #include <vnet/policer/policer.h>
33 #include <vlib/vlib.h>
34 #include <vlib/unix/unix.h>
35 #include <vlibapi/api.h>
36 #include <vlibmemory/api.h>
37
38 #include <stats/stats.h>
39 #include <oam/oam.h>
40
41 #include <vnet/ethernet/ethernet.h>
42 #include <vnet/l2/l2_vtr.h>
43
44 #include <vpp-api/vpe_msg_enum.h>
45
46 #define vl_typedefs             /* define message structures */
47 #include <vpp-api/vpe_all_api_h.h>
48 #undef vl_typedefs
49
50 #define vl_endianfun            /* define message structures */
51 #include <vpp-api/vpe_all_api_h.h>
52 #undef vl_endianfun
53
54 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
55
56 #define FINISH                                  \
57     vec_add1 (s, 0);                            \
58     vl_print (handle, (char *)s);               \
59     vec_free (s);                               \
60     return handle;
61
62
63 static void *vl_api_create_loopback_t_print
64   (vl_api_create_loopback_t * mp, void *handle)
65 {
66   u8 *s;
67
68   s = format (0, "SCRIPT: create_loopback ");
69   s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
70
71   FINISH;
72 }
73
74 static void *vl_api_delete_loopback_t_print
75   (vl_api_delete_loopback_t * mp, void *handle)
76 {
77   u8 *s;
78
79   s = format (0, "SCRIPT: delete_loopback ");
80   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
81
82   FINISH;
83 }
84
85 static void *vl_api_sw_interface_set_flags_t_print
86   (vl_api_sw_interface_set_flags_t * mp, void *handle)
87 {
88   u8 *s;
89   s = format (0, "SCRIPT: sw_interface_set_flags ");
90
91   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
92
93   if (mp->admin_up_down)
94     s = format (s, "admin-up ");
95   else
96     s = format (s, "admin-down ");
97
98   if (mp->link_up_down)
99     s = format (s, "link-up");
100   else
101     s = format (s, "link-down");
102
103   FINISH;
104 }
105
106 static void *vl_api_sw_interface_add_del_address_t_print
107   (vl_api_sw_interface_add_del_address_t * mp, void *handle)
108 {
109   u8 *s;
110
111   s = format (0, "SCRIPT: sw_interface_add_del_address ");
112
113   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
114
115   if (mp->is_ipv6)
116     s = format (s, "%U/%d ", format_ip6_address,
117                 (ip6_address_t *) mp->address, mp->address_length);
118   else
119     s = format (s, "%U/%d ", format_ip4_address,
120                 (ip4_address_t *) mp->address, mp->address_length);
121
122   if (mp->is_add == 0)
123     s = format (s, "del ");
124   if (mp->del_all)
125     s = format (s, "del-all ");
126
127   FINISH;
128 }
129
130 static void *vl_api_sw_interface_set_table_t_print
131   (vl_api_sw_interface_set_table_t * mp, void *handle)
132 {
133   u8 *s;
134
135   s = format (0, "SCRIPT: sw_interface_set_table ");
136
137   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
138
139   if (mp->vrf_id)
140     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
141
142   if (mp->is_ipv6)
143     s = format (s, "ipv6 ");
144
145   FINISH;
146 }
147
148 static void *vl_api_sw_interface_set_vpath_t_print
149   (vl_api_sw_interface_set_vpath_t * mp, void *handle)
150 {
151   u8 *s;
152
153   s = format (0, "SCRIPT: sw_interface_set_vpath ");
154
155   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
156
157   if (mp->enable)
158     s = format (s, "vPath enable ");
159   else
160     s = format (s, "vPath disable ");
161
162   FINISH;
163 }
164
165 static void *vl_api_sw_interface_set_l2_xconnect_t_print
166   (vl_api_sw_interface_set_l2_xconnect_t * mp, void *handle)
167 {
168   u8 *s;
169
170   s = format (0, "SCRIPT: sw_interface_set_l2_xconnect ");
171
172   s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
173
174   if (mp->enable)
175     {
176       s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
177     }
178   else
179     s = format (s, "delete ");
180
181   FINISH;
182 }
183
184 static void *vl_api_sw_interface_set_l2_bridge_t_print
185   (vl_api_sw_interface_set_l2_bridge_t * mp, void *handle)
186 {
187   u8 *s;
188
189   s = format (0, "SCRIPT: sw_interface_set_l2_bridge ");
190
191   s = format (s, "sw_if_index %d ", ntohl (mp->rx_sw_if_index));
192
193   if (mp->enable)
194     {
195       s = format (s, "bd_id %d shg %d %senable ", ntohl (mp->bd_id),
196                   mp->shg, ((mp->bvi) ? "bvi " : " "));
197     }
198   else
199     s = format (s, "disable ");
200
201   FINISH;
202 }
203
204 static void *vl_api_sw_interface_set_dpdk_hqos_pipe_t_print
205   (vl_api_sw_interface_set_dpdk_hqos_pipe_t * mp, void *handle)
206 {
207   u8 *s;
208
209   s = format (0, "SCRIPT: sw_interface_set_dpdk_hqos_pipe ");
210
211   s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index));
212
213   s = format (s, "subport %u  pipe %u  profile %u ",
214               ntohl (mp->subport), ntohl (mp->pipe), ntohl (mp->profile));
215
216   FINISH;
217 }
218
219 static void *vl_api_sw_interface_set_dpdk_hqos_subport_t_print
220   (vl_api_sw_interface_set_dpdk_hqos_subport_t * mp, void *handle)
221 {
222   u8 *s;
223
224   s = format (0, "SCRIPT: sw_interface_set_dpdk_hqos_subport ");
225
226   s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index));
227
228   s =
229     format (s,
230             "subport %u  rate %u  bkt_size %u  tc0 %u tc1 %u tc2 %u tc3 %u period %u",
231             ntohl (mp->subport), ntohl (mp->tb_rate), ntohl (mp->tb_size),
232             ntohl (mp->tc_rate[0]), ntohl (mp->tc_rate[1]),
233             ntohl (mp->tc_rate[2]), ntohl (mp->tc_rate[3]),
234             ntohl (mp->tc_period));
235
236   FINISH;
237 }
238
239 static void *vl_api_sw_interface_set_dpdk_hqos_tctbl_t_print
240   (vl_api_sw_interface_set_dpdk_hqos_tctbl_t * mp, void *handle)
241 {
242   u8 *s;
243
244   s = format (0, "SCRIPT: sw_interface_set_dpdk_hqos_tctbl ");
245
246   s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index));
247
248   s = format (s, "entry %u  tc %u  queue %u",
249               ntohl (mp->entry), ntohl (mp->tc), ntohl (mp->queue));
250
251   FINISH;
252 }
253
254 static void *vl_api_bridge_domain_add_del_t_print
255   (vl_api_bridge_domain_add_del_t * mp, void *handle)
256 {
257   u8 *s;
258
259   s = format (0, "SCRIPT: bridge_domain_add_del ");
260
261   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
262
263   if (mp->is_add)
264     {
265       s = format (s, "flood %d uu-flood %d forward %d learn %d arp-term %d",
266                   mp->flood, mp->uu_flood, mp->forward, mp->learn,
267                   mp->arp_term);
268     }
269   else
270     s = format (s, "del ");
271
272   FINISH;
273 }
274
275 static void *vl_api_bridge_domain_dump_t_print
276   (vl_api_bridge_domain_dump_t * mp, void *handle)
277 {
278   u8 *s;
279   u32 bd_id = ntohl (mp->bd_id);
280
281   s = format (0, "SCRIPT: bridge_domain_dump ");
282
283   if (bd_id != ~0)
284     s = format (s, "bd_id %d ", bd_id);
285
286   FINISH;
287 }
288
289 static void *vl_api_l2fib_add_del_t_print
290   (vl_api_l2fib_add_del_t * mp, void *handle)
291 {
292   u8 *s;
293
294   s = format (0, "SCRIPT: l2fib_add_del ");
295
296   s = format (s, "mac %U ", format_ethernet_address, &mp->mac);
297
298   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
299
300
301   if (mp->is_add)
302     {
303       s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
304       if (mp->static_mac)
305         s = format (s, "%s", "static ");
306       if (mp->filter_mac)
307         s = format (s, "%s", "filter ");
308       if (mp->bvi_mac)
309         s = format (s, "%s", "bvi ");
310     }
311   else
312     {
313       s = format (s, "del ");
314     }
315
316   FINISH;
317 }
318
319 static void *
320 vl_api_l2_flags_t_print (vl_api_l2_flags_t * mp, void *handle)
321 {
322   u8 *s;
323   u32 flags = ntohl (mp->feature_bitmap);
324
325   s = format (0, "SCRIPT: l2_flags ");
326
327   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
328
329 #define _(a,b) \
330     if (flags & L2INPUT_FEAT_ ## a) s = format (s, #a " ");
331   foreach_l2input_feat;
332 #undef _
333
334   FINISH;
335 }
336
337 static void *vl_api_bridge_flags_t_print
338   (vl_api_bridge_flags_t * mp, void *handle)
339 {
340   u8 *s;
341   u32 flags = ntohl (mp->feature_bitmap);
342
343   s = format (0, "SCRIPT: bridge_flags ");
344
345   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
346
347   if (flags & L2_LEARN)
348     s = format (s, "learn ");
349   if (flags & L2_FWD)
350     s = format (s, "forward ");
351   if (flags & L2_FLOOD)
352     s = format (s, "flood ");
353   if (flags & L2_UU_FLOOD)
354     s = format (s, "uu-flood ");
355   if (flags & L2_ARP_TERM)
356     s = format (s, "arp-term ");
357
358   if (mp->is_set == 0)
359     s = format (s, "clear ");
360
361   FINISH;
362 }
363
364 static void *vl_api_bd_ip_mac_add_del_t_print
365   (vl_api_bd_ip_mac_add_del_t * mp, void *handle)
366 {
367   u8 *s;
368
369   s = format (0, "SCRIPT: bd_ip_mac_add_del ");
370   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
371
372   if (mp->is_ipv6)
373     s = format (s, "%U ", format_ip6_address,
374                 (ip6_address_t *) mp->ip_address);
375   else
376     s = format (s, "%U ", format_ip4_address,
377                 (ip4_address_t *) mp->ip_address);
378
379   s = format (s, "%U ", format_ethernet_address, mp->mac_address);
380   if (mp->is_add == 0)
381     s = format (s, "del ");
382
383   FINISH;
384 }
385
386 static void *vl_api_tap_connect_t_print
387   (vl_api_tap_connect_t * mp, void *handle)
388 {
389   u8 *s;
390   u8 null_mac[6];
391
392   memset (null_mac, 0, sizeof (null_mac));
393
394   s = format (0, "SCRIPT: tap_connect ");
395   s = format (s, "tapname %s ", mp->tap_name);
396   if (mp->use_random_mac)
397     s = format (s, "random-mac ");
398
399   if (memcmp (mp->mac_address, null_mac, 6))
400     s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
401
402   FINISH;
403 }
404
405 static void *vl_api_tap_modify_t_print
406   (vl_api_tap_modify_t * mp, void *handle)
407 {
408   u8 *s;
409   u8 null_mac[6];
410
411   memset (null_mac, 0, sizeof (null_mac));
412
413   s = format (0, "SCRIPT: tap_modify ");
414   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
415   s = format (s, "tapname %s ", mp->tap_name);
416   if (mp->use_random_mac)
417     s = format (s, "random-mac ");
418
419   if (memcmp (mp->mac_address, null_mac, 6))
420     s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
421
422   FINISH;
423 }
424
425 static void *vl_api_tap_delete_t_print
426   (vl_api_tap_delete_t * mp, void *handle)
427 {
428   u8 *s;
429
430   s = format (0, "SCRIPT: tap_delete ");
431   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
432
433   FINISH;
434 }
435
436 static void *vl_api_sw_interface_tap_dump_t_print
437   (vl_api_sw_interface_tap_dump_t * mp, void *handle)
438 {
439   u8 *s;
440
441   s = format (0, "SCRIPT: sw_interface_tap_dump ");
442
443   FINISH;
444 }
445
446
447 static void *vl_api_ip_add_del_route_t_print
448   (vl_api_ip_add_del_route_t * mp, void *handle)
449 {
450   u8 *s;
451
452   s = format (0, "SCRIPT: ip_add_del_route ");
453   if (mp->is_add == 0)
454     s = format (s, "del ");
455
456   if (mp->next_hop_sw_if_index)
457     s = format (s, "sw_if_index %d ", ntohl (mp->next_hop_sw_if_index));
458
459   if (mp->is_ipv6)
460     s = format (s, "%U/%d ", format_ip6_address, mp->dst_address,
461                 mp->dst_address_length);
462   else
463     s = format (s, "%U/%d ", format_ip4_address, mp->dst_address,
464                 mp->dst_address_length);
465   if (mp->is_local)
466     s = format (s, "local ");
467   else if (mp->is_drop)
468     s = format (s, "drop ");
469   else if (mp->is_classify)
470     s = format (s, "classify %d", ntohl (mp->classify_table_index));
471   else
472     {
473       if (mp->is_ipv6)
474         s = format (s, "via %U ", format_ip6_address, mp->next_hop_address);
475       else
476         s = format (s, "via %U ", format_ip4_address, mp->next_hop_address);
477     }
478
479   if (mp->vrf_id != 0)
480     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
481
482   if (mp->create_vrf_if_needed)
483     s = format (s, "create-vrf ");
484
485   if (mp->resolve_attempts != 0)
486     s = format (s, "resolve-attempts %d ", ntohl (mp->resolve_attempts));
487
488   if (mp->next_hop_weight != 1)
489     s = format (s, "weight %d ", mp->next_hop_weight);
490
491   if (mp->not_last)
492     s = format (s, "not-last ");
493
494   if (mp->is_multipath)
495     s = format (s, "multipath ");
496
497   if (mp->is_multipath)
498     s = format (s, "multipath ");
499
500   if (mp->lookup_in_vrf)
501     s = format (s, "lookup-in-vrf %d ", ntohl (mp->lookup_in_vrf));
502
503   FINISH;
504 }
505
506 static void *vl_api_proxy_arp_add_del_t_print
507   (vl_api_proxy_arp_add_del_t * mp, void *handle)
508 {
509   u8 *s;
510
511   s = format (0, "SCRIPT: proxy_arp_add_del ");
512
513   s = format (s, "%U - %U ", format_ip4_address, mp->low_address,
514               format_ip4_address, mp->hi_address);
515
516   if (mp->vrf_id)
517     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
518
519   if (mp->is_add == 0)
520     s = format (s, "del ");
521
522   FINISH;
523 }
524
525 static void *vl_api_proxy_arp_intfc_enable_disable_t_print
526   (vl_api_proxy_arp_intfc_enable_disable_t * mp, void *handle)
527 {
528   u8 *s;
529
530   s = format (0, "SCRIPT: proxy_arp_intfc_enable_disable ");
531
532   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
533
534   s = format (s, "enable %d ", mp->enable_disable);
535
536   FINISH;
537 }
538
539 static void *vl_api_mpls_add_del_decap_t_print
540   (vl_api_mpls_add_del_decap_t * mp, void *handle)
541 {
542   u8 *s;
543
544   s = format (0, "SCRIPT: mpls_add_del_decap ");
545
546   s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id));
547
548   s = format (s, "tx_vrf_id %d ", ntohl (mp->tx_vrf_id));
549
550   s = format (s, "label %d ", ntohl (mp->label));
551
552   s = format (s, "next-index %d ", ntohl (mp->next_index));
553
554   if (mp->s_bit == 0)
555     s = format (s, "s-bit-clear ");
556
557   if (mp->is_add == 0)
558     s = format (s, "del ");
559
560   FINISH;
561 }
562
563 static void *vl_api_mpls_add_del_encap_t_print
564   (vl_api_mpls_add_del_encap_t * mp, void *handle)
565 {
566   u8 *s;
567   int i;
568
569   s = format (0, "SCRIPT: mpls_add_del_encap ");
570
571   s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
572
573   s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
574
575   for (i = 0; i < mp->nlabels; i++)
576     s = format (s, "label %d ", ntohl (mp->labels[i]));
577
578   if (mp->is_add == 0)
579     s = format (s, "del ");
580
581   FINISH;
582 }
583
584 static void *vl_api_mpls_gre_add_del_tunnel_t_print
585   (vl_api_mpls_gre_add_del_tunnel_t * mp, void *handle)
586 {
587   u8 *s;
588
589   s = format (0, "SCRIPT: mpls_gre_add_del_tunnel ");
590
591   s = format (s, "src %U ", format_ip4_address, mp->src_address);
592
593   s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
594
595   s = format (s, "adj %U/%d ", format_ip4_address,
596               (ip4_address_t *) mp->intfc_address, mp->intfc_address_length);
597
598   s = format (s, "inner-vrf_id %d ", ntohl (mp->inner_vrf_id));
599
600   s = format (s, "outer-vrf_id %d ", ntohl (mp->outer_vrf_id));
601
602   if (mp->is_add == 0)
603     s = format (s, "del ");
604
605   if (mp->l2_only)
606     s = format (s, "l2-only ");
607
608   FINISH;
609 }
610
611 static void *vl_api_mpls_ethernet_add_del_tunnel_t_print
612   (vl_api_mpls_ethernet_add_del_tunnel_t * mp, void *handle)
613 {
614   u8 *s;
615
616   s = format (0, "SCRIPT: mpls_ethernet_add_del_tunnel ");
617
618   s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
619
620   s = format (s, "dst %U", format_ethernet_address, mp->dst_mac_address);
621
622   s = format (s, "adj %U/%d ", format_ip4_address,
623               (ip4_address_t *) mp->adj_address, mp->adj_address_length);
624
625   s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
626
627   if (mp->l2_only)
628     s = format (s, "l2-only ");
629
630   if (mp->is_add == 0)
631     s = format (s, "del ");
632
633   FINISH;
634 }
635
636 static void *vl_api_mpls_ethernet_add_del_tunnel_2_t_print
637   (vl_api_mpls_ethernet_add_del_tunnel_2_t * mp, void *handle)
638 {
639   u8 *s;
640
641   s = format (0, "SCRIPT: mpls_ethernet_add_del_tunnel_2 ");
642
643   s = format (s, "adj %U/%d ", format_ip4_address,
644               (ip4_address_t *) mp->adj_address, mp->adj_address_length);
645
646   s = format (s, "next-hop %U ", format_ip4_address,
647               (ip4_address_t *) mp->next_hop_ip4_address_in_outer_vrf);
648
649   s = format (s, "inner_vrf_id %d ", ntohl (mp->inner_vrf_id));
650
651   s = format (s, "outer_vrf_id %d ", ntohl (mp->outer_vrf_id));
652
653   s = format (s, "resolve-if-needed %d ", mp->resolve_if_needed);
654
655   s = format (s, "resolve-attempts %d ", ntohl (mp->resolve_attempts));
656
657   if (mp->l2_only)
658     s = format (s, "l2-only ");
659
660   if (mp->is_add == 0)
661     s = format (s, "del ");
662
663   FINISH;
664 }
665
666 static void *vl_api_sw_interface_set_unnumbered_t_print
667   (vl_api_sw_interface_set_unnumbered_t * mp, void *handle)
668 {
669   u8 *s;
670
671   s = format (0, "SCRIPT: sw_interface_set_unnumbered ");
672
673   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
674
675   s = format (s, "unnum_if_index %d ", ntohl (mp->unnumbered_sw_if_index));
676
677   if (mp->is_add == 0)
678     s = format (s, "del ");
679
680   FINISH;
681 }
682
683 static void *vl_api_ip_neighbor_add_del_t_print
684   (vl_api_ip_neighbor_add_del_t * mp, void *handle)
685 {
686   u8 *s;
687   u8 null_mac[6];
688
689   memset (null_mac, 0, sizeof (null_mac));
690
691   s = format (0, "SCRIPT: ip_neighbor_add_del ");
692
693   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
694
695   if (mp->is_static)
696     s = format (s, "is_static ");
697
698   s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
699
700   if (memcmp (mp->mac_address, null_mac, 6))
701     s = format (s, "mac %U ", format_ethernet_address, mp->mac_address);
702
703   if (mp->is_ipv6)
704     s =
705       format (s, "dst %U ", format_ip6_address,
706               (ip6_address_t *) mp->dst_address);
707   else
708     s =
709       format (s, "dst %U ", format_ip4_address,
710               (ip4_address_t *) mp->dst_address);
711
712   if (mp->is_add == 0)
713     s = format (s, "del ");
714
715   FINISH;
716 }
717
718 static void *
719 vl_api_reset_vrf_t_print (vl_api_reset_vrf_t * mp, void *handle)
720 {
721   u8 *s;
722
723   s = format (0, "SCRIPT: reset_vrf ");
724
725   if (mp->vrf_id)
726     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
727
728   if (mp->is_ipv6 != 0)
729     s = format (s, "ipv6 ");
730
731   FINISH;
732 }
733
734 static void *vl_api_create_vlan_subif_t_print
735   (vl_api_create_vlan_subif_t * mp, void *handle)
736 {
737   u8 *s;
738
739   s = format (0, "SCRIPT: create_vlan_subif ");
740
741   if (mp->sw_if_index)
742     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
743
744   if (mp->vlan_id)
745     s = format (s, "vlan_id %d ", ntohl (mp->vlan_id));
746
747   FINISH;
748 }
749
750 #define foreach_create_subif_bit                \
751 _(no_tags)                                      \
752 _(one_tag)                                      \
753 _(two_tags)                                     \
754 _(dot1ad)                                       \
755 _(exact_match)                                  \
756 _(default_sub)                                  \
757 _(outer_vlan_id_any)                            \
758 _(inner_vlan_id_any)
759
760 static void *vl_api_create_subif_t_print
761   (vl_api_create_subif_t * mp, void *handle)
762 {
763   u8 *s;
764
765   s = format (0, "SCRIPT: create_subif ");
766
767   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
768
769   s = format (s, "sub_id %d ", ntohl (mp->sub_id));
770
771   if (mp->outer_vlan_id)
772     s = format (s, "outer_vlan_id %d ", ntohs (mp->outer_vlan_id));
773
774   if (mp->inner_vlan_id)
775     s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
776
777 #define _(a) if (mp->a) s = format (s, "%s ", #a);
778   foreach_create_subif_bit;
779 #undef _
780
781   FINISH;
782 }
783
784 static void *vl_api_delete_subif_t_print
785   (vl_api_delete_subif_t * mp, void *handle)
786 {
787   u8 *s;
788
789   s = format (0, "SCRIPT: delete_subif ");
790   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
791
792   FINISH;
793 }
794
795 static void *vl_api_oam_add_del_t_print
796   (vl_api_oam_add_del_t * mp, void *handle)
797 {
798   u8 *s;
799
800   s = format (0, "SCRIPT: oam_add_del ");
801
802   if (mp->vrf_id)
803     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
804
805   s = format (s, "src %U ", format_ip4_address, mp->src_address);
806
807   s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
808
809   if (mp->is_add == 0)
810     s = format (s, "del ");
811
812   FINISH;
813 }
814
815 static void *
816 vl_api_reset_fib_t_print (vl_api_reset_fib_t * mp, void *handle)
817 {
818   u8 *s;
819
820   s = format (0, "SCRIPT: reset_fib ");
821
822   if (mp->vrf_id)
823     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
824
825   if (mp->is_ipv6 != 0)
826     s = format (s, "ipv6 ");
827
828   FINISH;
829 }
830
831 static void *vl_api_dhcp_proxy_config_t_print
832   (vl_api_dhcp_proxy_config_t * mp, void *handle)
833 {
834   u8 *s;
835
836   s = format (0, "SCRIPT: dhcp_proxy_config ");
837
838   s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
839
840   if (mp->is_ipv6)
841     {
842       s = format (s, "svr %U ", format_ip6_address,
843                   (ip6_address_t *) mp->dhcp_server);
844       s = format (s, "src %U ", format_ip6_address,
845                   (ip6_address_t *) mp->dhcp_src_address);
846     }
847   else
848     {
849       s = format (s, "svr %U ", format_ip4_address,
850                   (ip4_address_t *) mp->dhcp_server);
851       s = format (s, "src %U ", format_ip4_address,
852                   (ip4_address_t *) mp->dhcp_src_address);
853     }
854   if (mp->is_add == 0)
855     s = format (s, "del ");
856
857   s = format (s, "insert-cid %d ", mp->insert_circuit_id);
858
859   FINISH;
860 }
861
862 static void *vl_api_dhcp_proxy_config_2_t_print
863   (vl_api_dhcp_proxy_config_2_t * mp, void *handle)
864 {
865   u8 *s;
866
867   s = format (0, "SCRIPT: dhcp_proxy_config_2 ");
868
869   s = format (s, "rx_vrf_id %d ", ntohl (mp->rx_vrf_id));
870   s = format (s, "server_vrf_id %d ", ntohl (mp->server_vrf_id));
871
872   if (mp->is_ipv6)
873     {
874       s = format (s, "svr %U ", format_ip6_address,
875                   (ip6_address_t *) mp->dhcp_server);
876       s = format (s, "src %U ", format_ip6_address,
877                   (ip6_address_t *) mp->dhcp_src_address);
878     }
879   else
880     {
881       s = format (s, "svr %U ", format_ip4_address,
882                   (ip4_address_t *) mp->dhcp_server);
883       s = format (s, "src %U ", format_ip4_address,
884                   (ip4_address_t *) mp->dhcp_src_address);
885     }
886   if (mp->is_add == 0)
887     s = format (s, "del ");
888
889   s = format (s, "insert-cid %d ", mp->insert_circuit_id);
890
891   FINISH;
892 }
893
894 static void *vl_api_dhcp_proxy_set_vss_t_print
895   (vl_api_dhcp_proxy_set_vss_t * mp, void *handle)
896 {
897   u8 *s;
898
899   s = format (0, "SCRIPT: dhcp_proxy_set_vss ");
900
901   s = format (s, "tbl_id %d ", ntohl (mp->tbl_id));
902
903   s = format (s, "fib_id %d ", ntohl (mp->fib_id));
904
905   s = format (s, "oui %d ", ntohl (mp->oui));
906
907   if (mp->is_ipv6 != 0)
908     s = format (s, "ipv6 ");
909
910   if (mp->is_add == 0)
911     s = format (s, "del ");
912
913   FINISH;
914 }
915
916 static void *vl_api_dhcp_client_config_t_print
917   (vl_api_dhcp_client_config_t * mp, void *handle)
918 {
919   u8 *s;
920
921   s = format (0, "SCRIPT: dhcp_client_config ");
922
923   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
924
925   s = format (s, "hostname %s ", mp->hostname);
926
927   s = format (s, "want_dhcp_event %d ", mp->want_dhcp_event);
928
929   s = format (s, "pid %d ", mp->pid);
930
931   if (mp->is_add == 0)
932     s = format (s, "del ");
933
934   FINISH;
935 }
936
937
938 static void *vl_api_set_ip_flow_hash_t_print
939   (vl_api_set_ip_flow_hash_t * mp, void *handle)
940 {
941   u8 *s;
942
943   s = format (0, "SCRIPT: set_ip_flow_hash ");
944
945   s = format (s, "vrf_id %d ", ntohl (mp->vrf_id));
946
947   if (mp->src)
948     s = format (s, "src ");
949
950   if (mp->dst)
951     s = format (s, "dst ");
952
953   if (mp->sport)
954     s = format (s, "sport ");
955
956   if (mp->dport)
957     s = format (s, "dport ");
958
959   if (mp->proto)
960     s = format (s, "proto ");
961
962   if (mp->reverse)
963     s = format (s, "reverse ");
964
965   if (mp->is_ipv6 != 0)
966     s = format (s, "ipv6 ");
967
968   FINISH;
969 }
970
971 static void *vl_api_sw_interface_ip6_set_link_local_address_t_print
972   (vl_api_sw_interface_ip6_set_link_local_address_t * mp, void *handle)
973 {
974   u8 *s;
975
976   s = format (0, "SCRIPT: sw_interface_ip6_set_link_local_address ");
977
978   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
979
980   s = format (s, "%U/%d ", format_ip6_address, mp->address,
981               mp->address_length);
982
983   FINISH;
984 }
985
986 static void *vl_api_sw_interface_ip6nd_ra_prefix_t_print
987   (vl_api_sw_interface_ip6nd_ra_prefix_t * mp, void *handle)
988 {
989   u8 *s;
990
991   s = format (0, "SCRIPT: sw_interface_ip6nd_ra_prefix ");
992
993   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
994
995   s = format (s, "%U/%d ", format_ip6_address, mp->address,
996               mp->address_length);
997
998   s = format (s, "val_life %d ", ntohl (mp->val_lifetime));
999
1000   s = format (s, "pref_life %d ", ntohl (mp->pref_lifetime));
1001
1002   if (mp->use_default)
1003     s = format (s, "def ");
1004
1005   if (mp->no_advertise)
1006     s = format (s, "noadv ");
1007
1008   if (mp->off_link)
1009     s = format (s, "offl ");
1010
1011   if (mp->no_autoconfig)
1012     s = format (s, "noauto ");
1013
1014   if (mp->no_onlink)
1015     s = format (s, "nolink ");
1016
1017   if (mp->is_no)
1018     s = format (s, "isno ");
1019
1020   FINISH;
1021 }
1022
1023 static void *vl_api_sw_interface_ip6nd_ra_config_t_print
1024   (vl_api_sw_interface_ip6nd_ra_config_t * mp, void *handle)
1025 {
1026   u8 *s;
1027
1028   s = format (0, "SCRIPT: sw_interface_ip6nd_ra_config ");
1029
1030   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1031
1032   s = format (s, "maxint %d ", ntohl (mp->max_interval));
1033
1034   s = format (s, "minint %d ", ntohl (mp->min_interval));
1035
1036   s = format (s, "life %d ", ntohl (mp->lifetime));
1037
1038   s = format (s, "count %d ", ntohl (mp->initial_count));
1039
1040   s = format (s, "interval %d ", ntohl (mp->initial_interval));
1041
1042   if (mp->suppress)
1043     s = format (s, "suppress ");
1044
1045   if (mp->managed)
1046     s = format (s, "managed ");
1047
1048   if (mp->other)
1049     s = format (s, "other ");
1050
1051   if (mp->ll_option)
1052     s = format (s, "ll ");
1053
1054   if (mp->send_unicast)
1055     s = format (s, "send ");
1056
1057   if (mp->cease)
1058     s = format (s, "cease ");
1059
1060   if (mp->is_no)
1061     s = format (s, "isno ");
1062
1063   if (mp->default_router)
1064     s = format (s, "def ");
1065
1066   FINISH;
1067 }
1068
1069 static void *vl_api_set_arp_neighbor_limit_t_print
1070   (vl_api_set_arp_neighbor_limit_t * mp, void *handle)
1071 {
1072   u8 *s;
1073
1074   s = format (0, "SCRIPT: set_arp_neighbor_limit ");
1075
1076   s = format (s, "arp_nbr_limit %d ", ntohl (mp->arp_neighbor_limit));
1077
1078   if (mp->is_ipv6 != 0)
1079     s = format (s, "ipv6 ");
1080
1081   FINISH;
1082 }
1083
1084 static void *vl_api_l2_patch_add_del_t_print
1085   (vl_api_l2_patch_add_del_t * mp, void *handle)
1086 {
1087   u8 *s;
1088
1089   s = format (0, "SCRIPT: l2_patch_add_del ");
1090
1091   s = format (s, "rx_sw_if_index %d ", ntohl (mp->rx_sw_if_index));
1092
1093   s = format (s, "tx_sw_if_index %d ", ntohl (mp->tx_sw_if_index));
1094
1095   if (mp->is_add == 0)
1096     s = format (s, "del ");
1097
1098   FINISH;
1099 }
1100
1101 static void *vl_api_sr_tunnel_add_del_t_print
1102   (vl_api_sr_tunnel_add_del_t * mp, void *handle)
1103 {
1104   u8 *s;
1105   ip6_address_t *this_address;
1106   int i;
1107   u16 flags_host_byte_order;
1108   u8 pl_flag;
1109
1110   s = format (0, "SCRIPT: sr_tunnel_add_del ");
1111
1112   if (mp->name[0])
1113     s = format (s, "name %s ", mp->name);
1114
1115   s = format (s, "src %U dst %U/%d ", format_ip6_address,
1116               (ip6_address_t *) mp->src_address,
1117               format_ip6_address,
1118               (ip6_address_t *) mp->dst_address, mp->dst_mask_width);
1119
1120   this_address = (ip6_address_t *) mp->segs_and_tags;
1121   for (i = 0; i < mp->n_segments; i++)
1122     {
1123       s = format (s, "next %U ", format_ip6_address, this_address);
1124       this_address++;
1125     }
1126   for (i = 0; i < mp->n_tags; i++)
1127     {
1128       s = format (s, "tag %U ", format_ip6_address, this_address);
1129       this_address++;
1130     }
1131
1132   flags_host_byte_order = clib_net_to_host_u16 (mp->flags_net_byte_order);
1133
1134   if (flags_host_byte_order & IP6_SR_HEADER_FLAG_CLEANUP)
1135     s = format (s, " clean ");
1136
1137   if (flags_host_byte_order & IP6_SR_HEADER_FLAG_PROTECTED)
1138     s = format (s, "protected ");
1139
1140   for (i = 1; i <= 4; i++)
1141     {
1142       pl_flag = ip6_sr_policy_list_flags (flags_host_byte_order, i);
1143
1144       switch (pl_flag)
1145         {
1146         case IP6_SR_HEADER_FLAG_PL_ELT_NOT_PRESENT:
1147           continue;
1148
1149         case IP6_SR_HEADER_FLAG_PL_ELT_INGRESS_PE:
1150           s = format (s, "InPE %d ", i);
1151           break;
1152
1153         case IP6_SR_HEADER_FLAG_PL_ELT_EGRESS_PE:
1154           s = format (s, "EgPE %d ", i);
1155           break;
1156
1157         case IP6_SR_HEADER_FLAG_PL_ELT_ORIG_SRC_ADDR:
1158           s = format (s, "OrgSrc %d ", i);
1159           break;
1160
1161         default:
1162           clib_warning ("BUG: pl elt %d value %d", i, pl_flag);
1163           break;
1164         }
1165     }
1166
1167   if (mp->policy_name[0])
1168     s = format (s, "policy_name %s ", mp->policy_name);
1169
1170   if (mp->is_add == 0)
1171     s = format (s, "del ");
1172
1173   FINISH;
1174 }
1175
1176 static void *vl_api_sr_policy_add_del_t_print
1177   (vl_api_sr_policy_add_del_t * mp, void *handle)
1178 {
1179   u8 *s;
1180   int i;
1181
1182   s = format (0, "SCRIPT: sr_policy_add_del ");
1183
1184   if (mp->name[0])
1185     s = format (s, "name %s ", mp->name);
1186
1187
1188   if (mp->tunnel_names[0])
1189     {
1190       // start deserializing tunnel_names
1191       int num_tunnels = mp->tunnel_names[0];    //number of tunnels
1192       u8 *deser_tun_names = mp->tunnel_names;
1193       deser_tun_names += 1;     //moving along
1194
1195       u8 *tun_name = 0;
1196       int tun_name_len = 0;
1197
1198       for (i = 0; i < num_tunnels; i++)
1199         {
1200           tun_name_len = *deser_tun_names;
1201           deser_tun_names += 1;
1202           vec_resize (tun_name, tun_name_len);
1203           memcpy (tun_name, deser_tun_names, tun_name_len);
1204           s = format (s, "tunnel %s ", tun_name);
1205           deser_tun_names += tun_name_len;
1206           tun_name = 0;
1207         }
1208     }
1209
1210   if (mp->is_add == 0)
1211     s = format (s, "del ");
1212
1213   FINISH;
1214 }
1215
1216 static void *vl_api_sr_multicast_map_add_del_t_print
1217   (vl_api_sr_multicast_map_add_del_t * mp, void *handle)
1218 {
1219
1220   u8 *s = 0;
1221   /* int i; */
1222
1223   s = format (0, "SCRIPT: sr_multicast_map_add_del ");
1224
1225   if (mp->multicast_address[0])
1226     s = format (s, "address %U ", format_ip6_address, &mp->multicast_address);
1227
1228   if (mp->policy_name[0])
1229     s = format (s, "sr-policy %s ", &mp->policy_name);
1230
1231
1232   if (mp->is_add == 0)
1233     s = format (s, "del ");
1234
1235   FINISH;
1236 }
1237
1238
1239 static void *vl_api_classify_add_del_table_t_print
1240   (vl_api_classify_add_del_table_t * mp, void *handle)
1241 {
1242   u8 *s;
1243   int i;
1244
1245   s = format (0, "SCRIPT: classify_add_del_table ");
1246
1247   if (mp->is_add == 0)
1248     {
1249       s = format (s, "table %d ", ntohl (mp->table_index));
1250       s = format (s, "del ");
1251     }
1252   else
1253     {
1254       s = format (s, "nbuckets %d ", ntohl (mp->nbuckets));
1255       s = format (s, "memory_size %d ", ntohl (mp->memory_size));
1256       s = format (s, "skip %d ", ntohl (mp->skip_n_vectors));
1257       s = format (s, "match %d ", ntohl (mp->match_n_vectors));
1258       s = format (s, "next-table %d ", ntohl (mp->next_table_index));
1259       s = format (s, "miss-next %d ", ntohl (mp->miss_next_index));
1260       s = format (s, "mask hex ");
1261       for (i = 0; i < ntohl (mp->match_n_vectors) * sizeof (u32x4); i++)
1262         s = format (s, "%02x", mp->mask[i]);
1263       vec_add1 (s, ' ');
1264     }
1265
1266   FINISH;
1267 }
1268
1269 static void *vl_api_classify_add_del_session_t_print
1270   (vl_api_classify_add_del_session_t * mp, void *handle)
1271 {
1272   u8 *s;
1273   int i, limit = 0;
1274
1275   s = format (0, "SCRIPT: classify_add_del_session ");
1276
1277   s = format (s, "table_index %d ", ntohl (mp->table_index));
1278   s = format (s, "hit_next_index %d ", ntohl (mp->hit_next_index));
1279   s = format (s, "opaque_index %d ", ntohl (mp->opaque_index));
1280   s = format (s, "advance %d ", ntohl (mp->advance));
1281   if (mp->is_add == 0)
1282     s = format (s, "del ");
1283
1284   s = format (s, "match hex ");
1285   for (i = 5 * sizeof (u32x4) - 1; i > 0; i--)
1286     {
1287       if (mp->match[i] != 0)
1288         {
1289           limit = i + 1;
1290           break;
1291         }
1292     }
1293
1294   for (i = 0; i < limit; i++)
1295     s = format (s, "%02x", mp->match[i]);
1296
1297   FINISH;
1298 }
1299
1300 static void *vl_api_classify_set_interface_ip_table_t_print
1301   (vl_api_classify_set_interface_ip_table_t * mp, void *handle)
1302 {
1303   u8 *s;
1304
1305   s = format (0, "SCRIPT: classify_set_interface_ip_table ");
1306
1307   if (mp->is_ipv6)
1308     s = format (s, "ipv6 ");
1309
1310   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1311   s = format (s, "table %d ", ntohl (mp->table_index));
1312
1313   FINISH;
1314 }
1315
1316 static void *vl_api_classify_set_interface_l2_tables_t_print
1317   (vl_api_classify_set_interface_l2_tables_t * mp, void *handle)
1318 {
1319   u8 *s;
1320
1321   s = format (0, "SCRIPT: classify_set_interface_l2_tables ");
1322
1323   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1324   s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1325   s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1326   s = format (s, "other-table %d ", ntohl (mp->other_table_index));
1327   s = format (s, "is-input %d ", mp->is_input);
1328
1329   FINISH;
1330 }
1331
1332 static void *vl_api_add_node_next_t_print
1333   (vl_api_add_node_next_t * mp, void *handle)
1334 {
1335   u8 *s;
1336
1337   s = format (0, "SCRIPT: add_node_next ");
1338
1339   s = format (0, "node %s next %s ", mp->node_name, mp->next_name);
1340
1341   FINISH;
1342 }
1343
1344 static void *vl_api_l2tpv3_create_tunnel_t_print
1345   (vl_api_l2tpv3_create_tunnel_t * mp, void *handle)
1346 {
1347   u8 *s;
1348
1349   s = format (0, "SCRIPT: l2tpv3_create_tunnel ");
1350
1351   s = format (s, "client_address %U our_address %U ",
1352               format_ip6_address, (ip6_address_t *) (mp->client_address),
1353               format_ip6_address, (ip6_address_t *) (mp->our_address));
1354   s = format (s, "local_session_id %d ", ntohl (mp->local_session_id));
1355   s = format (s, "remote_session_id %d ", ntohl (mp->remote_session_id));
1356   s = format (s, "local_cookie %lld ",
1357               clib_net_to_host_u64 (mp->local_cookie));
1358   s = format (s, "remote_cookie %lld ",
1359               clib_net_to_host_u64 (mp->remote_cookie));
1360   if (mp->l2_sublayer_present)
1361     s = format (s, "l2-sublayer-present ");
1362
1363   FINISH;
1364 }
1365
1366 static void *vl_api_l2tpv3_set_tunnel_cookies_t_print
1367   (vl_api_l2tpv3_set_tunnel_cookies_t * mp, void *handle)
1368 {
1369   u8 *s;
1370
1371   s = format (0, "SCRIPT: l2tpv3_set_tunnel_cookies ");
1372
1373   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1374
1375   s = format (s, "new_local_cookie %llu ",
1376               clib_net_to_host_u64 (mp->new_local_cookie));
1377
1378   s = format (s, "new_remote_cookie %llu ",
1379               clib_net_to_host_u64 (mp->new_remote_cookie));
1380
1381   FINISH;
1382 }
1383
1384 static void *vl_api_l2tpv3_interface_enable_disable_t_print
1385   (vl_api_l2tpv3_interface_enable_disable_t * mp, void *handle)
1386 {
1387   u8 *s;
1388
1389   s = format (0, "SCRIPT: l2tpv3_interface_enable_disable ");
1390
1391   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1392
1393   if (mp->enable_disable == 0)
1394     s = format (s, "del ");
1395
1396   FINISH;
1397 }
1398
1399 static void *vl_api_l2tpv3_set_lookup_key_t_print
1400   (vl_api_l2tpv3_set_lookup_key_t * mp, void *handle)
1401 {
1402   u8 *s;
1403   char *str = "unknown";
1404
1405   s = format (0, "SCRIPT: l2tpv3_set_lookup_key ");
1406
1407   switch (mp->key)
1408     {
1409     case L2T_LOOKUP_SRC_ADDRESS:
1410       str = "lookup_v6_src";
1411       break;
1412     case L2T_LOOKUP_DST_ADDRESS:
1413       str = "lookup_v6_dst";
1414       break;
1415     case L2T_LOOKUP_SESSION_ID:
1416       str = "lookup_session_id";
1417       break;
1418     default:
1419       break;
1420     }
1421
1422   s = format (s, "%s ", str);
1423
1424   FINISH;
1425 }
1426
1427 static void *vl_api_sw_if_l2tpv3_tunnel_dump_t_print
1428   (vl_api_sw_if_l2tpv3_tunnel_dump_t * mp, void *handle)
1429 {
1430   u8 *s;
1431
1432   s = format (0, "SCRIPT: sw_if_l2tpv3_tunnel_dump ");
1433
1434   FINISH;
1435 }
1436
1437 static void *vl_api_vxlan_add_del_tunnel_t_print
1438   (vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
1439 {
1440   u8 *s;
1441
1442   s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
1443
1444   if (mp->is_ipv6)
1445     {
1446       s = format (s, "src %U ", format_ip6_address,
1447                   (ip6_address_t *) mp->src_address);
1448       s = format (s, "dst %U ", format_ip6_address,
1449                   (ip6_address_t *) mp->dst_address);
1450     }
1451   else
1452     {
1453       s = format (s, "src %U ", format_ip4_address,
1454                   (ip4_address_t *) mp->src_address);
1455       s = format (s, "dst %U ", format_ip4_address,
1456                   (ip4_address_t *) mp->dst_address);
1457     }
1458
1459   if (mp->encap_vrf_id)
1460     s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1461
1462   s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1463
1464   s = format (s, "vni %d ", ntohl (mp->vni));
1465
1466   if (mp->is_add == 0)
1467     s = format (s, "del ");
1468
1469   if (mp->is_add == 0)
1470     s = format (s, "del ");
1471
1472   FINISH;
1473 }
1474
1475 static void *vl_api_vxlan_tunnel_dump_t_print
1476   (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1477 {
1478   u8 *s;
1479
1480   s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1481
1482   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1483
1484   FINISH;
1485 }
1486
1487 static void *vl_api_gre_add_del_tunnel_t_print
1488   (vl_api_gre_add_del_tunnel_t * mp, void *handle)
1489 {
1490   u8 *s;
1491
1492   s = format (0, "SCRIPT: gre_add_del_tunnel ");
1493
1494   s = format (s, "dst %U ", format_ip46_address,
1495               (ip46_address_t *) & (mp->dst_address),
1496               mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1497
1498   s = format (s, "src %U ", format_ip46_address,
1499               (ip46_address_t *) & (mp->src_address),
1500               mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1501
1502   if (mp->teb)
1503     s = format (s, "teb ");
1504
1505   if (mp->outer_fib_id)
1506     s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
1507
1508   if (mp->is_add == 0)
1509     s = format (s, "del ");
1510
1511   FINISH;
1512 }
1513
1514 static void *vl_api_gre_tunnel_dump_t_print
1515   (vl_api_gre_tunnel_dump_t * mp, void *handle)
1516 {
1517   u8 *s;
1518
1519   s = format (0, "SCRIPT: gre_tunnel_dump ");
1520
1521   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1522
1523   FINISH;
1524 }
1525
1526 static void *vl_api_l2_fib_clear_table_t_print
1527   (vl_api_l2_fib_clear_table_t * mp, void *handle)
1528 {
1529   u8 *s;
1530
1531   s = format (0, "SCRIPT: l2_fib_clear_table ");
1532
1533   FINISH;
1534 }
1535
1536 static void *vl_api_l2_interface_efp_filter_t_print
1537   (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1538 {
1539   u8 *s;
1540
1541   s = format (0, "SCRIPT: l2_interface_efp_filter ");
1542
1543   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1544   if (mp->enable_disable)
1545     s = format (s, "enable ");
1546   else
1547     s = format (s, "disable ");
1548
1549   FINISH;
1550 }
1551
1552 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1553   (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1554 {
1555   u8 *s;
1556
1557   s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1558
1559   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1560   s = format (s, "vtr_op %d ", ntohl (mp->vtr_op));
1561   s = format (s, "push_dot1q %d ", ntohl (mp->push_dot1q));
1562   s = format (s, "tag1 %d ", ntohl (mp->tag1));
1563   s = format (s, "tag2 %d ", ntohl (mp->tag2));
1564
1565   FINISH;
1566 }
1567
1568 static void *vl_api_create_vhost_user_if_t_print
1569   (vl_api_create_vhost_user_if_t * mp, void *handle)
1570 {
1571   u8 *s;
1572
1573   s = format (0, "SCRIPT: create_vhost_user_if ");
1574
1575   s = format (s, "socket %s ", mp->sock_filename);
1576   if (mp->is_server)
1577     s = format (s, "server ");
1578   if (mp->renumber)
1579     s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1580
1581   FINISH;
1582 }
1583
1584 static void *vl_api_modify_vhost_user_if_t_print
1585   (vl_api_modify_vhost_user_if_t * mp, void *handle)
1586 {
1587   u8 *s;
1588
1589   s = format (0, "SCRIPT: modify_vhost_user_if ");
1590
1591   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1592   s = format (s, "socket %s ", mp->sock_filename);
1593   if (mp->is_server)
1594     s = format (s, "server ");
1595   if (mp->renumber)
1596     s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1597
1598   FINISH;
1599 }
1600
1601 static void *vl_api_delete_vhost_user_if_t_print
1602   (vl_api_delete_vhost_user_if_t * mp, void *handle)
1603 {
1604   u8 *s;
1605
1606   s = format (0, "SCRIPT: delete_vhost_user_if ");
1607   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1608
1609   FINISH;
1610 }
1611
1612 static void *vl_api_sw_interface_vhost_user_dump_t_print
1613   (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
1614 {
1615   u8 *s;
1616
1617   s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
1618
1619   FINISH;
1620 }
1621
1622 static void *vl_api_sw_interface_dump_t_print
1623   (vl_api_sw_interface_dump_t * mp, void *handle)
1624 {
1625   u8 *s;
1626
1627   s = format (0, "SCRIPT: sw_interface_dump ");
1628
1629   if (mp->name_filter_valid)
1630     s = format (s, "name_filter %s ", mp->name_filter);
1631   else
1632     s = format (s, "all ");
1633
1634   FINISH;
1635 }
1636
1637 static void *vl_api_l2_fib_table_dump_t_print
1638   (vl_api_l2_fib_table_dump_t * mp, void *handle)
1639 {
1640   u8 *s;
1641
1642   s = format (0, "SCRIPT: l2_fib_table_dump ");
1643
1644   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
1645
1646   FINISH;
1647 }
1648
1649 static void *vl_api_control_ping_t_print
1650   (vl_api_control_ping_t * mp, void *handle)
1651 {
1652   u8 *s;
1653
1654   s = format (0, "SCRIPT: control_ping ");
1655
1656   FINISH;
1657 }
1658
1659 static void *vl_api_want_interface_events_t_print
1660   (vl_api_want_interface_events_t * mp, void *handle)
1661 {
1662   u8 *s;
1663
1664   s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
1665               ntohl (mp->pid), ntohl (mp->enable_disable));
1666
1667   FINISH;
1668 }
1669
1670 static void *vl_api_cli_request_t_print
1671   (vl_api_cli_request_t * mp, void *handle)
1672 {
1673   u8 *s;
1674
1675   s = format (0, "SCRIPT: cli_request ");
1676
1677   FINISH;
1678 }
1679
1680 static void *vl_api_cli_inband_t_print
1681   (vl_api_cli_inband_t * mp, void *handle)
1682 {
1683   u8 *s;
1684
1685   s = format (0, "SCRIPT: cli_inband ");
1686
1687   FINISH;
1688 }
1689
1690 static void *vl_api_memclnt_create_t_print
1691   (vl_api_memclnt_create_t * mp, void *handle)
1692 {
1693   u8 *s;
1694
1695   s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
1696
1697   FINISH;
1698 }
1699
1700 static void *vl_api_show_version_t_print
1701   (vl_api_show_version_t * mp, void *handle)
1702 {
1703   u8 *s;
1704
1705   s = format (0, "SCRIPT: show_version ");
1706
1707   FINISH;
1708 }
1709
1710 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
1711   (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
1712 {
1713   u8 *s;
1714
1715   s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
1716
1717   s = format (s, "local %U ", format_ip46_address, &mp->local, mp->is_ipv6);
1718
1719   s = format (s, "remote %U ", format_ip46_address, &mp->remote, mp->is_ipv6);
1720
1721   s = format (s, "protocol %d ", ntohl (mp->protocol));
1722
1723   s = format (s, "vni %d ", ntohl (mp->vni));
1724
1725   if (mp->is_add == 0)
1726     s = format (s, "del ");
1727
1728   if (mp->encap_vrf_id)
1729     s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1730
1731   if (mp->decap_vrf_id)
1732     s = format (s, "decap-vrf-id %d ", ntohl (mp->decap_vrf_id));
1733
1734   FINISH;
1735 }
1736
1737 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
1738   (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
1739 {
1740   u8 *s;
1741
1742   s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
1743
1744   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1745
1746   FINISH;
1747 }
1748
1749 static void *vl_api_interface_name_renumber_t_print
1750   (vl_api_interface_name_renumber_t * mp, void *handle)
1751 {
1752   u8 *s;
1753
1754   s = format (0, "SCRIPT: interface_renumber ");
1755
1756   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1757
1758   s = format (s, "new_show_dev_instance %d ",
1759               ntohl (mp->new_show_dev_instance));
1760
1761   FINISH;
1762 }
1763
1764 static void *vl_api_want_ip4_arp_events_t_print
1765   (vl_api_want_ip4_arp_events_t * mp, void *handle)
1766 {
1767   u8 *s;
1768
1769   s = format (0, "SCRIPT: want_ip4_arp_events ");
1770   s = format (s, "pid %d address %U ", mp->pid,
1771               format_ip4_address, &mp->address);
1772   if (mp->enable_disable == 0)
1773     s = format (s, "del ");
1774
1775   FINISH;
1776 }
1777
1778 static void *vl_api_want_ip6_nd_events_t_print
1779   (vl_api_want_ip6_nd_events_t * mp, void *handle)
1780 {
1781   u8 *s;
1782
1783   s = format (0, "SCRIPT: want_ip6_nd_events ");
1784   s = format (s, "pid %d address %U ", mp->pid,
1785               format_ip6_address, mp->address);
1786   if (mp->enable_disable == 0)
1787     s = format (s, "del ");
1788
1789   FINISH;
1790 }
1791
1792 static void *vl_api_input_acl_set_interface_t_print
1793   (vl_api_input_acl_set_interface_t * mp, void *handle)
1794 {
1795   u8 *s;
1796
1797   s = format (0, "SCRIPT: input_acl_set_interface ");
1798
1799   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1800   s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1801   s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1802   s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
1803
1804   if (mp->is_add == 0)
1805     s = format (s, "del ");
1806
1807   FINISH;
1808 }
1809
1810 static void *vl_api_ip_address_dump_t_print
1811   (vl_api_ip_address_dump_t * mp, void *handle)
1812 {
1813   u8 *s;
1814
1815   s = format (0, "SCRIPT: ip6_address_dump ");
1816   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1817   s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1818
1819   FINISH;
1820 }
1821
1822 static void *
1823 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
1824 {
1825   u8 *s;
1826
1827   s = format (0, "SCRIPT: ip_dump ");
1828   s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1829
1830   FINISH;
1831 }
1832
1833 static void *vl_api_cop_interface_enable_disable_t_print
1834   (vl_api_cop_interface_enable_disable_t * mp, void *handle)
1835 {
1836   u8 *s;
1837
1838   s = format (0, "SCRIPT: cop_interface_enable_disable ");
1839   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1840   if (mp->enable_disable)
1841     s = format (s, "enable ");
1842   else
1843     s = format (s, "disable ");
1844
1845   FINISH;
1846 }
1847
1848 static void *vl_api_cop_whitelist_enable_disable_t_print
1849   (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
1850 {
1851   u8 *s;
1852
1853   s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
1854   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1855   s = format (s, "fib-id %d ", ntohl (mp->fib_id));
1856   if (mp->ip4)
1857     s = format (s, "ip4 ");
1858   if (mp->ip6)
1859     s = format (s, "ip6 ");
1860   if (mp->default_cop)
1861     s = format (s, "default ");
1862
1863   FINISH;
1864 }
1865
1866 static void *vl_api_af_packet_create_t_print
1867   (vl_api_af_packet_create_t * mp, void *handle)
1868 {
1869   u8 *s;
1870
1871   s = format (0, "SCRIPT: af_packet_create ");
1872   s = format (s, "host_if_name %s ", mp->host_if_name);
1873   if (mp->use_random_hw_addr)
1874     s = format (s, "hw_addr random ");
1875   else
1876     s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
1877
1878   FINISH;
1879 }
1880
1881 static void *vl_api_af_packet_delete_t_print
1882   (vl_api_af_packet_delete_t * mp, void *handle)
1883 {
1884   u8 *s;
1885
1886   s = format (0, "SCRIPT: af_packet_delete ");
1887   s = format (s, "host_if_name %s ", mp->host_if_name);
1888
1889   FINISH;
1890 }
1891
1892 static u8 *
1893 format_policer_action (u8 * s, va_list * va)
1894 {
1895   u32 action = va_arg (*va, u32);
1896   u32 dscp = va_arg (*va, u32);
1897   char *t = 0;
1898
1899   if (action == SSE2_QOS_ACTION_DROP)
1900     s = format (s, "drop");
1901   else if (action == SSE2_QOS_ACTION_TRANSMIT)
1902     s = format (s, "transmit");
1903   else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
1904     {
1905       s = format (s, "mark-and-transmit ");
1906       switch (dscp)
1907         {
1908 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
1909           foreach_vnet_dscp
1910 #undef _
1911         default:
1912           break;
1913         }
1914       s = format (s, "%s", t);
1915     }
1916
1917   return s;
1918 }
1919
1920 static void *vl_api_policer_add_del_t_print
1921   (vl_api_policer_add_del_t * mp, void *handle)
1922 {
1923   u8 *s;
1924
1925   s = format (0, "SCRIPT: policer_add_del ");
1926   s = format (s, "name %s ", mp->name);
1927   s = format (s, "cir %d ", mp->cir);
1928   s = format (s, "eir %d ", mp->eir);
1929   s = format (s, "cb %d ", mp->cb);
1930   s = format (s, "eb %d ", mp->eb);
1931
1932   switch (mp->rate_type)
1933     {
1934     case SSE2_QOS_RATE_KBPS:
1935       s = format (s, "rate_type kbps ");
1936       break;
1937     case SSE2_QOS_RATE_PPS:
1938       s = format (s, "rate_type pps ");
1939       break;
1940     default:
1941       break;
1942     }
1943
1944   switch (mp->round_type)
1945     {
1946     case SSE2_QOS_ROUND_TO_CLOSEST:
1947       s = format (s, "round_type closest ");
1948       break;
1949     case SSE2_QOS_ROUND_TO_UP:
1950       s = format (s, "round_type up ");
1951       break;
1952     case SSE2_QOS_ROUND_TO_DOWN:
1953       s = format (s, "round_type down ");
1954       break;
1955     default:
1956       break;
1957     }
1958
1959   switch (mp->type)
1960     {
1961     case SSE2_QOS_POLICER_TYPE_1R2C:
1962       s = format (s, "type 1r2c ");
1963       break;
1964     case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
1965       s = format (s, "type 1r3c ");
1966       break;
1967     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
1968       s = format (s, "type 2r3c-2698 ");
1969       break;
1970     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
1971       s = format (s, "type 2r3c-4115 ");
1972       break;
1973     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
1974       s = format (s, "type 2r3c-mef5cf1 ");
1975       break;
1976     default:
1977       break;
1978     }
1979
1980   s = format (s, "conform_action %U ", format_policer_action,
1981               mp->conform_action_type, mp->conform_dscp);
1982   s = format (s, "exceed_action %U ", format_policer_action,
1983               mp->exceed_action_type, mp->exceed_dscp);
1984   s = format (s, "violate_action %U ", format_policer_action,
1985               mp->violate_action_type, mp->violate_dscp);
1986
1987   if (mp->color_aware)
1988     s = format (s, "color-aware ");
1989   if (mp->is_add == 0)
1990     s = format (s, "del ");
1991
1992   FINISH;
1993 }
1994
1995 static void *vl_api_policer_dump_t_print
1996   (vl_api_policer_dump_t * mp, void *handle)
1997 {
1998   u8 *s;
1999
2000   s = format (0, "SCRIPT: policer_dump ");
2001   if (mp->match_name_valid)
2002     s = format (s, "name %s ", mp->match_name);
2003
2004   FINISH;
2005 }
2006
2007 static void *vl_api_policer_classify_set_interface_t_print
2008   (vl_api_policer_classify_set_interface_t * mp, void *handle)
2009 {
2010   u8 *s;
2011
2012   s = format (0, "SCRIPT: policer_classify_set_interface ");
2013   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2014   if (mp->ip4_table_index != ~0)
2015     s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2016   if (mp->ip6_table_index != ~0)
2017     s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2018   if (mp->l2_table_index != ~0)
2019     s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2020   if (mp->is_add == 0)
2021     s = format (s, "del ");
2022
2023   FINISH;
2024 }
2025
2026 static void *vl_api_policer_classify_dump_t_print
2027   (vl_api_policer_classify_dump_t * mp, void *handle)
2028 {
2029   u8 *s;
2030
2031   s = format (0, "SCRIPT: policer_classify_dump ");
2032   switch (mp->type)
2033     {
2034     case POLICER_CLASSIFY_TABLE_IP4:
2035       s = format (s, "type ip4 ");
2036       break;
2037     case POLICER_CLASSIFY_TABLE_IP6:
2038       s = format (s, "type ip6 ");
2039       break;
2040     case POLICER_CLASSIFY_TABLE_L2:
2041       s = format (s, "type l2 ");
2042       break;
2043     default:
2044       break;
2045     }
2046
2047   FINISH;
2048 }
2049
2050 static void *vl_api_sw_interface_clear_stats_t_print
2051   (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2052 {
2053   u8 *s;
2054
2055   s = format (0, "SCRIPT: sw_interface_clear_stats ");
2056   if (mp->sw_if_index != ~0)
2057     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2058
2059   FINISH;
2060 }
2061
2062 static void *vl_api_mpls_gre_tunnel_dump_t_print
2063   (vl_api_mpls_gre_tunnel_dump_t * mp, void *handle)
2064 {
2065   u8 *s;
2066
2067   s = format (0, "SCRIPT: mpls_gre_tunnel_dump ");
2068
2069   s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
2070
2071   FINISH;
2072 }
2073
2074 static void *vl_api_mpls_eth_tunnel_dump_t_print
2075   (vl_api_mpls_eth_tunnel_dump_t * mp, void *handle)
2076 {
2077   u8 *s;
2078
2079   s = format (0, "SCRIPT: mpls_eth_tunnel_dump ");
2080
2081   s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
2082
2083   FINISH;
2084 }
2085
2086 static void *vl_api_mpls_fib_encap_dump_t_print
2087   (vl_api_mpls_fib_encap_dump_t * mp, void *handle)
2088 {
2089   u8 *s;
2090
2091   s = format (0, "SCRIPT: mpls_fib_encap_dump ");
2092
2093   FINISH;
2094 }
2095
2096 static void *vl_api_mpls_fib_decap_dump_t_print
2097   (vl_api_mpls_fib_decap_dump_t * mp, void *handle)
2098 {
2099   u8 *s;
2100
2101   s = format (0, "SCRIPT: mpls_fib_decap_dump ");
2102
2103   FINISH;
2104 }
2105
2106 static void *vl_api_classify_table_ids_t_print
2107   (vl_api_classify_table_ids_t * mp, void *handle)
2108 {
2109   u8 *s;
2110
2111   s = format (0, "SCRIPT: classify_table_ids ");
2112
2113   FINISH;
2114 }
2115
2116 static void *vl_api_classify_table_by_interface_t_print
2117   (vl_api_classify_table_by_interface_t * mp, void *handle)
2118 {
2119   u8 *s;
2120
2121   s = format (0, "SCRIPT: classify_table_by_interface ");
2122   if (mp->sw_if_index != ~0)
2123     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2124
2125   FINISH;
2126 }
2127
2128 static void *vl_api_classify_table_info_t_print
2129   (vl_api_classify_table_info_t * mp, void *handle)
2130 {
2131   u8 *s;
2132
2133   s = format (0, "SCRIPT: classify_table_info ");
2134   if (mp->table_id != ~0)
2135     s = format (s, "table_id %d ", ntohl (mp->table_id));
2136
2137   FINISH;
2138 }
2139
2140 static void *vl_api_classify_session_dump_t_print
2141   (vl_api_classify_session_dump_t * mp, void *handle)
2142 {
2143   u8 *s;
2144
2145   s = format (0, "SCRIPT: classify_session_dump ");
2146   if (mp->table_id != ~0)
2147     s = format (s, "table_id %d ", ntohl (mp->table_id));
2148
2149   FINISH;
2150 }
2151
2152 static void *vl_api_set_ipfix_exporter_t_print
2153   (vl_api_set_ipfix_exporter_t * mp, void *handle)
2154 {
2155   u8 *s;
2156
2157   s = format (0, "SCRIPT: set_ipfix_exporter ");
2158
2159   s = format (s, "collector-address %U ", format_ip4_address,
2160               (ip4_address_t *) mp->collector_address);
2161   s = format (s, "collector-port %d ", ntohs (mp->collector_port));
2162   s = format (s, "src-address %U ", format_ip4_address,
2163               (ip4_address_t *) mp->src_address);
2164   s = format (s, "vrf-id %d ", ntohl (mp->vrf_id));
2165   s = format (s, "path-mtu %d ", ntohl (mp->path_mtu));
2166   s = format (s, "template-interval %d ", ntohl (mp->template_interval));
2167   s = format (s, "udp-checksum %d ", mp->udp_checksum);
2168
2169   FINISH;
2170 }
2171
2172 static void *vl_api_ipfix_exporter_dump_t_print
2173   (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2174 {
2175   u8 *s;
2176
2177   s = format (0, "SCRIPT: ipfix_exporter_dump ");
2178
2179   FINISH;
2180 }
2181
2182 static void *vl_api_set_ipfix_classify_stream_t_print
2183   (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2184 {
2185   u8 *s;
2186
2187   s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2188
2189   s = format (s, "domain-id %d ", ntohl (mp->domain_id));
2190   s = format (s, "src-port %d ", ntohs (mp->src_port));
2191
2192   FINISH;
2193 }
2194
2195 static void *vl_api_ipfix_classify_stream_dump_t_print
2196   (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2197 {
2198   u8 *s;
2199
2200   s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2201
2202   FINISH;
2203 }
2204
2205 static void *vl_api_ipfix_classify_table_add_del_t_print
2206   (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2207 {
2208   u8 *s;
2209
2210   s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2211
2212   s = format (s, "table-id %d ", ntohl (mp->table_id));
2213   s = format (s, "ip-version %d ", mp->ip_version);
2214   s = format (s, "transport-protocol %d ", mp->transport_protocol);
2215
2216   FINISH;
2217 }
2218
2219 static void *vl_api_ipfix_classify_table_dump_t_print
2220   (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2221 {
2222   u8 *s;
2223
2224   s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2225
2226   FINISH;
2227 }
2228
2229 static void *vl_api_get_next_index_t_print
2230   (vl_api_get_next_index_t * mp, void *handle)
2231 {
2232   u8 *s;
2233
2234   s = format (0, "SCRIPT: get_next_index ");
2235   s = format (s, "node-name %s ", mp->node_name);
2236   s = format (s, "next-node-name %s ", mp->next_name);
2237
2238   FINISH;
2239 }
2240
2241 static void *vl_api_pg_create_interface_t_print
2242   (vl_api_pg_create_interface_t * mp, void *handle)
2243 {
2244   u8 *s;
2245
2246   s = format (0, "SCRIPT: pg_create_interface ");
2247   s = format (0, "if_id %d", ntohl (mp->interface_id));
2248
2249   FINISH;
2250 }
2251
2252 static void *vl_api_pg_capture_t_print
2253   (vl_api_pg_capture_t * mp, void *handle)
2254 {
2255   u8 *s;
2256
2257   s = format (0, "SCRIPT: pg_capture ");
2258   s = format (0, "if_id %d ", ntohl (mp->interface_id));
2259   s = format (0, "pcap %s", mp->pcap_file_name);
2260   if (mp->count != ~0)
2261     s = format (s, "count %d ", ntohl (mp->count));
2262   if (!mp->is_enabled)
2263     s = format (s, "disable");
2264
2265   FINISH;
2266 }
2267
2268 static void *vl_api_pg_enable_disable_t_print
2269   (vl_api_pg_enable_disable_t * mp, void *handle)
2270 {
2271   u8 *s;
2272
2273   s = format (0, "SCRIPT: pg_enable_disable ");
2274   if (ntohl (mp->stream_name_length) > 0)
2275     s = format (s, "stream %s", mp->stream_name);
2276   if (!mp->is_enabled)
2277     s = format (s, "disable");
2278
2279   FINISH;
2280 }
2281
2282 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2283   (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2284 {
2285   u8 *s;
2286   int i;
2287
2288   s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2289   if (mp->is_ipv6)
2290     s = format (s, "%U/%d ", format_ip6_address, mp->address,
2291                 mp->mask_length);
2292   else
2293     s = format (s, "%U/%d ", format_ip4_address, mp->address,
2294                 mp->mask_length);
2295
2296   for (i = 0; i < mp->number_of_ranges; i++)
2297     {
2298       s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2299     }
2300
2301   s = format (s, "vrf %d ", ntohl (mp->vrf_id));
2302
2303   if (mp->is_add == 0)
2304     s = format (s, "del ");
2305
2306   FINISH;
2307 }
2308
2309 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2310   (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2311    void *handle)
2312 {
2313   u8 *s;
2314
2315   s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2316
2317   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2318
2319   if (mp->tcp_out_vrf_id != ~0)
2320     s = format (s, "tcp-out-vrf %d ", ntohl (mp->tcp_out_vrf_id));
2321
2322   if (mp->udp_out_vrf_id != ~0)
2323     s = format (s, "udp-out-vrf %d ", ntohl (mp->udp_out_vrf_id));
2324
2325   if (mp->tcp_in_vrf_id != ~0)
2326     s = format (s, "tcp-in-vrf %d ", ntohl (mp->tcp_in_vrf_id));
2327
2328   if (mp->udp_in_vrf_id != ~0)
2329     s = format (s, "udp-in-vrf %d ", ntohl (mp->udp_in_vrf_id));
2330
2331   if (mp->is_add == 0)
2332     s = format (s, "del ");
2333
2334   FINISH;
2335 }
2336
2337 static void *vl_api_lisp_enable_disable_t_print
2338   (vl_api_lisp_enable_disable_t * mp, void *handle)
2339 {
2340   u8 *s;
2341
2342   s = format (0, "SCRIPT: lisp_enable_disable %s",
2343               mp->is_en ? "enable" : "disable");
2344
2345   FINISH;
2346 }
2347
2348 static void *vl_api_lisp_gpe_add_del_iface_t_print
2349   (vl_api_lisp_gpe_add_del_iface_t * mp, void *handle)
2350 {
2351   u8 *s;
2352
2353   s = format (0, "SCRIPT: lisp_gpe_add_del_iface ");
2354
2355   s = format (s, "%s ", mp->is_add ? "up" : "down");
2356   s = format (s, "vni %d ", mp->vni);
2357   s = format (s, "%s %d ", mp->is_l2 ? "bd_id" : "table_id", mp->dp_table);
2358
2359   FINISH;
2360 }
2361
2362 static void *vl_api_lisp_pitr_set_locator_set_t_print
2363   (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
2364 {
2365   u8 *s;
2366
2367   s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
2368
2369   if (mp->is_add)
2370     s = format (s, "locator-set %s ", mp->ls_name);
2371   else
2372     s = format (s, "del");
2373
2374   FINISH;
2375 }
2376
2377 static u8 *
2378 format_lisp_flat_eid (u8 * s, va_list * args)
2379 {
2380   u32 type = va_arg (*args, u32);
2381   u8 *eid = va_arg (*args, u8 *);
2382   u32 eid_len = va_arg (*args, u32);
2383
2384   switch (type)
2385     {
2386     case 0:
2387       return format (s, "%U/%d", format_ip4_address, eid, eid_len);
2388     case 1:
2389       return format (s, "%U/%d", format_ip6_address, eid, eid_len);
2390     case 3:
2391       return format (s, "%U", format_ethernet_address, eid);
2392     }
2393   return 0;
2394 }
2395
2396 /** Used for transferring locators via VPP API */
2397 typedef CLIB_PACKED (struct
2398                      {
2399                      u8 is_ip4;
2400              /**< is locator an IPv4 address */
2401                      u8 priority;
2402                /**< locator priority */
2403                      u8 weight;
2404                /**< locator weight */
2405                      u8 addr[16];
2406                /**< IPv4/IPv6 address */
2407                      }) rloc_t;
2408
2409 static u8 *
2410 format_rloc (u8 * s, va_list * args)
2411 {
2412   rloc_t *rloc = va_arg (*args, rloc_t *);
2413
2414   if (rloc->is_ip4)
2415     s = format (s, "%U ", format_ip4_address, rloc->addr);
2416   else
2417     s = format (s, "%U ", format_ip6_address, rloc->addr);
2418
2419   s = format (s, "p %d w %d", rloc->priority, rloc->weight);
2420
2421   return s;
2422 }
2423
2424 static void *vl_api_lisp_add_del_remote_mapping_t_print
2425   (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
2426 {
2427   u8 *s;
2428   u32 i, rloc_num = 0;
2429
2430   s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
2431
2432   if (mp->del_all)
2433     s = format (s, "del-all ");
2434
2435   s = format (s, "%s ", mp->is_add ? "add" : "del");
2436   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2437
2438   s = format (s, "eid %U ", format_lisp_flat_eid,
2439               mp->eid_type, mp->eid, mp->eid_len);
2440
2441   if (mp->is_src_dst)
2442     {
2443       s = format (s, "seid %U ", format_lisp_flat_eid,
2444                   mp->eid_type, mp->seid, mp->seid_len);
2445     }
2446
2447   rloc_num = clib_net_to_host_u32 (mp->rloc_num);
2448
2449   if (0 == rloc_num)
2450     s = format (s, "action %d", mp->action);
2451   else
2452     {
2453       rloc_t *rloc = (rloc_t *) mp->rlocs;
2454       for (i = 0; i < rloc_num; i++)
2455         s = format (s, "%U ", format_rloc, &rloc[i]);
2456     }
2457
2458   FINISH;
2459 }
2460
2461 static void *vl_api_lisp_add_del_adjacency_t_print
2462   (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
2463 {
2464   u8 *s;
2465
2466   s = format (0, "SCRIPT: lisp_add_del_adjacency ");
2467
2468   s = format (s, "%s ", mp->is_add ? "add" : "del");
2469   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2470   s = format (s, "reid %U leid %U ",
2471               format_lisp_flat_eid, mp->eid_type, mp->reid, mp->reid_len,
2472               format_lisp_flat_eid, mp->eid_type, mp->leid, mp->leid_len);
2473
2474   FINISH;
2475 }
2476
2477 static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
2478   (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
2479 {
2480   u8 *s;
2481
2482   s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
2483
2484   if (mp->is_add)
2485     s = format (s, "%s", mp->locator_set_name);
2486   else
2487     s = format (s, "del");
2488
2489   FINISH;
2490 }
2491
2492 static void *vl_api_lisp_eid_table_add_del_map_t_print
2493   (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
2494 {
2495   u8 *s;
2496
2497   s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
2498
2499   if (!mp->is_add)
2500     s = format (s, "del ");
2501
2502   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2503   s = format (s, "%s %d ",
2504               mp->is_l2 ? "bd_index" : "vrf",
2505               clib_net_to_host_u32 (mp->dp_table));
2506   FINISH;
2507 }
2508
2509 static void *vl_api_lisp_add_del_local_eid_t_print
2510   (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
2511 {
2512   u8 *s;
2513
2514   s = format (0, "SCRIPT: lisp_add_del_local_eid ");
2515
2516   if (!mp->is_add)
2517     s = format (s, "del ");
2518
2519   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2520   s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
2521               mp->prefix_len);
2522   s = format (s, "locator-set %s ", mp->locator_set_name);
2523   FINISH;
2524 }
2525
2526 static void *vl_api_lisp_gpe_add_del_fwd_entry_t_print
2527   (vl_api_lisp_gpe_add_del_fwd_entry_t * mp, void *handle)
2528 {
2529   u8 *s;
2530
2531   s = format (0, "SCRIPT: lisp_gpe_add_del_fwd_entry TODO");
2532
2533   FINISH;
2534 }
2535
2536 static void *vl_api_lisp_add_del_map_resolver_t_print
2537   (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
2538 {
2539   u8 *s;
2540
2541   s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
2542
2543   if (!mp->is_add)
2544     s = format (s, "del ");
2545
2546   if (mp->is_ipv6)
2547     s = format (s, "%U ", format_ip6_address, mp->ip_address);
2548   else
2549     s = format (s, "%U ", format_ip4_address, mp->ip_address);
2550
2551   FINISH;
2552 }
2553
2554 static void *vl_api_lisp_gpe_enable_disable_t_print
2555   (vl_api_lisp_gpe_enable_disable_t * mp, void *handle)
2556 {
2557   u8 *s;
2558
2559   s = format (0, "SCRIPT: lisp_gpe_enable_disable ");
2560
2561   s = format (s, "%s ", mp->is_en ? "enable" : "disable");
2562
2563   FINISH;
2564 }
2565
2566 typedef CLIB_PACKED (struct
2567                      {
2568                      u32 sw_if_index;
2569                    /**< locator sw_if_index */
2570                      u8 priority;
2571                /**< locator priority */
2572                      u8 weight;
2573                /**< locator weight */
2574                      }) ls_locator_t;
2575
2576 static u8 *
2577 format_locator (u8 * s, va_list * args)
2578 {
2579   ls_locator_t *l = va_arg (*args, ls_locator_t *);
2580
2581   return format (s, "sw_if_index %d p %d w %d",
2582                  l->sw_if_index, l->priority, l->weight);
2583 }
2584
2585 static void *vl_api_lisp_add_del_locator_set_t_print
2586   (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
2587 {
2588   u8 *s;
2589   u32 loc_num = 0, i;
2590   ls_locator_t *locs;
2591
2592   s = format (0, "SCRIPT: lisp_add_del_locator_set ");
2593
2594   if (!mp->is_add)
2595     s = format (s, "del ");
2596
2597   s = format (s, "locator-set %s ", mp->locator_set_name);
2598
2599   loc_num = clib_net_to_host_u32 (mp->locator_num);
2600   locs = (ls_locator_t *) mp->locators;
2601
2602   for (i = 0; i < loc_num; i++)
2603     s = format (s, "%U ", format_locator, &locs[i]);
2604
2605   FINISH;
2606 }
2607
2608 static void *vl_api_lisp_add_del_locator_t_print
2609   (vl_api_lisp_add_del_locator_t * mp, void *handle)
2610 {
2611   u8 *s;
2612
2613   s = format (0, "SCRIPT: lisp_add_del_locator ");
2614
2615   if (!mp->is_add)
2616     s = format (s, "del ");
2617
2618   s = format (s, "locator-set %s ", mp->locator_set_name);
2619   s = format (s, "sw_if_index %d ", mp->sw_if_index);
2620   s = format (s, "p %d w %d ", mp->priority, mp->weight);
2621
2622   FINISH;
2623 }
2624
2625 static void *vl_api_lisp_locator_set_dump_t_print
2626   (vl_api_lisp_locator_set_dump_t * mp, void *handle)
2627 {
2628   u8 *s;
2629
2630   s = format (0, "SCRIPT: lisp_locator_set_dump ");
2631   if (mp->filter == 1)
2632     s = format (s, "local");
2633   else if (mp->filter == 2)
2634     s = format (s, "remote");
2635
2636   FINISH;
2637 }
2638
2639 static void *vl_api_lisp_locator_dump_t_print
2640   (vl_api_lisp_locator_dump_t * mp, void *handle)
2641 {
2642   u8 *s;
2643
2644   s = format (0, "SCRIPT: lisp_locator_dump ");
2645   if (mp->is_index_set)
2646     s = format (s, "ls_index %d", clib_net_to_host_u32 (mp->ls_index));
2647   else
2648     s = format (s, "ls_name %s", mp->ls_name);
2649
2650   FINISH;
2651 }
2652
2653 static void *vl_api_lisp_map_request_mode_t_print
2654   (vl_api_lisp_map_request_mode_t * mp, void *handle)
2655 {
2656   u8 *s;
2657
2658   s = format (0, "SCRIPT: lisp_map_request_mode ");
2659
2660   switch (mp->mode)
2661     {
2662     case 0:
2663       s = format (s, "dst-only");
2664       break;
2665     case 1:
2666       s = format (s, "src-dst");
2667     default:
2668       break;
2669     }
2670
2671   FINISH;
2672 }
2673
2674 static void *vl_api_lisp_eid_table_dump_t_print
2675   (vl_api_lisp_eid_table_dump_t * mp, void *handle)
2676 {
2677   u8 *s;
2678
2679   s = format (0, "SCRIPT: lisp_eid_table_dump ");
2680
2681   if (mp->eid_set)
2682     {
2683       s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2684       s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
2685                   mp->eid, mp->prefix_length);
2686       switch (mp->filter)
2687         {
2688         case 1:
2689           s = format (s, "local ");
2690           break;
2691         case 2:
2692           s = format (s, "remote ");
2693           break;
2694         }
2695     }
2696
2697   FINISH;
2698 }
2699
2700 static void *vl_api_lisp_eid_table_map_dump_t_print
2701   (vl_api_lisp_eid_table_map_dump_t * mp, void *handle)
2702 {
2703   u8 *s;
2704
2705   s = format (0, "SCRIPT: lisp_eid_table_map_dump ");
2706
2707   if (mp->is_l2)
2708     s = format (s, "l2");
2709   else
2710     s = format (s, "l3");
2711
2712   FINISH;
2713 }
2714
2715 static void *vl_api_ipsec_gre_add_del_tunnel_t_print
2716   (vl_api_ipsec_gre_add_del_tunnel_t * mp, void *handle)
2717 {
2718   u8 *s;
2719
2720   s = format (0, "SCRIPT: ipsec_gre_add_del_tunnel ");
2721
2722   s = format (s, "dst %U ", format_ip4_address,
2723               (ip4_address_t *) & (mp->dst_address));
2724
2725   s = format (s, "src %U ", format_ip4_address,
2726               (ip4_address_t *) & (mp->src_address));
2727
2728   s = format (s, "local_sa %d ", ntohl (mp->local_sa_id));
2729
2730   s = format (s, "remote_sa %d ", ntohl (mp->remote_sa_id));
2731
2732   if (mp->is_add == 0)
2733     s = format (s, "del ");
2734
2735   FINISH;
2736 }
2737
2738 static void *vl_api_ipsec_gre_tunnel_dump_t_print
2739   (vl_api_ipsec_gre_tunnel_dump_t * mp, void *handle)
2740 {
2741   u8 *s;
2742
2743   s = format (0, "SCRIPT: ipsec_gre_tunnel_dump ");
2744
2745   if (mp->sw_if_index != ~0)
2746     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2747
2748   FINISH;
2749 }
2750
2751 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
2752   (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
2753 {
2754   u8 *s;
2755   u32 vtr_op = ntohl (mp->vtr_op);
2756
2757   s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
2758
2759   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2760   s = format (s, "vtr_op %d ", vtr_op);
2761   if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
2762     {
2763       if (vtr_op == L2_VTR_TRANSLATE_2_2)
2764         s = format (s, "%d ", ntohs (mp->outer_tag));
2765       s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
2766       s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
2767       s = format (s, "sid %d ", ntohl (mp->i_sid));
2768       s = format (s, "vlanid %d ", ntohs (mp->b_vlanid));
2769     }
2770
2771   FINISH;
2772 }
2773
2774 #define foreach_custom_print_no_arg_function                            \
2775 _(lisp_eid_table_vni_dump)                                              \
2776 _(lisp_map_resolver_dump)                                               \
2777 _(show_lisp_map_request_mode)                                           \
2778 _(lisp_gpe_tunnel_dump)
2779
2780 #define _(f)                                                            \
2781 static void * vl_api_ ## f ## _t_print                                  \
2782   (vl_api_ ## f ## _t * mp, void * handle)                              \
2783 {                                                                       \
2784   u8 * s;                                                               \
2785   s = format (0, "SCRIPT: " #f );                                       \
2786   FINISH;                                                               \
2787 }
2788 foreach_custom_print_no_arg_function
2789 #undef _
2790 #define foreach_custom_print_function                                   \
2791 _(CREATE_LOOPBACK, create_loopback)                                     \
2792 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags)                       \
2793 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address)           \
2794 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table)                       \
2795 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath)                       \
2796 _(TAP_CONNECT, tap_connect)                                             \
2797 _(TAP_MODIFY, tap_modify)                                               \
2798 _(TAP_DELETE, tap_delete)                                               \
2799 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump)                         \
2800 _(IP_ADD_DEL_ROUTE, ip_add_del_route)                                   \
2801 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del)                                 \
2802 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable)       \
2803 _(MPLS_ADD_DEL_DECAP, mpls_add_del_decap)                               \
2804 _(MPLS_ADD_DEL_ENCAP, mpls_add_del_encap)                               \
2805 _(MPLS_GRE_ADD_DEL_TUNNEL, mpls_gre_add_del_tunnel)                     \
2806 _(MPLS_ETHERNET_ADD_DEL_TUNNEL, mpls_ethernet_add_del_tunnel)           \
2807 _(MPLS_ETHERNET_ADD_DEL_TUNNEL_2, mpls_ethernet_add_del_tunnel_2)       \
2808 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered)             \
2809 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del)                             \
2810 _(RESET_VRF, reset_vrf)                                                 \
2811 _(CREATE_VLAN_SUBIF, create_vlan_subif)                                 \
2812 _(CREATE_SUBIF, create_subif)                                           \
2813 _(OAM_ADD_DEL, oam_add_del)                                             \
2814 _(RESET_FIB, reset_fib)                                                 \
2815 _(DHCP_PROXY_CONFIG, dhcp_proxy_config)                                 \
2816 _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss)                               \
2817 _(SET_IP_FLOW_HASH, set_ip_flow_hash)                                   \
2818 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS,                              \
2819   sw_interface_ip6_set_link_local_address)                              \
2820 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix)           \
2821 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config)           \
2822 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit)                       \
2823 _(L2_PATCH_ADD_DEL, l2_patch_add_del)                                   \
2824 _(SR_TUNNEL_ADD_DEL, sr_tunnel_add_del)                                 \
2825 _(SR_POLICY_ADD_DEL, sr_policy_add_del)                                 \
2826 _(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del)                   \
2827 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect)           \
2828 _(L2FIB_ADD_DEL, l2fib_add_del)                                         \
2829 _(L2_FLAGS, l2_flags)                                                   \
2830 _(BRIDGE_FLAGS, bridge_flags)                                           \
2831 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table)                       \
2832 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session)                   \
2833 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge)               \
2834 _(SW_INTERFACE_SET_DPDK_HQOS_PIPE, sw_interface_set_dpdk_hqos_pipe)     \
2835 _(SW_INTERFACE_SET_DPDK_HQOS_SUBPORT, sw_interface_set_dpdk_hqos_subport)\
2836 _(SW_INTERFACE_SET_DPDK_HQOS_TCTBL, sw_interface_set_dpdk_hqos_tctbl)   \
2837 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del)                         \
2838 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump)                               \
2839 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table)     \
2840 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables)   \
2841 _(ADD_NODE_NEXT, add_node_next)                                         \
2842 _(DHCP_PROXY_CONFIG_2, dhcp_proxy_config_2)                             \
2843 _(DHCP_CLIENT_CONFIG, dhcp_client_config)                               \
2844 _(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel)                           \
2845 _(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies)                 \
2846 _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable)     \
2847 _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key)                         \
2848 _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump)                   \
2849 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel)                           \
2850 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump)                                 \
2851 _(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel)                               \
2852 _(GRE_TUNNEL_DUMP, gre_tunnel_dump)                                     \
2853 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table)                               \
2854 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter)                     \
2855 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite)         \
2856 _(CREATE_VHOST_USER_IF, create_vhost_user_if)                           \
2857 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if)                           \
2858 _(DELETE_VHOST_USER_IF, delete_vhost_user_if)                           \
2859 _(SW_INTERFACE_DUMP, sw_interface_dump)                                 \
2860 _(CONTROL_PING, control_ping)                                           \
2861 _(WANT_INTERFACE_EVENTS, want_interface_events)                         \
2862 _(CLI_REQUEST, cli_request)                                             \
2863 _(CLI_INBAND, cli_inband)                                               \
2864 _(MEMCLNT_CREATE, memclnt_create)                                       \
2865 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump)           \
2866 _(SHOW_VERSION, show_version)                                           \
2867 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump)                                 \
2868 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel)                   \
2869 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump)                         \
2870 _(INTERFACE_NAME_RENUMBER, interface_name_renumber)                     \
2871 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events)                             \
2872 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events)                               \
2873 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface)                     \
2874 _(IP_ADDRESS_DUMP, ip_address_dump)                                     \
2875 _(IP_DUMP, ip_dump)                                                     \
2876 _(DELETE_LOOPBACK, delete_loopback)                                     \
2877 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del)                                 \
2878 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable)           \
2879 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable)           \
2880 _(AF_PACKET_CREATE, af_packet_create)                                   \
2881 _(AF_PACKET_DELETE, af_packet_delete)                                   \
2882 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats)                   \
2883 _(MPLS_GRE_TUNNEL_DUMP, mpls_gre_tunnel_dump)                           \
2884 _(MPLS_ETH_TUNNEL_DUMP, mpls_eth_tunnel_dump)                           \
2885 _(MPLS_FIB_ENCAP_DUMP, mpls_fib_encap_dump)                             \
2886 _(MPLS_FIB_DECAP_DUMP, mpls_fib_decap_dump)                             \
2887 _(CLASSIFY_TABLE_IDS,classify_table_ids)                                \
2888 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface)             \
2889 _(CLASSIFY_TABLE_INFO,classify_table_info)                              \
2890 _(CLASSIFY_SESSION_DUMP,classify_session_dump)                          \
2891 _(SET_IPFIX_EXPORTER, set_ipfix_exporter)                               \
2892 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump)                             \
2893 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream)                 \
2894 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump)               \
2895 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del)           \
2896 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump)                 \
2897 _(GET_NEXT_INDEX, get_next_index)                                       \
2898 _(PG_CREATE_INTERFACE,pg_create_interface)                              \
2899 _(PG_CAPTURE, pg_capture)                                               \
2900 _(PG_ENABLE_DISABLE, pg_enable_disable)                                 \
2901 _(POLICER_ADD_DEL, policer_add_del)                                     \
2902 _(POLICER_DUMP, policer_dump)                                           \
2903 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface)       \
2904 _(POLICER_CLASSIFY_DUMP, policer_classify_dump)                         \
2905 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL,                               \
2906   ip_source_and_port_range_check_add_del)                               \
2907 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL,                     \
2908   ip_source_and_port_range_check_interface_add_del)                     \
2909 _(LISP_ENABLE_DISABLE, lisp_enable_disable)                             \
2910 _(LISP_GPE_ENABLE_DISABLE, lisp_gpe_enable_disable)                     \
2911 _(LISP_GPE_ADD_DEL_IFACE, lisp_gpe_add_del_iface)                       \
2912 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set)                 \
2913 _(LISP_MAP_REQUEST_MODE, lisp_map_request_mode)                         \
2914 _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode)               \
2915 _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping)             \
2916 _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency)                       \
2917 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS,                                   \
2918   lisp_add_del_map_request_itr_rlocs)                                   \
2919 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map)               \
2920 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid)                       \
2921 _(LISP_GPE_ADD_DEL_FWD_ENTRY, lisp_gpe_add_del_fwd_entry)               \
2922 _(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set)                   \
2923 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver)                 \
2924 _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator)                           \
2925 _(LISP_EID_TABLE_DUMP, lisp_eid_table_dump)                             \
2926 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump)                     \
2927 _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump)                     \
2928 _(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump)                           \
2929 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump)                       \
2930 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump)                         \
2931 _(LISP_LOCATOR_DUMP, lisp_locator_dump)                                 \
2932 _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel)                   \
2933 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump)                         \
2934 _(DELETE_SUBIF, delete_subif)                                           \
2935 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite)
2936   void
2937 vl_msg_api_custom_dump_configure (api_main_t * am)
2938 {
2939 #define _(n,f) am->msg_print_handlers[VL_API_##n]       \
2940     = (void *) vl_api_##f##_t_print;
2941   foreach_custom_print_function;
2942 #undef _
2943 }
2944
2945 /*
2946  * fd.io coding-style-patch-verification: ON
2947  *
2948  * Local Variables:
2949  * eval: (c-set-style "gnu")
2950  * End:
2951  */