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