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