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