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