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