tapv2: CLI and binary API fixes
[vpp.git] / src / vpp / api / custom_dump.c
index c26d65a..28f16d2 100644 (file)
@@ -1,20 +1,20 @@
 /*
- *------------------------------------------------------------------
+ * ------------------------------------------------------------------
  * custom_dump.c - pretty-print API messages for replay
  *
- * Copyright (c) 2014-2016 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
+ * Copyright (c) 2014-2016 Cisco and/or its affiliates. Licensed under the
+ * Apache License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at:
  *
- *     http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *------------------------------------------------------------------
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ * ------------------------------------------------------------------
  */
 
 #include <vnet/vnet.h>
@@ -25,6 +25,8 @@
 #include <vnet/l2tp/l2tp.h>
 #include <vnet/l2/l2_input.h>
 #include <vnet/srv6/sr.h>
+#include <vnet/srmpls/sr_mpls.h>
+#include <vnet/gre/gre.h>
 #include <vnet/vxlan-gpe/vxlan_gpe.h>
 #include <vnet/geneve/geneve.h>
 #include <vnet/classify/policer_classify.h>
@@ -556,7 +558,7 @@ static void *vl_api_tap_create_v2_t_print
   memset (null_mac, 0, sizeof (null_mac));
 
   s = format (0, "SCRIPT: tap_create_v2 ");
-  s = format (s, "id %s ", mp->id);
+  s = format (s, "id %u ", mp->id);
   if (memcmp (mp->mac_address, null_mac, 6))
     s = format (s, "mac-address %U ",
                format_ethernet_address, mp->mac_address);
@@ -575,6 +577,10 @@ static void *vl_api_tap_create_v2_t_print
   if (mp->host_ip6_addr_set)
     s = format (s, "host-ip6-addr %U/%d ", format_ip6_address,
                mp->host_ip6_addr, mp->host_ip6_prefix_len);
+  if (mp->host_ip4_gw_set)
+    s = format (s, "host-ip4-gw %U ", format_ip4_address, mp->host_ip4_addr);
+  if (mp->host_ip6_gw_set)
+    s = format (s, "host-ip6-gw %U ", format_ip6_address, mp->host_ip6_addr);
   if (mp->tx_ring_sz)
     s = format (s, "tx-ring-size %d ", mp->tx_ring_sz);
   if (mp->rx_ring_sz)
@@ -1538,6 +1544,8 @@ static void *vl_api_vxlan_add_del_tunnel_t_print
 
   s = format (s, "vni %d ", ntohl (mp->vni));
 
+  s = format (s, "instance %d ", ntohl (mp->instance));
+
   if (mp->is_add == 0)
     s = format (s, "del ");
 
@@ -1615,9 +1623,14 @@ static void *vl_api_gre_add_del_tunnel_t_print
              (ip46_address_t *) & (mp->src_address),
              mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
 
-  if (mp->teb)
+  s = format (s, "instance %d ", ntohl (mp->instance));
+
+  if (mp->tunnel_type == GRE_TUNNEL_TYPE_TEB)
     s = format (s, "teb ");
 
+  if (mp->tunnel_type == GRE_TUNNEL_TYPE_ERSPAN)
+    s = format (s, "erspan %d ", ntohs (mp->session_id));
+
   if (mp->outer_fib_id)
     s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
 
@@ -1799,9 +1812,15 @@ static void *vl_api_cli_inband_t_print
   (vl_api_cli_inband_t * mp, void *handle)
 {
   u8 *s;
+  u8 *cmd = 0;
+  u32 length = ntohl (mp->length);
 
-  s = format (0, "SCRIPT: cli_inband ");
+  vec_validate (cmd, length);
+  clib_memcpy (cmd, mp->cmd, length);
 
+  s = format (0, "SCRIPT: exec %v ", cmd);
+
+  vec_free (cmd);
   FINISH;
 }
 
@@ -1958,6 +1977,24 @@ static void *vl_api_input_acl_set_interface_t_print
   FINISH;
 }
 
+static void *vl_api_output_acl_set_interface_t_print
+  (vl_api_output_acl_set_interface_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: output_acl_set_interface ");
+
+  s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
+  s = format (s, "ip4-table %d ", ntohl (mp->ip4_table_index));
+  s = format (s, "ip6-table %d ", ntohl (mp->ip6_table_index));
+  s = format (s, "l2-table %d ", ntohl (mp->l2_table_index));
+
+  if (mp->is_add == 0)
+    s = format (s, "del ");
+
+  FINISH;
+}
+
 static void *vl_api_ip_address_dump_t_print
   (vl_api_ip_address_dump_t * mp, void *handle)
 {
@@ -2064,7 +2101,6 @@ format_policer_action (u8 * s, va_list * va)
        }
       s = format (s, "%s", t);
     }
-
   return s;
 }
 
@@ -2610,7 +2646,6 @@ static void *vl_api_lisp_add_del_remote_mapping_t_print
       s = format (s, "seid %U ", format_lisp_flat_eid,
                  mp->eid_type, mp->seid, mp->seid_len);
     }
-
   rloc_num = clib_net_to_host_u32 (mp->rloc_num);
 
   if (0 == rloc_num)
@@ -2833,7 +2868,6 @@ static void *vl_api_lisp_eid_table_dump_t_print
          break;
        }
     }
-
   FINISH;
 }
 
@@ -2946,7 +2980,6 @@ static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
       s = format (s, "sid %d ", ntohl (mp->i_sid));
       s = format (s, "vlanid %d ", ntohs (mp->b_vlanid));
     }
-
   FINISH;
 }
 
@@ -3185,7 +3218,7 @@ static void *vl_api_sw_interface_set_lldp_t_print
   (vl_api_sw_interface_set_lldp_t * mp, void *handle)
 {
   u8 *s;
-  u8 null_data[128];
+  u8 null_data[256];
 
   memset (null_data, 0, sizeof (null_data));
 
@@ -3490,7 +3523,8 @@ _(DNS_ENABLE_DISABLE, dns_enable_disable)                               \
 _(DNS_NAME_SERVER_ADD_DEL, dns_name_server_add_del)                     \
 _(DNS_RESOLVE_NAME, dns_resolve_name)                                  \
 _(DNS_RESOLVE_IP, dns_resolve_ip)                                      \
-_(SESSION_RULE_ADD_DEL, session_rule_add_del)
+_(SESSION_RULE_ADD_DEL, session_rule_add_del)                           \
+_(OUTPUT_ACL_SET_INTERFACE, output_acl_set_interface)
   void
 vl_msg_api_custom_dump_configure (api_main_t * am)
 {
@@ -3503,7 +3537,5 @@ vl_msg_api_custom_dump_configure (api_main_t * am)
 /*
  * fd.io coding-style-patch-verification: ON
  *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
+ * Local Variables: eval: (c-set-style "gnu") End:
  */