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