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