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