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