X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp%2Fapi%2Fcustom_dump.c;h=62f3c5f4af5f70edce800ccc039ad92093718d13;hb=7866c45;hp=ecb0ab172f75e7aeb202f3e526174433526035b5;hpb=b598f1d3d7d4ace9a29c01d93a8d1ba616a91e15;p=vpp.git diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c index ecb0ab172f7..62f3c5f4af5 100644 --- a/src/vpp/api/custom_dump.c +++ b/src/vpp/api/custom_dump.c @@ -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 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -382,7 +383,7 @@ static void *vl_api_l2fib_add_del_t_print s = format (0, "SCRIPT: l2fib_add_del "); - s = format (s, "mac %U ", format_ethernet_address, &mp->mac); + s = format (s, "mac %U ", format_ethernet_address, mp->mac); s = format (s, "bd_id %d ", ntohl (mp->bd_id)); @@ -547,6 +548,65 @@ static void *vl_api_sw_interface_tap_dump_t_print FINISH; } +static void *vl_api_tap_create_v2_t_print + (vl_api_tap_create_v2_t * mp, void *handle) +{ + u8 *s; + u8 null_mac[6]; + + memset (null_mac, 0, sizeof (null_mac)); + + s = format (0, "SCRIPT: tap_create_v2 "); + s = format (s, "id %s ", mp->id); + if (memcmp (mp->mac_address, null_mac, 6)) + s = format (s, "mac-address %U ", + format_ethernet_address, mp->mac_address); + if (memcmp (mp->host_mac_addr, null_mac, 6)) + s = format (s, "host-mac-addr %U ", + format_ethernet_address, mp->host_mac_addr); + if (mp->host_if_name_set) + s = format (s, "host-if-name %s ", mp->host_if_name); + if (mp->host_namespace_set) + s = format (s, "host-ns %s ", mp->host_namespace); + if (mp->host_bridge_set) + s = format (s, "host-bridge %s ", mp->host_bridge); + if (mp->host_ip4_addr_set) + s = format (s, "host-ip4-addr %U/%d ", format_ip4_address, + mp->host_ip4_addr, mp->host_ip4_prefix_len); + 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) + s = format (s, "rx-ring-size %d ", mp->rx_ring_sz); + FINISH; +} + +static void *vl_api_tap_delete_v2_t_print + (vl_api_tap_delete_v2_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: tap_delete_v2 "); + s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); + + FINISH; +} + +static void *vl_api_sw_interface_tap_v2_dump_t_print + (vl_api_sw_interface_tap_v2_dump_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: sw_interface_tap_v2_dump "); + + FINISH; +} static void *vl_api_ip_add_del_route_t_print (vl_api_ip_add_del_route_t * mp, void *handle) @@ -586,9 +646,6 @@ static void *vl_api_ip_add_del_route_t_print if (mp->next_hop_weight != 1) s = format (s, "weight %d ", mp->next_hop_weight); - if (mp->not_last) - s = format (s, "not-last "); - if (mp->is_multipath) s = format (s, "multipath "); @@ -711,22 +768,6 @@ static void *vl_api_ip_neighbor_add_del_t_print FINISH; } -static void * -vl_api_reset_vrf_t_print (vl_api_reset_vrf_t * mp, void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: reset_vrf "); - - if (mp->vrf_id) - s = format (s, "vrf %d ", ntohl (mp->vrf_id)); - - if (mp->is_ipv6 != 0) - s = format (s, "ipv6 "); - - FINISH; -} - static void *vl_api_create_vlan_subif_t_print (vl_api_create_vlan_subif_t * mp, void *handle) { @@ -863,9 +904,13 @@ static void *vl_api_dhcp_proxy_set_vss_t_print s = format (s, "tbl_id %d ", ntohl (mp->tbl_id)); - s = format (s, "fib_id %d ", ntohl (mp->fib_id)); - - s = format (s, "oui %d ", ntohl (mp->oui)); + if (mp->vss_type == VSS_TYPE_VPN_ID) + { + s = format (s, "fib_id %d ", ntohl (mp->vpn_index)); + s = format (s, "oui %d ", ntohl (mp->oui)); + } + else if (mp->vss_type == VSS_TYPE_ASCII) + s = format (s, "vpn_ascii_id %s", mp->vpn_ascii_id); if (mp->is_ipv6 != 0) s = format (s, "ipv6 "); @@ -2024,7 +2069,6 @@ format_policer_action (u8 * s, va_list * va) } s = format (s, "%s", t); } - return s; } @@ -2570,7 +2614,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) @@ -2793,7 +2836,6 @@ static void *vl_api_lisp_eid_table_dump_t_print break; } } - FINISH; } @@ -2906,7 +2948,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; } @@ -3102,6 +3143,155 @@ static void *vl_api_tcp_configure_src_addresses_t_print FINISH; } +static void *vl_api_app_namespace_add_del_t_print + (vl_api_app_namespace_add_del_t * mp, void *handle) +{ + u8 *s, *ns_id = 0; + u8 len = clib_min (mp->namespace_id_len, + ARRAY_LEN (mp->namespace_id) - 1); + mp->namespace_id[len] = 0; + s = format (0, "SCRIPT: app_namespace_add_del "); + s = format (s, "ns-id %s secret %lu sw_if_index %d ipv4_fib_id %d " + "ipv6_fib_id %d", (char *) mp->namespace_id, mp->secret, + clib_net_to_host_u32 (mp->sw_if_index), + clib_net_to_host_u32 (mp->ip4_fib_id), + clib_net_to_host_u32 (mp->ip6_fib_id)); + FINISH; +} + +static void *vl_api_lldp_config_t_print + (vl_api_lldp_config_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: lldp_config "); + s = format (s, "system_name %s ", mp->system_name); + s = format (s, "tx_hold %d ", ntohl (mp->tx_hold)); + s = format (s, "tx_interval %d ", ntohl (mp->tx_interval)); + FINISH; +} + +static void *vl_api_dns_enable_disable_t_print + (vl_api_dns_enable_disable_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: dns_enable_disable "); + s = format (s, "%s ", mp->enable ? "enable" : "disable"); + + FINISH; +} + +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[256]; + + memset (null_data, 0, sizeof (null_data)); + + s = format (0, "SCRIPT: sw_interface_set_lldp "); + s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index)); + + if (memcmp (mp->port_desc, null_data, sizeof (mp->port_desc))) + s = format (s, "port_desc %s ", mp->port_desc); + + if (memcmp (mp->mgmt_ip4, null_data, sizeof (mp->mgmt_ip4))) + s = format (s, "mgmt_ip4 %U ", format_ip4_address, mp->mgmt_ip4); + + if (memcmp (mp->mgmt_ip6, null_data, sizeof (mp->mgmt_ip6))) + s = format (s, "mgmt_ip6 %U ", format_ip6_address, mp->mgmt_ip6); + + if (memcmp (mp->mgmt_oid, null_data, sizeof (mp->mgmt_oid))) + s = format (s, "mgmt_oid %s ", mp->mgmt_oid); + + if (mp->enable == 0) + s = format (s, "disable "); + + FINISH; +} + +static void *vl_api_dns_name_server_add_del_t_print + (vl_api_dns_name_server_add_del_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: dns_name_server_add_del "); + if (mp->is_ip6) + s = format (s, "%U ", format_ip6_address, + (ip6_address_t *) mp->server_address); + else + s = format (s, "%U ", format_ip4_address, + (ip4_address_t *) mp->server_address); + + if (mp->is_add == 0) + s = format (s, "del "); + + FINISH; +} + +static void *vl_api_dns_resolve_name_t_print + (vl_api_dns_resolve_name_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: dns_resolve_name "); + s = format (s, "%s ", mp->name); + FINISH; +} + +static void *vl_api_dns_resolve_ip_t_print + (vl_api_dns_resolve_ip_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: dns_resolve_ip "); + if (mp->is_ip6) + s = format (s, "%U ", format_ip6_address, mp->address); + else + s = format (s, "%U ", format_ip4_address, mp->address); + FINISH; +} + +static void *vl_api_session_rule_add_del_t_print + (vl_api_session_rule_add_del_t * mp, void *handle) +{ + u8 *s; + char *proto = mp->transport_proto == 0 ? "tcp" : "udp"; + s = format (0, "SCRIPT: session_rule_add_del "); + mp->tag[sizeof (mp->tag) - 1] = 0; + if (mp->is_ip4) + s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s", + mp->appns_index, mp->scope, proto, format_ip4_address, + (ip4_address_t *) mp->lcl_ip, mp->lcl_plen, + format_ip4_address, (ip4_address_t *) mp->rmt_ip, + mp->rmt_plen, mp->action_index, mp->tag); + else + s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s", + mp->appns_index, mp->scope, proto, format_ip6_address, + (ip6_address_t *) mp->lcl_ip, mp->lcl_plen, + format_ip6_address, (ip6_address_t *) mp->rmt_ip, + mp->rmt_plen, mp->action_index, mp->tag); + FINISH; +} + +static void *vl_api_ip_container_proxy_add_del_t_print + (vl_api_ip_container_proxy_add_del_t * mp, void *handle) +{ + u8 *s; + s = format (0, "SCRIPT: ip_container_proxy_add_del "); + if (mp->is_ip4) + s = format (s, "is_add %d address %U/%d sw_if_index %d", + mp->is_add, format_ip4_address, + (ip4_address_t *) mp->ip, mp->plen, mp->sw_if_index); + else + s = format (s, "is_add %d address %U/%d sw_if_index %d", + mp->is_add, format_ip6_address, + (ip6_address_t *) mp->ip, mp->plen, mp->sw_if_index); + FINISH; +} + + #define foreach_custom_print_no_arg_function \ _(lisp_eid_table_vni_dump) \ _(lisp_map_resolver_dump) \ @@ -3135,13 +3325,15 @@ _(TAP_CONNECT, tap_connect) \ _(TAP_MODIFY, tap_modify) \ _(TAP_DELETE, tap_delete) \ _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump) \ +_(TAP_CREATE_V2, tap_create_v2) \ +_(TAP_DELETE_V2, tap_delete_v2) \ +_(SW_INTERFACE_TAP_V2_DUMP, sw_interface_tap_v2_dump) \ _(IP_ADD_DEL_ROUTE, ip_add_del_route) \ _(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \ _(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \ _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del) \ _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered) \ _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del) \ -_(RESET_VRF, reset_vrf) \ _(CREATE_VLAN_SUBIF, create_vlan_subif) \ _(CREATE_SUBIF, create_subif) \ _(OAM_ADD_DEL, oam_add_del) \ @@ -3291,7 +3483,15 @@ _(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del) \ _(SW_INTERFACE_SET_MTU, sw_interface_set_mtu) \ _(P2P_ETHERNET_ADD, p2p_ethernet_add) \ _(P2P_ETHERNET_DEL, p2p_ethernet_del) \ -_(TCP_CONFIGURE_SRC_ADDRESSES, tcp_configure_src_addresses) +_(TCP_CONFIGURE_SRC_ADDRESSES, tcp_configure_src_addresses) \ +_(APP_NAMESPACE_ADD_DEL, app_namespace_add_del) \ +_(LLDP_CONFIG, lldp_config) \ +_(SW_INTERFACE_SET_LLDP, sw_interface_set_lldp) \ +_(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) void vl_msg_api_custom_dump_configure (api_main_t * am) { @@ -3304,7 +3504,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: */