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