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