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