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