classifier-based ACL: refactor + add output ACL
[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   if (mp->is_add == 0)
1547     s = format (s, "del ");
1548
1549   FINISH;
1550 }
1551
1552 static void *vl_api_vxlan_tunnel_dump_t_print
1553   (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1554 {
1555   u8 *s;
1556
1557   s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1558
1559   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1560
1561   FINISH;
1562 }
1563
1564 static void *vl_api_geneve_add_del_tunnel_t_print
1565   (vl_api_geneve_add_del_tunnel_t * mp, void *handle)
1566 {
1567   u8 *s;
1568   s = format (0, "SCRIPT: geneve_add_del_tunnel ");
1569
1570   ip46_address_t local = to_ip46 (mp->is_ipv6, mp->local_address);
1571   ip46_address_t remote = to_ip46 (mp->is_ipv6, mp->remote_address);
1572
1573   u8 is_grp = ip46_address_is_multicast (&remote);
1574   char *remote_name = is_grp ? "group" : "dst";
1575
1576   s = format (s, "src %U ", format_ip46_address, &local, IP46_TYPE_ANY);
1577   s = format (s, "%s %U ", remote_name, format_ip46_address,
1578               &remote, IP46_TYPE_ANY);
1579
1580   if (is_grp)
1581     s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1582
1583   if (mp->encap_vrf_id)
1584     s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1585
1586   s = format (s, "decap-next %d ", ntohl (mp->decap_next_index));
1587
1588   s = format (s, "vni %d ", ntohl (mp->vni));
1589
1590   if (mp->is_add == 0)
1591     s = format (s, "del ");
1592
1593   FINISH;
1594 }
1595
1596 static void *vl_api_geneve_tunnel_dump_t_print
1597   (vl_api_geneve_tunnel_dump_t * mp, void *handle)
1598 {
1599   u8 *s;
1600
1601   s = format (0, "SCRIPT: geneve_tunnel_dump ");
1602
1603   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1604
1605   FINISH;
1606 }
1607
1608 static void *vl_api_gre_add_del_tunnel_t_print
1609   (vl_api_gre_add_del_tunnel_t * mp, void *handle)
1610 {
1611   u8 *s;
1612
1613   s = format (0, "SCRIPT: gre_add_del_tunnel ");
1614
1615   s = format (s, "dst %U ", format_ip46_address,
1616               (ip46_address_t *) & (mp->dst_address),
1617               mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1618
1619   s = format (s, "src %U ", format_ip46_address,
1620               (ip46_address_t *) & (mp->src_address),
1621               mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
1622
1623   if (mp->teb)
1624     s = format (s, "teb ");
1625
1626   if (mp->outer_fib_id)
1627     s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
1628
1629   if (mp->is_add == 0)
1630     s = format (s, "del ");
1631
1632   FINISH;
1633 }
1634
1635 static void *vl_api_gre_tunnel_dump_t_print
1636   (vl_api_gre_tunnel_dump_t * mp, void *handle)
1637 {
1638   u8 *s;
1639
1640   s = format (0, "SCRIPT: gre_tunnel_dump ");
1641
1642   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1643
1644   FINISH;
1645 }
1646
1647 static void *vl_api_l2_fib_clear_table_t_print
1648   (vl_api_l2_fib_clear_table_t * mp, void *handle)
1649 {
1650   u8 *s;
1651
1652   s = format (0, "SCRIPT: l2_fib_clear_table ");
1653
1654   FINISH;
1655 }
1656
1657 static void *vl_api_l2_interface_efp_filter_t_print
1658   (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1659 {
1660   u8 *s;
1661
1662   s = format (0, "SCRIPT: l2_interface_efp_filter ");
1663
1664   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1665   if (mp->enable_disable)
1666     s = format (s, "enable ");
1667   else
1668     s = format (s, "disable ");
1669
1670   FINISH;
1671 }
1672
1673 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1674   (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1675 {
1676   u8 *s;
1677
1678   s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1679
1680   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1681   s = format (s, "vtr_op %d ", ntohl (mp->vtr_op));
1682   s = format (s, "push_dot1q %d ", ntohl (mp->push_dot1q));
1683   s = format (s, "tag1 %d ", ntohl (mp->tag1));
1684   s = format (s, "tag2 %d ", ntohl (mp->tag2));
1685
1686   FINISH;
1687 }
1688
1689 static void *vl_api_create_vhost_user_if_t_print
1690   (vl_api_create_vhost_user_if_t * mp, void *handle)
1691 {
1692   u8 *s;
1693
1694   s = format (0, "SCRIPT: create_vhost_user_if ");
1695
1696   s = format (s, "socket %s ", mp->sock_filename);
1697   if (mp->is_server)
1698     s = format (s, "server ");
1699   if (mp->renumber)
1700     s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1701   if (mp->tag[0])
1702     s = format (s, "tag %s", mp->tag);
1703
1704   FINISH;
1705 }
1706
1707 static void *vl_api_modify_vhost_user_if_t_print
1708   (vl_api_modify_vhost_user_if_t * mp, void *handle)
1709 {
1710   u8 *s;
1711
1712   s = format (0, "SCRIPT: modify_vhost_user_if ");
1713
1714   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1715   s = format (s, "socket %s ", mp->sock_filename);
1716   if (mp->is_server)
1717     s = format (s, "server ");
1718   if (mp->renumber)
1719     s = format (s, "renumber %d ", ntohl (mp->custom_dev_instance));
1720
1721   FINISH;
1722 }
1723
1724 static void *vl_api_delete_vhost_user_if_t_print
1725   (vl_api_delete_vhost_user_if_t * mp, void *handle)
1726 {
1727   u8 *s;
1728
1729   s = format (0, "SCRIPT: delete_vhost_user_if ");
1730   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1731
1732   FINISH;
1733 }
1734
1735 static void *vl_api_sw_interface_vhost_user_dump_t_print
1736   (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
1737 {
1738   u8 *s;
1739
1740   s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
1741
1742   FINISH;
1743 }
1744
1745 static void *vl_api_sw_interface_dump_t_print
1746   (vl_api_sw_interface_dump_t * mp, void *handle)
1747 {
1748   u8 *s;
1749
1750   s = format (0, "SCRIPT: sw_interface_dump ");
1751
1752   if (mp->name_filter_valid)
1753     s = format (s, "name_filter %s ", mp->name_filter);
1754   else
1755     s = format (s, "all ");
1756
1757   FINISH;
1758 }
1759
1760 static void *vl_api_l2_fib_table_dump_t_print
1761   (vl_api_l2_fib_table_dump_t * mp, void *handle)
1762 {
1763   u8 *s;
1764
1765   s = format (0, "SCRIPT: l2_fib_table_dump ");
1766
1767   s = format (s, "bd_id %d ", ntohl (mp->bd_id));
1768
1769   FINISH;
1770 }
1771
1772 static void *vl_api_control_ping_t_print
1773   (vl_api_control_ping_t * mp, void *handle)
1774 {
1775   u8 *s;
1776
1777   s = format (0, "SCRIPT: control_ping ");
1778
1779   FINISH;
1780 }
1781
1782 static void *vl_api_want_interface_events_t_print
1783   (vl_api_want_interface_events_t * mp, void *handle)
1784 {
1785   u8 *s;
1786
1787   s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
1788               ntohl (mp->pid), ntohl (mp->enable_disable));
1789
1790   FINISH;
1791 }
1792
1793 static void *
1794 vl_api_cli_t_print (vl_api_cli_t * mp, void *handle)
1795 {
1796   u8 *s;
1797
1798   s = format (0, "SCRIPT: cli ");
1799
1800   FINISH;
1801 }
1802
1803 static void *vl_api_cli_inband_t_print
1804   (vl_api_cli_inband_t * mp, void *handle)
1805 {
1806   u8 *s;
1807
1808   s = format (0, "SCRIPT: cli_inband ");
1809
1810   FINISH;
1811 }
1812
1813 static void *vl_api_memclnt_create_t_print
1814   (vl_api_memclnt_create_t * mp, void *handle)
1815 {
1816   u8 *s;
1817
1818   s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
1819
1820   FINISH;
1821 }
1822
1823 static void *vl_api_sockclnt_create_t_print
1824   (vl_api_sockclnt_create_t * mp, void *handle)
1825 {
1826   u8 *s;
1827
1828   s = format (0, "SCRIPT: sockclnt_create name %s ", mp->name);
1829
1830   FINISH;
1831 }
1832
1833 static void *vl_api_show_version_t_print
1834   (vl_api_show_version_t * mp, void *handle)
1835 {
1836   u8 *s;
1837
1838   s = format (0, "SCRIPT: show_version ");
1839
1840   FINISH;
1841 }
1842
1843 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
1844   (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
1845 {
1846   u8 *s;
1847
1848   s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
1849
1850   ip46_address_t local = to_ip46 (mp->is_ipv6, mp->local);
1851   ip46_address_t remote = to_ip46 (mp->is_ipv6, mp->remote);
1852
1853   u8 is_grp = ip46_address_is_multicast (&remote);
1854   char *remote_name = is_grp ? "group" : "remote";
1855
1856   s = format (s, "local %U ", format_ip46_address, &local, IP46_TYPE_ANY);
1857   s = format (s, "%s %U ", remote_name, format_ip46_address,
1858               &remote, IP46_TYPE_ANY);
1859
1860   if (is_grp)
1861     s = format (s, "mcast_sw_if_index %d ", ntohl (mp->mcast_sw_if_index));
1862   s = format (s, "protocol %d ", ntohl (mp->protocol));
1863
1864   s = format (s, "vni %d ", ntohl (mp->vni));
1865
1866   if (mp->is_add == 0)
1867     s = format (s, "del ");
1868
1869   if (mp->encap_vrf_id)
1870     s = format (s, "encap-vrf-id %d ", ntohl (mp->encap_vrf_id));
1871
1872   if (mp->decap_vrf_id)
1873     s = format (s, "decap-vrf-id %d ", ntohl (mp->decap_vrf_id));
1874
1875   FINISH;
1876 }
1877
1878 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
1879   (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
1880 {
1881   u8 *s;
1882
1883   s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
1884
1885   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1886
1887   FINISH;
1888 }
1889
1890 static void *vl_api_interface_name_renumber_t_print
1891   (vl_api_interface_name_renumber_t * mp, void *handle)
1892 {
1893   u8 *s;
1894
1895   s = format (0, "SCRIPT: interface_renumber ");
1896
1897   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1898
1899   s = format (s, "new_show_dev_instance %d ",
1900               ntohl (mp->new_show_dev_instance));
1901
1902   FINISH;
1903 }
1904
1905 static void *vl_api_want_ip4_arp_events_t_print
1906   (vl_api_want_ip4_arp_events_t * mp, void *handle)
1907 {
1908   u8 *s;
1909
1910   s = format (0, "SCRIPT: want_ip4_arp_events ");
1911   s = format (s, "pid %d address %U ", ntohl (mp->pid),
1912               format_ip4_address, &mp->address);
1913   if (mp->enable_disable == 0)
1914     s = format (s, "del ");
1915
1916   FINISH;
1917 }
1918
1919 static void *vl_api_want_ip6_nd_events_t_print
1920   (vl_api_want_ip6_nd_events_t * mp, void *handle)
1921 {
1922   u8 *s;
1923
1924   s = format (0, "SCRIPT: want_ip6_nd_events ");
1925   s = format (s, "pid %d address %U ", ntohl (mp->pid),
1926               format_ip6_address, mp->address);
1927   if (mp->enable_disable == 0)
1928     s = format (s, "del ");
1929
1930   FINISH;
1931 }
1932
1933 static void *vl_api_want_l2_macs_events_t_print
1934   (vl_api_want_l2_macs_events_t * mp, void *handle)
1935 {
1936   u8 *s;
1937
1938   s = format (0, "SCRIPT: want_l2_macs_events ");
1939   s = format (s, "learn-limit %d ", ntohl (mp->learn_limit));
1940   s = format (s, "scan-delay %d ", (u32) mp->scan_delay);
1941   s = format (s, "max-entries %d ", (u32) mp->max_macs_in_event * 10);
1942   if (mp->enable_disable == 0)
1943     s = format (s, "disable");
1944
1945   FINISH;
1946 }
1947
1948 static void *vl_api_input_acl_set_interface_t_print
1949   (vl_api_input_acl_set_interface_t * mp, void *handle)
1950 {
1951   u8 *s;
1952
1953   s = format (0, "SCRIPT: input_acl_set_interface ");
1954
1955   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1956   s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1957   s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1958   s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
1959
1960   if (mp->is_add == 0)
1961     s = format (s, "del ");
1962
1963   FINISH;
1964 }
1965
1966 static void *vl_api_output_acl_set_interface_t_print
1967   (vl_api_output_acl_set_interface_t * mp, void *handle)
1968 {
1969   u8 *s;
1970
1971   s = format (0, "SCRIPT: output_acl_set_interface ");
1972
1973   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1974   s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
1975   s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
1976   s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
1977
1978   if (mp->is_add == 0)
1979     s = format (s, "del ");
1980
1981   FINISH;
1982 }
1983
1984 static void *vl_api_ip_address_dump_t_print
1985   (vl_api_ip_address_dump_t * mp, void *handle)
1986 {
1987   u8 *s;
1988
1989   s = format (0, "SCRIPT: ip6_address_dump ");
1990   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
1991   s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1992
1993   FINISH;
1994 }
1995
1996 static void *
1997 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
1998 {
1999   u8 *s;
2000
2001   s = format (0, "SCRIPT: ip_dump ");
2002   s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
2003
2004   FINISH;
2005 }
2006
2007 static void *vl_api_cop_interface_enable_disable_t_print
2008   (vl_api_cop_interface_enable_disable_t * mp, void *handle)
2009 {
2010   u8 *s;
2011
2012   s = format (0, "SCRIPT: cop_interface_enable_disable ");
2013   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2014   if (mp->enable_disable)
2015     s = format (s, "enable ");
2016   else
2017     s = format (s, "disable ");
2018
2019   FINISH;
2020 }
2021
2022 static void *vl_api_cop_whitelist_enable_disable_t_print
2023   (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
2024 {
2025   u8 *s;
2026
2027   s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
2028   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2029   s = format (s, "fib-id %d ", ntohl (mp->fib_id));
2030   if (mp->ip4)
2031     s = format (s, "ip4 ");
2032   if (mp->ip6)
2033     s = format (s, "ip6 ");
2034   if (mp->default_cop)
2035     s = format (s, "default ");
2036
2037   FINISH;
2038 }
2039
2040 static void *vl_api_af_packet_create_t_print
2041   (vl_api_af_packet_create_t * mp, void *handle)
2042 {
2043   u8 *s;
2044
2045   s = format (0, "SCRIPT: af_packet_create ");
2046   s = format (s, "host_if_name %s ", mp->host_if_name);
2047   if (mp->use_random_hw_addr)
2048     s = format (s, "hw_addr random ");
2049   else
2050     s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
2051
2052   FINISH;
2053 }
2054
2055 static void *vl_api_af_packet_delete_t_print
2056   (vl_api_af_packet_delete_t * mp, void *handle)
2057 {
2058   u8 *s;
2059
2060   s = format (0, "SCRIPT: af_packet_delete ");
2061   s = format (s, "host_if_name %s ", mp->host_if_name);
2062
2063   FINISH;
2064 }
2065
2066 static u8 *
2067 format_policer_action (u8 * s, va_list * va)
2068 {
2069   u32 action = va_arg (*va, u32);
2070   u32 dscp = va_arg (*va, u32);
2071   char *t = 0;
2072
2073   if (action == SSE2_QOS_ACTION_DROP)
2074     s = format (s, "drop");
2075   else if (action == SSE2_QOS_ACTION_TRANSMIT)
2076     s = format (s, "transmit");
2077   else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
2078     {
2079       s = format (s, "mark-and-transmit ");
2080       switch (dscp)
2081         {
2082 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
2083           foreach_vnet_dscp
2084 #undef _
2085         default:
2086           break;
2087         }
2088       s = format (s, "%s", t);
2089     }
2090   return s;
2091 }
2092
2093 static void *vl_api_policer_add_del_t_print
2094   (vl_api_policer_add_del_t * mp, void *handle)
2095 {
2096   u8 *s;
2097
2098   s = format (0, "SCRIPT: policer_add_del ");
2099   s = format (s, "name %s ", mp->name);
2100   s = format (s, "cir %d ", mp->cir);
2101   s = format (s, "eir %d ", mp->eir);
2102   s = format (s, "cb %d ", mp->cb);
2103   s = format (s, "eb %d ", mp->eb);
2104
2105   switch (mp->rate_type)
2106     {
2107     case SSE2_QOS_RATE_KBPS:
2108       s = format (s, "rate_type kbps ");
2109       break;
2110     case SSE2_QOS_RATE_PPS:
2111       s = format (s, "rate_type pps ");
2112       break;
2113     default:
2114       break;
2115     }
2116
2117   switch (mp->round_type)
2118     {
2119     case SSE2_QOS_ROUND_TO_CLOSEST:
2120       s = format (s, "round_type closest ");
2121       break;
2122     case SSE2_QOS_ROUND_TO_UP:
2123       s = format (s, "round_type up ");
2124       break;
2125     case SSE2_QOS_ROUND_TO_DOWN:
2126       s = format (s, "round_type down ");
2127       break;
2128     default:
2129       break;
2130     }
2131
2132   switch (mp->type)
2133     {
2134     case SSE2_QOS_POLICER_TYPE_1R2C:
2135       s = format (s, "type 1r2c ");
2136       break;
2137     case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
2138       s = format (s, "type 1r3c ");
2139       break;
2140     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
2141       s = format (s, "type 2r3c-2698 ");
2142       break;
2143     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
2144       s = format (s, "type 2r3c-4115 ");
2145       break;
2146     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
2147       s = format (s, "type 2r3c-mef5cf1 ");
2148       break;
2149     default:
2150       break;
2151     }
2152
2153   s = format (s, "conform_action %U ", format_policer_action,
2154               mp->conform_action_type, mp->conform_dscp);
2155   s = format (s, "exceed_action %U ", format_policer_action,
2156               mp->exceed_action_type, mp->exceed_dscp);
2157   s = format (s, "violate_action %U ", format_policer_action,
2158               mp->violate_action_type, mp->violate_dscp);
2159
2160   if (mp->color_aware)
2161     s = format (s, "color-aware ");
2162   if (mp->is_add == 0)
2163     s = format (s, "del ");
2164
2165   FINISH;
2166 }
2167
2168 static void *vl_api_policer_dump_t_print
2169   (vl_api_policer_dump_t * mp, void *handle)
2170 {
2171   u8 *s;
2172
2173   s = format (0, "SCRIPT: policer_dump ");
2174   if (mp->match_name_valid)
2175     s = format (s, "name %s ", mp->match_name);
2176
2177   FINISH;
2178 }
2179
2180 static void *vl_api_policer_classify_set_interface_t_print
2181   (vl_api_policer_classify_set_interface_t * mp, void *handle)
2182 {
2183   u8 *s;
2184
2185   s = format (0, "SCRIPT: policer_classify_set_interface ");
2186   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2187   if (mp->ip4_table_index != ~0)
2188     s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2189   if (mp->ip6_table_index != ~0)
2190     s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2191   if (mp->l2_table_index != ~0)
2192     s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
2193   if (mp->is_add == 0)
2194     s = format (s, "del ");
2195
2196   FINISH;
2197 }
2198
2199 static void *vl_api_policer_classify_dump_t_print
2200   (vl_api_policer_classify_dump_t * mp, void *handle)
2201 {
2202   u8 *s;
2203
2204   s = format (0, "SCRIPT: policer_classify_dump ");
2205   switch (mp->type)
2206     {
2207     case POLICER_CLASSIFY_TABLE_IP4:
2208       s = format (s, "type ip4 ");
2209       break;
2210     case POLICER_CLASSIFY_TABLE_IP6:
2211       s = format (s, "type ip6 ");
2212       break;
2213     case POLICER_CLASSIFY_TABLE_L2:
2214       s = format (s, "type l2 ");
2215       break;
2216     default:
2217       break;
2218     }
2219
2220   FINISH;
2221 }
2222
2223 static void *vl_api_sw_interface_clear_stats_t_print
2224   (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2225 {
2226   u8 *s;
2227
2228   s = format (0, "SCRIPT: sw_interface_clear_stats ");
2229   if (mp->sw_if_index != ~0)
2230     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2231
2232   FINISH;
2233 }
2234
2235 static void *vl_api_mpls_tunnel_dump_t_print
2236   (vl_api_mpls_tunnel_dump_t * mp, void *handle)
2237 {
2238   u8 *s;
2239
2240   s = format (0, "SCRIPT: mpls_tunnel_dump ");
2241
2242   s = format (s, "tunnel_index %d ", ntohl (mp->tunnel_index));
2243
2244   FINISH;
2245 }
2246
2247 static void *vl_api_mpls_fib_dump_t_print
2248   (vl_api_mpls_fib_dump_t * mp, void *handle)
2249 {
2250   u8 *s;
2251
2252   s = format (0, "SCRIPT: mpls_fib_decap_dump ");
2253
2254   FINISH;
2255 }
2256
2257 static void *vl_api_ip_fib_dump_t_print
2258   (vl_api_ip_fib_dump_t * mp, void *handle)
2259 {
2260   u8 *s;
2261
2262   s = format (0, "SCRIPT: ip_fib_dump ");
2263
2264   FINISH;
2265 }
2266
2267 static void *vl_api_ip6_fib_dump_t_print
2268   (vl_api_ip6_fib_dump_t * mp, void *handle)
2269 {
2270   u8 *s;
2271
2272   s = format (0, "SCRIPT: ip6_fib_dump ");
2273
2274   FINISH;
2275 }
2276
2277 static void *vl_api_classify_table_ids_t_print
2278   (vl_api_classify_table_ids_t * mp, void *handle)
2279 {
2280   u8 *s;
2281
2282   s = format (0, "SCRIPT: classify_table_ids ");
2283
2284   FINISH;
2285 }
2286
2287 static void *vl_api_classify_table_by_interface_t_print
2288   (vl_api_classify_table_by_interface_t * mp, void *handle)
2289 {
2290   u8 *s;
2291
2292   s = format (0, "SCRIPT: classify_table_by_interface ");
2293   if (mp->sw_if_index != ~0)
2294     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2295
2296   FINISH;
2297 }
2298
2299 static void *vl_api_classify_table_info_t_print
2300   (vl_api_classify_table_info_t * mp, void *handle)
2301 {
2302   u8 *s;
2303
2304   s = format (0, "SCRIPT: classify_table_info ");
2305   if (mp->table_id != ~0)
2306     s = format (s, "table_id %d ", ntohl (mp->table_id));
2307
2308   FINISH;
2309 }
2310
2311 static void *vl_api_classify_session_dump_t_print
2312   (vl_api_classify_session_dump_t * mp, void *handle)
2313 {
2314   u8 *s;
2315
2316   s = format (0, "SCRIPT: classify_session_dump ");
2317   if (mp->table_id != ~0)
2318     s = format (s, "table_id %d ", ntohl (mp->table_id));
2319
2320   FINISH;
2321 }
2322
2323 static void *vl_api_set_ipfix_exporter_t_print
2324   (vl_api_set_ipfix_exporter_t * mp, void *handle)
2325 {
2326   u8 *s;
2327
2328   s = format (0, "SCRIPT: set_ipfix_exporter ");
2329
2330   s = format (s, "collector-address %U ", format_ip4_address,
2331               (ip4_address_t *) mp->collector_address);
2332   s = format (s, "collector-port %d ", ntohs (mp->collector_port));
2333   s = format (s, "src-address %U ", format_ip4_address,
2334               (ip4_address_t *) mp->src_address);
2335   s = format (s, "vrf-id %d ", ntohl (mp->vrf_id));
2336   s = format (s, "path-mtu %d ", ntohl (mp->path_mtu));
2337   s = format (s, "template-interval %d ", ntohl (mp->template_interval));
2338   s = format (s, "udp-checksum %d ", mp->udp_checksum);
2339
2340   FINISH;
2341 }
2342
2343 static void *vl_api_ipfix_exporter_dump_t_print
2344   (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2345 {
2346   u8 *s;
2347
2348   s = format (0, "SCRIPT: ipfix_exporter_dump ");
2349
2350   FINISH;
2351 }
2352
2353 static void *vl_api_set_ipfix_classify_stream_t_print
2354   (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2355 {
2356   u8 *s;
2357
2358   s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2359
2360   s = format (s, "domain-id %d ", ntohl (mp->domain_id));
2361   s = format (s, "src-port %d ", ntohs (mp->src_port));
2362
2363   FINISH;
2364 }
2365
2366 static void *vl_api_ipfix_classify_stream_dump_t_print
2367   (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2368 {
2369   u8 *s;
2370
2371   s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2372
2373   FINISH;
2374 }
2375
2376 static void *vl_api_ipfix_classify_table_add_del_t_print
2377   (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2378 {
2379   u8 *s;
2380
2381   s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2382
2383   s = format (s, "table-id %d ", ntohl (mp->table_id));
2384   s = format (s, "ip-version %d ", mp->ip_version);
2385   s = format (s, "transport-protocol %d ", mp->transport_protocol);
2386
2387   FINISH;
2388 }
2389
2390 static void *vl_api_ipfix_classify_table_dump_t_print
2391   (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2392 {
2393   u8 *s;
2394
2395   s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2396
2397   FINISH;
2398 }
2399
2400 static void *vl_api_sw_interface_span_enable_disable_t_print
2401   (vl_api_sw_interface_span_enable_disable_t * mp, void *handle)
2402 {
2403   u8 *s;
2404
2405   s = format (0, "SCRIPT: sw_interface_span_enable_disable ");
2406   s = format (s, "src_sw_if_index %u ", ntohl (mp->sw_if_index_from));
2407   s = format (s, "dst_sw_if_index %u ", ntohl (mp->sw_if_index_to));
2408
2409   if (mp->is_l2)
2410     s = format (s, "l2 ");
2411
2412   switch (mp->state)
2413     {
2414     case 0:
2415       s = format (s, "disable ");
2416       break;
2417     case 1:
2418       s = format (s, "rx ");
2419       break;
2420     case 2:
2421       s = format (s, "tx ");
2422       break;
2423     case 3:
2424     default:
2425       s = format (s, "both ");
2426       break;
2427     }
2428
2429   FINISH;
2430 }
2431
2432 static void *
2433 vl_api_sw_interface_span_dump_t_print (vl_api_sw_interface_span_dump_t * mp,
2434                                        void *handle)
2435 {
2436   u8 *s;
2437
2438   s = format (0, "SCRIPT: sw_interface_span_dump ");
2439
2440   if (mp->is_l2)
2441     s = format (s, "l2 ");
2442
2443   FINISH;
2444 }
2445
2446 static void *vl_api_get_next_index_t_print
2447   (vl_api_get_next_index_t * mp, void *handle)
2448 {
2449   u8 *s;
2450
2451   s = format (0, "SCRIPT: get_next_index ");
2452   s = format (s, "node-name %s ", mp->node_name);
2453   s = format (s, "next-node-name %s ", mp->next_name);
2454
2455   FINISH;
2456 }
2457
2458 static void *vl_api_pg_create_interface_t_print
2459   (vl_api_pg_create_interface_t * mp, void *handle)
2460 {
2461   u8 *s;
2462
2463   s = format (0, "SCRIPT: pg_create_interface ");
2464   s = format (0, "if_id %d", ntohl (mp->interface_id));
2465
2466   FINISH;
2467 }
2468
2469 static void *vl_api_pg_capture_t_print
2470   (vl_api_pg_capture_t * mp, void *handle)
2471 {
2472   u8 *s;
2473
2474   s = format (0, "SCRIPT: pg_capture ");
2475   s = format (0, "if_id %d ", ntohl (mp->interface_id));
2476   s = format (0, "pcap %s", mp->pcap_file_name);
2477   if (mp->count != ~0)
2478     s = format (s, "count %d ", ntohl (mp->count));
2479   if (!mp->is_enabled)
2480     s = format (s, "disable");
2481
2482   FINISH;
2483 }
2484
2485 static void *vl_api_pg_enable_disable_t_print
2486   (vl_api_pg_enable_disable_t * mp, void *handle)
2487 {
2488   u8 *s;
2489
2490   s = format (0, "SCRIPT: pg_enable_disable ");
2491   if (ntohl (mp->stream_name_length) > 0)
2492     s = format (s, "stream %s", mp->stream_name);
2493   if (!mp->is_enabled)
2494     s = format (s, "disable");
2495
2496   FINISH;
2497 }
2498
2499 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2500   (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2501 {
2502   u8 *s;
2503   int i;
2504
2505   s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2506   if (mp->is_ipv6)
2507     s = format (s, "%U/%d ", format_ip6_address, mp->address,
2508                 mp->mask_length);
2509   else
2510     s = format (s, "%U/%d ", format_ip4_address, mp->address,
2511                 mp->mask_length);
2512
2513   for (i = 0; i < mp->number_of_ranges; i++)
2514     {
2515       s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2516     }
2517
2518   s = format (s, "vrf %d ", ntohl (mp->vrf_id));
2519
2520   if (mp->is_add == 0)
2521     s = format (s, "del ");
2522
2523   FINISH;
2524 }
2525
2526 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2527   (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2528    void *handle)
2529 {
2530   u8 *s;
2531
2532   s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2533
2534   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2535
2536   if (mp->tcp_out_vrf_id != ~0)
2537     s = format (s, "tcp-out-vrf %d ", ntohl (mp->tcp_out_vrf_id));
2538
2539   if (mp->udp_out_vrf_id != ~0)
2540     s = format (s, "udp-out-vrf %d ", ntohl (mp->udp_out_vrf_id));
2541
2542   if (mp->tcp_in_vrf_id != ~0)
2543     s = format (s, "tcp-in-vrf %d ", ntohl (mp->tcp_in_vrf_id));
2544
2545   if (mp->udp_in_vrf_id != ~0)
2546     s = format (s, "udp-in-vrf %d ", ntohl (mp->udp_in_vrf_id));
2547
2548   if (mp->is_add == 0)
2549     s = format (s, "del ");
2550
2551   FINISH;
2552 }
2553
2554 static void *vl_api_lisp_enable_disable_t_print
2555   (vl_api_lisp_enable_disable_t * mp, void *handle)
2556 {
2557   u8 *s;
2558
2559   s = format (0, "SCRIPT: lisp_enable_disable %s",
2560               mp->is_en ? "enable" : "disable");
2561
2562   FINISH;
2563 }
2564
2565 static void *vl_api_gpe_add_del_iface_t_print
2566   (vl_api_gpe_add_del_iface_t * mp, void *handle)
2567 {
2568   u8 *s;
2569
2570   s = format (0, "SCRIPT: gpe_add_del_iface ");
2571
2572   s = format (s, "%s ", mp->is_add ? "up" : "down");
2573   s = format (s, "vni %d ", mp->vni);
2574   s = format (s, "%s %d ", mp->is_l2 ? "bd_id" : "table_id", mp->dp_table);
2575
2576   FINISH;
2577 }
2578
2579 static void *vl_api_lisp_pitr_set_locator_set_t_print
2580   (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
2581 {
2582   u8 *s;
2583
2584   s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
2585
2586   if (mp->is_add)
2587     s = format (s, "locator-set %s ", mp->ls_name);
2588   else
2589     s = format (s, "del");
2590
2591   FINISH;
2592 }
2593
2594 static u8 *
2595 format_lisp_flat_eid (u8 * s, va_list * args)
2596 {
2597   u32 type = va_arg (*args, u32);
2598   u8 *eid = va_arg (*args, u8 *);
2599   u32 eid_len = va_arg (*args, u32);
2600
2601   switch (type)
2602     {
2603     case 0:
2604       return format (s, "%U/%d", format_ip4_address, eid, eid_len);
2605     case 1:
2606       return format (s, "%U/%d", format_ip6_address, eid, eid_len);
2607     case 3:
2608       return format (s, "%U", format_ethernet_address, eid);
2609     }
2610   return 0;
2611 }
2612
2613 static void *vl_api_lisp_add_del_remote_mapping_t_print
2614   (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
2615 {
2616   u8 *s;
2617   u32 rloc_num = 0;
2618
2619   s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
2620
2621   if (mp->del_all)
2622     s = format (s, "del-all ");
2623
2624   s = format (s, "%s ", mp->is_add ? "add" : "del");
2625   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2626
2627   s = format (s, "eid %U ", format_lisp_flat_eid,
2628               mp->eid_type, mp->eid, mp->eid_len);
2629
2630   if (mp->is_src_dst)
2631     {
2632       s = format (s, "seid %U ", format_lisp_flat_eid,
2633                   mp->eid_type, mp->seid, mp->seid_len);
2634     }
2635   rloc_num = clib_net_to_host_u32 (mp->rloc_num);
2636
2637   if (0 == rloc_num)
2638     s = format (s, "action %d", mp->action);
2639
2640   FINISH;
2641 }
2642
2643 static void *vl_api_lisp_add_del_adjacency_t_print
2644   (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
2645 {
2646   u8 *s;
2647
2648   s = format (0, "SCRIPT: lisp_add_del_adjacency ");
2649
2650   s = format (s, "%s ", mp->is_add ? "add" : "del");
2651   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2652   s = format (s, "reid %U leid %U ",
2653               format_lisp_flat_eid, mp->eid_type, mp->reid, mp->reid_len,
2654               format_lisp_flat_eid, mp->eid_type, mp->leid, mp->leid_len);
2655
2656   FINISH;
2657 }
2658
2659 static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
2660   (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
2661 {
2662   u8 *s;
2663
2664   s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
2665
2666   if (mp->is_add)
2667     s = format (s, "%s", mp->locator_set_name);
2668   else
2669     s = format (s, "del");
2670
2671   FINISH;
2672 }
2673
2674 static void *vl_api_lisp_eid_table_add_del_map_t_print
2675   (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
2676 {
2677   u8 *s;
2678
2679   s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
2680
2681   if (!mp->is_add)
2682     s = format (s, "del ");
2683
2684   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2685   s = format (s, "%s %d ",
2686               mp->is_l2 ? "bd_index" : "vrf",
2687               clib_net_to_host_u32 (mp->dp_table));
2688   FINISH;
2689 }
2690
2691 static void *vl_api_lisp_add_del_local_eid_t_print
2692   (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
2693 {
2694   u8 *s;
2695
2696   s = format (0, "SCRIPT: lisp_add_del_local_eid ");
2697
2698   if (!mp->is_add)
2699     s = format (s, "del ");
2700
2701   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2702   s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type, mp->eid,
2703               mp->prefix_len);
2704   s = format (s, "locator-set %s ", mp->locator_set_name);
2705   if (*mp->key)
2706     {
2707       u32 key_id = mp->key_id;
2708       s = format (s, "key-id %U", format_hmac_key_id, key_id);
2709       s = format (s, "secret-key %s", mp->key);
2710     }
2711   FINISH;
2712 }
2713
2714 static void *vl_api_gpe_add_del_fwd_entry_t_print
2715   (vl_api_gpe_add_del_fwd_entry_t * mp, void *handle)
2716 {
2717   u8 *s;
2718
2719   s = format (0, "SCRIPT: gpe_add_del_fwd_entry TODO");
2720
2721   FINISH;
2722 }
2723
2724 static void *vl_api_lisp_add_del_map_resolver_t_print
2725   (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
2726 {
2727   u8 *s;
2728
2729   s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
2730
2731   if (!mp->is_add)
2732     s = format (s, "del ");
2733
2734   if (mp->is_ipv6)
2735     s = format (s, "%U ", format_ip6_address, mp->ip_address);
2736   else
2737     s = format (s, "%U ", format_ip4_address, mp->ip_address);
2738
2739   FINISH;
2740 }
2741
2742 static void *vl_api_gpe_enable_disable_t_print
2743   (vl_api_gpe_enable_disable_t * mp, void *handle)
2744 {
2745   u8 *s;
2746
2747   s = format (0, "SCRIPT: gpe_enable_disable ");
2748
2749   s = format (s, "%s ", mp->is_en ? "enable" : "disable");
2750
2751   FINISH;
2752 }
2753
2754 static void *vl_api_lisp_add_del_locator_set_t_print
2755   (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
2756 {
2757   u8 *s;
2758
2759   s = format (0, "SCRIPT: lisp_add_del_locator_set ");
2760
2761   if (!mp->is_add)
2762     s = format (s, "del ");
2763
2764   s = format (s, "locator-set %s ", mp->locator_set_name);
2765
2766   FINISH;
2767 }
2768
2769 static void *vl_api_lisp_add_del_locator_t_print
2770   (vl_api_lisp_add_del_locator_t * mp, void *handle)
2771 {
2772   u8 *s;
2773
2774   s = format (0, "SCRIPT: lisp_add_del_locator ");
2775
2776   if (!mp->is_add)
2777     s = format (s, "del ");
2778
2779   s = format (s, "locator-set %s ", mp->locator_set_name);
2780   s = format (s, "sw_if_index %d ", mp->sw_if_index);
2781   s = format (s, "p %d w %d ", mp->priority, mp->weight);
2782
2783   FINISH;
2784 }
2785
2786 static void *vl_api_lisp_locator_set_dump_t_print
2787   (vl_api_lisp_locator_set_dump_t * mp, void *handle)
2788 {
2789   u8 *s;
2790
2791   s = format (0, "SCRIPT: lisp_locator_set_dump ");
2792   if (mp->filter == 1)
2793     s = format (s, "local");
2794   else if (mp->filter == 2)
2795     s = format (s, "remote");
2796
2797   FINISH;
2798 }
2799
2800 static void *vl_api_lisp_locator_dump_t_print
2801   (vl_api_lisp_locator_dump_t * mp, void *handle)
2802 {
2803   u8 *s;
2804
2805   s = format (0, "SCRIPT: lisp_locator_dump ");
2806   if (mp->is_index_set)
2807     s = format (s, "ls_index %d", clib_net_to_host_u32 (mp->ls_index));
2808   else
2809     s = format (s, "ls_name %s", mp->ls_name);
2810
2811   FINISH;
2812 }
2813
2814 static void *vl_api_lisp_map_request_mode_t_print
2815   (vl_api_lisp_map_request_mode_t * mp, void *handle)
2816 {
2817   u8 *s;
2818
2819   s = format (0, "SCRIPT: lisp_map_request_mode ");
2820
2821   switch (mp->mode)
2822     {
2823     case 0:
2824       s = format (s, "dst-only");
2825       break;
2826     case 1:
2827       s = format (s, "src-dst");
2828     default:
2829       break;
2830     }
2831
2832   FINISH;
2833 }
2834
2835 static void *vl_api_lisp_eid_table_dump_t_print
2836   (vl_api_lisp_eid_table_dump_t * mp, void *handle)
2837 {
2838   u8 *s;
2839
2840   s = format (0, "SCRIPT: lisp_eid_table_dump ");
2841
2842   if (mp->eid_set)
2843     {
2844       s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
2845       s = format (s, "eid %U ", format_lisp_flat_eid, mp->eid_type,
2846                   mp->eid, mp->prefix_length);
2847       switch (mp->filter)
2848         {
2849         case 1:
2850           s = format (s, "local ");
2851           break;
2852         case 2:
2853           s = format (s, "remote ");
2854           break;
2855         }
2856     }
2857   FINISH;
2858 }
2859
2860 static void *vl_api_lisp_rloc_probe_enable_disable_t_print
2861   (vl_api_lisp_rloc_probe_enable_disable_t * mp, void *handle)
2862 {
2863   u8 *s;
2864
2865   s = format (0, "SCRIPT: lisp_rloc_probe_enable_disable ");
2866   if (mp->is_enabled)
2867     s = format (s, "enable");
2868   else
2869     s = format (s, "disable");
2870
2871   FINISH;
2872 }
2873
2874 static void *vl_api_lisp_map_register_enable_disable_t_print
2875   (vl_api_lisp_map_register_enable_disable_t * mp, void *handle)
2876 {
2877   u8 *s;
2878
2879   s = format (0, "SCRIPT: lisp_map_register_enable_disable ");
2880   if (mp->is_enabled)
2881     s = format (s, "enable");
2882   else
2883     s = format (s, "disable");
2884
2885   FINISH;
2886 }
2887
2888 static void *vl_api_lisp_adjacencies_get_t_print
2889   (vl_api_lisp_adjacencies_get_t * mp, void *handle)
2890 {
2891   u8 *s;
2892
2893   s = format (0, "SCRIPT: lisp_adjacencies_get ");
2894   s = format (s, "vni %d", clib_net_to_host_u32 (mp->vni));
2895
2896   FINISH;
2897 }
2898
2899 static void *vl_api_lisp_eid_table_map_dump_t_print
2900   (vl_api_lisp_eid_table_map_dump_t * mp, void *handle)
2901 {
2902   u8 *s;
2903
2904   s = format (0, "SCRIPT: lisp_eid_table_map_dump ");
2905
2906   if (mp->is_l2)
2907     s = format (s, "l2");
2908   else
2909     s = format (s, "l3");
2910
2911   FINISH;
2912 }
2913
2914 static void *vl_api_ipsec_gre_add_del_tunnel_t_print
2915   (vl_api_ipsec_gre_add_del_tunnel_t * mp, void *handle)
2916 {
2917   u8 *s;
2918
2919   s = format (0, "SCRIPT: ipsec_gre_add_del_tunnel ");
2920
2921   s = format (s, "dst %U ", format_ip4_address,
2922               (ip4_address_t *) & (mp->dst_address));
2923
2924   s = format (s, "src %U ", format_ip4_address,
2925               (ip4_address_t *) & (mp->src_address));
2926
2927   s = format (s, "local_sa %d ", ntohl (mp->local_sa_id));
2928
2929   s = format (s, "remote_sa %d ", ntohl (mp->remote_sa_id));
2930
2931   if (mp->is_add == 0)
2932     s = format (s, "del ");
2933
2934   FINISH;
2935 }
2936
2937 static void *vl_api_ipsec_gre_tunnel_dump_t_print
2938   (vl_api_ipsec_gre_tunnel_dump_t * mp, void *handle)
2939 {
2940   u8 *s;
2941
2942   s = format (0, "SCRIPT: ipsec_gre_tunnel_dump ");
2943
2944   if (mp->sw_if_index != ~0)
2945     s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2946
2947   FINISH;
2948 }
2949
2950 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
2951   (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
2952 {
2953   u8 *s;
2954   u32 vtr_op = ntohl (mp->vtr_op);
2955
2956   s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
2957
2958   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2959   s = format (s, "vtr_op %d ", vtr_op);
2960   if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
2961     {
2962       if (vtr_op == L2_VTR_TRANSLATE_2_2)
2963         s = format (s, "%d ", ntohs (mp->outer_tag));
2964       s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
2965       s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
2966       s = format (s, "sid %d ", ntohl (mp->i_sid));
2967       s = format (s, "vlanid %d ", ntohs (mp->b_vlanid));
2968     }
2969   FINISH;
2970 }
2971
2972 static void *vl_api_flow_classify_set_interface_t_print
2973   (vl_api_flow_classify_set_interface_t * mp, void *handle)
2974 {
2975   u8 *s;
2976
2977   s = format (0, "SCRIPT: flow_classify_set_interface ");
2978   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2979   if (mp->ip4_table_index != ~0)
2980     s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
2981   if (mp->ip6_table_index != ~0)
2982     s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
2983   if (mp->is_add == 0)
2984     s = format (s, "del ");
2985
2986   FINISH;
2987 }
2988
2989 static void *
2990 vl_api_punt_t_print (vl_api_punt_t * mp, void *handle)
2991 {
2992   u8 *s;
2993
2994   s = format (0, "SCRIPT: punt ");
2995
2996   if (mp->ipv != (u8) ~ 0)
2997     s = format (s, "ip %d ", mp->ipv);
2998
2999   s = format (s, "protocol %d ", mp->l4_protocol);
3000
3001   if (mp->l4_port != (u16) ~ 0)
3002     s = format (s, "port %d ", ntohs (mp->l4_port));
3003
3004   if (!mp->is_add)
3005     s = format (s, "del ");
3006
3007   FINISH;
3008 }
3009
3010 static void *vl_api_flow_classify_dump_t_print
3011   (vl_api_flow_classify_dump_t * mp, void *handle)
3012 {
3013   u8 *s;
3014
3015   s = format (0, "SCRIPT: flow_classify_dump ");
3016   switch (mp->type)
3017     {
3018     case FLOW_CLASSIFY_TABLE_IP4:
3019       s = format (s, "type ip4 ");
3020       break;
3021     case FLOW_CLASSIFY_TABLE_IP6:
3022       s = format (s, "type ip6 ");
3023       break;
3024     default:
3025       break;
3026     }
3027
3028   FINISH;
3029 }
3030
3031 static void *vl_api_get_first_msg_id_t_print
3032   (vl_api_get_first_msg_id_t * mp, void *handle)
3033 {
3034   u8 *s;
3035
3036   s = format (0, "SCRIPT: get_first_msg_id %s ", mp->name);
3037
3038   FINISH;
3039 }
3040
3041 static void *vl_api_ioam_enable_t_print
3042   (vl_api_ioam_enable_t * mp, void *handle)
3043 {
3044   u8 *s;
3045
3046   s = format (0, "SCRIPT: ioam_enable ");
3047
3048   if (mp->trace_enable)
3049     s = format (s, "trace enabled");
3050
3051   if (mp->pot_enable)
3052     s = format (s, "POT enabled");
3053
3054   if (mp->seqno)
3055     s = format (s, "Seqno enabled");
3056
3057   if (mp->analyse)
3058     s = format (s, "Analyse enabled");
3059
3060   FINISH;
3061 }
3062
3063 static void *vl_api_ioam_disable_t_print
3064   (vl_api_ioam_disable_t * mp, void *handle)
3065 {
3066   u8 *s;
3067
3068   s = format (0, "SCRIPT: ioam_disable ");
3069   s = format (s, "trace disabled");
3070   s = format (s, "POT disabled");
3071   s = format (s, "Seqno disabled");
3072   s = format (s, "Analyse disabled");
3073
3074   FINISH;
3075 }
3076
3077 static void *vl_api_feature_enable_disable_t_print
3078   (vl_api_feature_enable_disable_t * mp, void *handle)
3079 {
3080   u8 *s;
3081
3082   s = format (0, "SCRIPT: feature_enable_disable ");
3083   s = format (s, "arc_name %s ", mp->arc_name);
3084   s = format (s, "feature_name %s ", mp->feature_name);
3085   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3086   if (!mp->enable)
3087     s = format (s, "disable");
3088
3089   FINISH;
3090 }
3091
3092 static void *vl_api_sw_interface_tag_add_del_t_print
3093   (vl_api_sw_interface_tag_add_del_t * mp, void *handle)
3094 {
3095   u8 *s;
3096
3097   s = format (0, "SCRIPT: sw_interface_tag_add_del ");
3098   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3099   if (mp->is_add)
3100     s = format (s, "tag %s ", mp->tag);
3101   else
3102     s = format (s, "del ");
3103
3104   FINISH;
3105 }
3106
3107 static void *vl_api_sw_interface_set_mtu_t_print
3108   (vl_api_sw_interface_set_mtu_t * mp, void *handle)
3109 {
3110   u8 *s;
3111
3112   s = format (0, "SCRIPT: sw_interface_set_mtu ");
3113   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3114   s = format (s, "tag %d ", ntohs (mp->mtu));
3115
3116   FINISH;
3117 }
3118
3119 static void *vl_api_p2p_ethernet_add_t_print
3120   (vl_api_p2p_ethernet_add_t * mp, void *handle)
3121 {
3122   u8 *s;
3123
3124   s = format (0, "SCRIPT: p2p_ethernet_add ");
3125   s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
3126   s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
3127
3128   FINISH;
3129 }
3130
3131 static void *vl_api_p2p_ethernet_del_t_print
3132   (vl_api_p2p_ethernet_del_t * mp, void *handle)
3133 {
3134   u8 *s;
3135
3136   s = format (0, "SCRIPT: p2p_ethernet_del ");
3137   s = format (s, "sw_if_index %d ", ntohl (mp->parent_if_index));
3138   s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
3139
3140   FINISH;
3141 }
3142
3143 static void *vl_api_tcp_configure_src_addresses_t_print
3144   (vl_api_tcp_configure_src_addresses_t * mp, void *handle)
3145 {
3146   u8 *s;
3147
3148   s = format (0, "SCRIPT: tcp_configure_src_addresses ");
3149   if (mp->is_ipv6)
3150     s = format (s, "%U - %U ",
3151                 format_ip6_address, (ip6_address_t *) mp->first_address,
3152                 format_ip6_address, (ip6_address_t *) mp->last_address);
3153   else
3154     s = format (s, "%U - %U ",
3155                 format_ip4_address, (ip4_address_t *) mp->first_address,
3156                 format_ip4_address, (ip4_address_t *) mp->last_address);
3157
3158   if (mp->vrf_id)
3159     s = format (s, "vrf %d ", ntohl (mp->vrf_id));
3160
3161   FINISH;
3162 }
3163
3164 static void *vl_api_app_namespace_add_del_t_print
3165   (vl_api_app_namespace_add_del_t * mp, void *handle)
3166 {
3167   u8 *s, *ns_id = 0;
3168   u8 len = clib_min (mp->namespace_id_len,
3169                      ARRAY_LEN (mp->namespace_id) - 1);
3170   mp->namespace_id[len] = 0;
3171   s = format (0, "SCRIPT: app_namespace_add_del ");
3172   s = format (s, "ns-id %s secret %lu sw_if_index %d ipv4_fib_id %d "
3173               "ipv6_fib_id %d", (char *) mp->namespace_id, mp->secret,
3174               clib_net_to_host_u32 (mp->sw_if_index),
3175               clib_net_to_host_u32 (mp->ip4_fib_id),
3176               clib_net_to_host_u32 (mp->ip6_fib_id));
3177   FINISH;
3178 }
3179
3180 static void *vl_api_lldp_config_t_print
3181   (vl_api_lldp_config_t * mp, void *handle)
3182 {
3183   u8 *s;
3184
3185   s = format (0, "SCRIPT: lldp_config ");
3186   s = format (s, "system_name %s ", mp->system_name);
3187   s = format (s, "tx_hold %d ", ntohl (mp->tx_hold));
3188   s = format (s, "tx_interval %d ", ntohl (mp->tx_interval));
3189   FINISH;
3190 }
3191
3192 static void *vl_api_dns_enable_disable_t_print
3193   (vl_api_dns_enable_disable_t * mp, void *handle)
3194 {
3195   u8 *s;
3196
3197   s = format (0, "SCRIPT: dns_enable_disable ");
3198   s = format (s, "%s ", mp->enable ? "enable" : "disable");
3199
3200   FINISH;
3201 }
3202
3203 static void *vl_api_sw_interface_set_lldp_t_print
3204   (vl_api_sw_interface_set_lldp_t * mp, void *handle)
3205 {
3206   u8 *s;
3207   u8 null_data[256];
3208
3209   memset (null_data, 0, sizeof (null_data));
3210
3211   s = format (0, "SCRIPT: sw_interface_set_lldp ");
3212   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
3213
3214   if (memcmp (mp->port_desc, null_data, sizeof (mp->port_desc)))
3215     s = format (s, "port_desc %s ", mp->port_desc);
3216
3217   if (memcmp (mp->mgmt_ip4, null_data, sizeof (mp->mgmt_ip4)))
3218     s = format (s, "mgmt_ip4 %U ", format_ip4_address, mp->mgmt_ip4);
3219
3220   if (memcmp (mp->mgmt_ip6, null_data, sizeof (mp->mgmt_ip6)))
3221     s = format (s, "mgmt_ip6 %U ", format_ip6_address, mp->mgmt_ip6);
3222
3223   if (memcmp (mp->mgmt_oid, null_data, sizeof (mp->mgmt_oid)))
3224     s = format (s, "mgmt_oid %s ", mp->mgmt_oid);
3225
3226   if (mp->enable == 0)
3227     s = format (s, "disable ");
3228
3229   FINISH;
3230 }
3231
3232 static void *vl_api_dns_name_server_add_del_t_print
3233   (vl_api_dns_name_server_add_del_t * mp, void *handle)
3234 {
3235   u8 *s;
3236
3237   s = format (0, "SCRIPT: dns_name_server_add_del ");
3238   if (mp->is_ip6)
3239     s = format (s, "%U ", format_ip6_address,
3240                 (ip6_address_t *) mp->server_address);
3241   else
3242     s = format (s, "%U ", format_ip4_address,
3243                 (ip4_address_t *) mp->server_address);
3244
3245   if (mp->is_add == 0)
3246     s = format (s, "del ");
3247
3248   FINISH;
3249 }
3250
3251 static void *vl_api_dns_resolve_name_t_print
3252   (vl_api_dns_resolve_name_t * mp, void *handle)
3253 {
3254   u8 *s;
3255
3256   s = format (0, "SCRIPT: dns_resolve_name ");
3257   s = format (s, "%s ", mp->name);
3258   FINISH;
3259 }
3260
3261 static void *vl_api_dns_resolve_ip_t_print
3262   (vl_api_dns_resolve_ip_t * mp, void *handle)
3263 {
3264   u8 *s;
3265
3266   s = format (0, "SCRIPT: dns_resolve_ip ");
3267   if (mp->is_ip6)
3268     s = format (s, "%U ", format_ip6_address, mp->address);
3269   else
3270     s = format (s, "%U ", format_ip4_address, mp->address);
3271   FINISH;
3272 }
3273
3274 static void *vl_api_session_rule_add_del_t_print
3275   (vl_api_session_rule_add_del_t * mp, void *handle)
3276 {
3277   u8 *s;
3278   char *proto = mp->transport_proto == 0 ? "tcp" : "udp";
3279   s = format (0, "SCRIPT: session_rule_add_del ");
3280   mp->tag[sizeof (mp->tag) - 1] = 0;
3281   if (mp->is_ip4)
3282     s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s",
3283                 mp->appns_index, mp->scope, proto, format_ip4_address,
3284                 (ip4_address_t *) mp->lcl_ip, mp->lcl_plen,
3285                 format_ip4_address, (ip4_address_t *) mp->rmt_ip,
3286                 mp->rmt_plen, mp->action_index, mp->tag);
3287   else
3288     s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s",
3289                 mp->appns_index, mp->scope, proto, format_ip6_address,
3290                 (ip6_address_t *) mp->lcl_ip, mp->lcl_plen,
3291                 format_ip6_address, (ip6_address_t *) mp->rmt_ip,
3292                 mp->rmt_plen, mp->action_index, mp->tag);
3293   FINISH;
3294 }
3295
3296 static void *vl_api_ip_container_proxy_add_del_t_print
3297   (vl_api_ip_container_proxy_add_del_t * mp, void *handle)
3298 {
3299   u8 *s;
3300   s = format (0, "SCRIPT: ip_container_proxy_add_del ");
3301   if (mp->is_ip4)
3302     s = format (s, "is_add %d address %U/%d sw_if_index %d",
3303                 mp->is_add, format_ip4_address,
3304                 (ip4_address_t *) mp->ip, mp->plen, mp->sw_if_index);
3305   else
3306     s = format (s, "is_add %d address %U/%d sw_if_index %d",
3307                 mp->is_add, format_ip6_address,
3308                 (ip6_address_t *) mp->ip, mp->plen, mp->sw_if_index);
3309   FINISH;
3310 }
3311
3312
3313 #define foreach_custom_print_no_arg_function                            \
3314 _(lisp_eid_table_vni_dump)                                              \
3315 _(lisp_map_resolver_dump)                                               \
3316 _(lisp_map_server_dump)                                                 \
3317 _(show_lisp_rloc_probe_state)                                           \
3318 _(show_lisp_map_register_state)                                         \
3319 _(show_lisp_map_request_mode)
3320
3321 #define _(f)                                                            \
3322 static void * vl_api_ ## f ## _t_print                                  \
3323   (vl_api_ ## f ## _t * mp, void * handle)                              \
3324 {                                                                       \
3325   u8 * s;                                                               \
3326   s = format (0, "SCRIPT: " #f );                                       \
3327   FINISH;                                                               \
3328 }
3329 foreach_custom_print_no_arg_function
3330 #undef _
3331 #define foreach_custom_print_function                                   \
3332 _(CREATE_LOOPBACK, create_loopback)                                     \
3333 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance)                   \
3334 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags)                       \
3335 _(SW_INTERFACE_EVENT, sw_interface_event)                               \
3336 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address)           \
3337 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table)                       \
3338 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable)           \
3339 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath)                       \
3340 _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass)         \
3341 _(SW_INTERFACE_SET_GENEVE_BYPASS, sw_interface_set_geneve_bypass)       \
3342 _(TAP_CONNECT, tap_connect)                                             \
3343 _(TAP_MODIFY, tap_modify)                                               \
3344 _(TAP_DELETE, tap_delete)                                               \
3345 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump)                         \
3346 _(TAP_CREATE_V2, tap_create_v2)                                         \
3347 _(TAP_DELETE_V2, tap_delete_v2)                                         \
3348 _(SW_INTERFACE_TAP_V2_DUMP, sw_interface_tap_v2_dump)                   \
3349 _(IP_ADD_DEL_ROUTE, ip_add_del_route)                                   \
3350 _(PROXY_ARP_ADD_DEL, proxy_arp_add_del)                                 \
3351 _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable)       \
3352 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del)                             \
3353 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered)             \
3354 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del)                             \
3355 _(CREATE_VLAN_SUBIF, create_vlan_subif)                                 \
3356 _(CREATE_SUBIF, create_subif)                                           \
3357 _(OAM_ADD_DEL, oam_add_del)                                             \
3358 _(RESET_FIB, reset_fib)                                                 \
3359 _(DHCP_PROXY_CONFIG, dhcp_proxy_config)                                 \
3360 _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss)                               \
3361 _(SET_IP_FLOW_HASH, set_ip_flow_hash)                                   \
3362 _(SW_INTERFACE_IP6_SET_LINK_LOCAL_ADDRESS,                              \
3363   sw_interface_ip6_set_link_local_address)                              \
3364 _(SW_INTERFACE_IP6ND_RA_PREFIX, sw_interface_ip6nd_ra_prefix)           \
3365 _(SW_INTERFACE_IP6ND_RA_CONFIG, sw_interface_ip6nd_ra_config)           \
3366 _(SET_ARP_NEIGHBOR_LIMIT, set_arp_neighbor_limit)                       \
3367 _(L2_PATCH_ADD_DEL, l2_patch_add_del)                                   \
3368 _(SR_LOCALSID_ADD_DEL, sr_localsid_add_del)                             \
3369 _(SR_STEERING_ADD_DEL, sr_steering_add_del)                             \
3370 _(SR_POLICY_ADD, sr_policy_add)                                         \
3371 _(SR_POLICY_MOD, sr_policy_mod)                                         \
3372 _(SR_POLICY_DEL, sr_policy_del)                                         \
3373 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect)           \
3374 _(L2FIB_ADD_DEL, l2fib_add_del)                                         \
3375 _(L2FIB_FLUSH_ALL, l2fib_flush_all)                                     \
3376 _(L2FIB_FLUSH_BD, l2fib_flush_bd)                                       \
3377 _(L2FIB_FLUSH_INT, l2fib_flush_int)                                     \
3378 _(L2_FLAGS, l2_flags)                                                   \
3379 _(BRIDGE_FLAGS, bridge_flags)                                           \
3380 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table)                       \
3381 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session)                   \
3382 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge)               \
3383 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del)                         \
3384 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump)                               \
3385 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age)                 \
3386 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table)     \
3387 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables)   \
3388 _(ADD_NODE_NEXT, add_node_next)                                         \
3389 _(DHCP_CLIENT_CONFIG, dhcp_client_config)                               \
3390 _(L2TPV3_CREATE_TUNNEL, l2tpv3_create_tunnel)                           \
3391 _(L2TPV3_SET_TUNNEL_COOKIES, l2tpv3_set_tunnel_cookies)                 \
3392 _(L2TPV3_INTERFACE_ENABLE_DISABLE, l2tpv3_interface_enable_disable)     \
3393 _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key)                         \
3394 _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump)                   \
3395 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel)                           \
3396 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump)                                 \
3397 _(GENEVE_ADD_DEL_TUNNEL, geneve_add_del_tunnel)                         \
3398 _(GENEVE_TUNNEL_DUMP, geneve_tunnel_dump)                               \
3399 _(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel)                               \
3400 _(GRE_TUNNEL_DUMP, gre_tunnel_dump)                                     \
3401 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table)                               \
3402 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter)                     \
3403 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite)         \
3404 _(CREATE_VHOST_USER_IF, create_vhost_user_if)                           \
3405 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if)                           \
3406 _(DELETE_VHOST_USER_IF, delete_vhost_user_if)                           \
3407 _(SW_INTERFACE_DUMP, sw_interface_dump)                                 \
3408 _(CONTROL_PING, control_ping)                                           \
3409 _(WANT_INTERFACE_EVENTS, want_interface_events)                         \
3410 _(CLI, cli)                                                             \
3411 _(CLI_INBAND, cli_inband)                                               \
3412 _(MEMCLNT_CREATE, memclnt_create)                                       \
3413 _(SOCKCLNT_CREATE, sockclnt_create)                                     \
3414 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump)           \
3415 _(SHOW_VERSION, show_version)                                           \
3416 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump)                                 \
3417 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel)                   \
3418 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump)                         \
3419 _(INTERFACE_NAME_RENUMBER, interface_name_renumber)                     \
3420 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events)                             \
3421 _(WANT_IP6_ND_EVENTS, want_ip6_nd_events)                               \
3422 _(WANT_L2_MACS_EVENTS, want_l2_macs_events)                             \
3423 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface)                     \
3424 _(IP_ADDRESS_DUMP, ip_address_dump)                                     \
3425 _(IP_DUMP, ip_dump)                                                     \
3426 _(DELETE_LOOPBACK, delete_loopback)                                     \
3427 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del)                                 \
3428 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable)           \
3429 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable)           \
3430 _(AF_PACKET_CREATE, af_packet_create)                                   \
3431 _(AF_PACKET_DELETE, af_packet_delete)                                   \
3432 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats)                   \
3433 _(MPLS_FIB_DUMP, mpls_fib_dump)                                         \
3434 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump)                                   \
3435 _(CLASSIFY_TABLE_IDS,classify_table_ids)                                \
3436 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface)             \
3437 _(CLASSIFY_TABLE_INFO,classify_table_info)                              \
3438 _(CLASSIFY_SESSION_DUMP,classify_session_dump)                          \
3439 _(SET_IPFIX_EXPORTER, set_ipfix_exporter)                               \
3440 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump)                             \
3441 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream)                 \
3442 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump)               \
3443 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del)           \
3444 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump)                 \
3445 _(SW_INTERFACE_SPAN_ENABLE_DISABLE, sw_interface_span_enable_disable)   \
3446 _(SW_INTERFACE_SPAN_DUMP, sw_interface_span_dump)                       \
3447 _(GET_NEXT_INDEX, get_next_index)                                       \
3448 _(PG_CREATE_INTERFACE,pg_create_interface)                              \
3449 _(PG_CAPTURE, pg_capture)                                               \
3450 _(PG_ENABLE_DISABLE, pg_enable_disable)                                 \
3451 _(POLICER_ADD_DEL, policer_add_del)                                     \
3452 _(POLICER_DUMP, policer_dump)                                           \
3453 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface)       \
3454 _(POLICER_CLASSIFY_DUMP, policer_classify_dump)                         \
3455 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL,                               \
3456   ip_source_and_port_range_check_add_del)                               \
3457 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL,                     \
3458   ip_source_and_port_range_check_interface_add_del)                     \
3459 _(LISP_ENABLE_DISABLE, lisp_enable_disable)                             \
3460 _(GPE_ENABLE_DISABLE, gpe_enable_disable)                               \
3461 _(GPE_ADD_DEL_IFACE, gpe_add_del_iface)                                 \
3462 _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set)                 \
3463 _(LISP_MAP_REQUEST_MODE, lisp_map_request_mode)                         \
3464 _(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode)               \
3465 _(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping)             \
3466 _(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency)                       \
3467 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS,                                   \
3468   lisp_add_del_map_request_itr_rlocs)                                   \
3469 _(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map)               \
3470 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid)                       \
3471 _(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry)                         \
3472 _(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set)                   \
3473 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver)                 \
3474 _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator)                           \
3475 _(LISP_EID_TABLE_DUMP, lisp_eid_table_dump)                             \
3476 _(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump)                     \
3477 _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump)                     \
3478 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump)                       \
3479 _(LISP_MAP_SERVER_DUMP, lisp_map_server_dump)                           \
3480 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump)                         \
3481 _(LISP_LOCATOR_DUMP, lisp_locator_dump)                                 \
3482 _(LISP_ADJACENCIES_GET, lisp_adjacencies_get)                           \
3483 _(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state)               \
3484 _(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state)           \
3485 _(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable)       \
3486 _(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable)   \
3487 _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel)                   \
3488 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump)                         \
3489 _(DELETE_SUBIF, delete_subif)                                           \
3490 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite)           \
3491 _(PUNT, punt)                                                           \
3492 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface)             \
3493 _(FLOW_CLASSIFY_DUMP, flow_classify_dump)                               \
3494 _(GET_FIRST_MSG_ID, get_first_msg_id)                                   \
3495 _(IOAM_ENABLE, ioam_enable)                                             \
3496 _(IOAM_DISABLE, ioam_disable)                                           \
3497 _(IP_FIB_DUMP, ip_fib_dump)                                             \
3498 _(IP6_FIB_DUMP, ip6_fib_dump)                                           \
3499 _(FEATURE_ENABLE_DISABLE, feature_enable_disable)                       \
3500 _(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del)                   \
3501 _(SW_INTERFACE_SET_MTU, sw_interface_set_mtu)                           \
3502 _(P2P_ETHERNET_ADD, p2p_ethernet_add)                                   \
3503 _(P2P_ETHERNET_DEL, p2p_ethernet_del)                                   \
3504 _(TCP_CONFIGURE_SRC_ADDRESSES, tcp_configure_src_addresses)             \
3505 _(APP_NAMESPACE_ADD_DEL, app_namespace_add_del)                         \
3506 _(LLDP_CONFIG, lldp_config)                                             \
3507 _(SW_INTERFACE_SET_LLDP, sw_interface_set_lldp)                         \
3508 _(DNS_ENABLE_DISABLE, dns_enable_disable)                               \
3509 _(DNS_NAME_SERVER_ADD_DEL, dns_name_server_add_del)                     \
3510 _(DNS_RESOLVE_NAME, dns_resolve_name)                                   \
3511 _(DNS_RESOLVE_IP, dns_resolve_ip)                                       \
3512 _(SESSION_RULE_ADD_DEL, session_rule_add_del)                           \
3513 _(OUTPUT_ACL_SET_INTERFACE, output_acl_set_interface)
3514   void
3515 vl_msg_api_custom_dump_configure (api_main_t * am)
3516 {
3517 #define _(n,f) am->msg_print_handlers[VL_API_##n]       \
3518     = (void *) vl_api_##f##_t_print;
3519   foreach_custom_print_function;
3520 #undef _
3521 }
3522
3523 /*
3524  * fd.io coding-style-patch-verification: ON
3525  *
3526  * Local Variables: eval: (c-set-style "gnu") End:
3527  */