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