/* * Copyright (c) 2015 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 * * 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. */ /* * interface_cli.c: interface CLI * * Copyright (c) 2008 Eliot Dresselhaus * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** * @file * @brief Interface CLI. * * Source code for several CLI interface commands. * */ #include #include #include #include #include #include #include static int compare_interface_names (void *a1, void *a2) { u32 *hi1 = a1; u32 *hi2 = a2; return vnet_hw_interface_compare (vnet_get_main (), *hi1, *hi2); } static clib_error_t * show_or_clear_hw_interfaces (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { clib_error_t *error = 0; vnet_main_t *vnm = vnet_get_main (); vnet_interface_main_t *im = &vnm->interface_main; vnet_hw_interface_t *hi; u32 hw_if_index, *hw_if_indices = 0; int i, verbose = -1, is_show, show_bond = 0; is_show = strstr (cmd->path, "show") != 0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { /* See if user wants to show a specific interface. */ if (unformat (input, "%U", unformat_vnet_hw_interface, vnm, &hw_if_index)) vec_add1 (hw_if_indices, hw_if_index); /* See if user wants to show an interface with a specific hw_if_index. */ else if (unformat (input, "%u", &hw_if_index)) vec_add1 (hw_if_indices, hw_if_index); else if (unformat (input, "verbose")) verbose = 1; /* this is also the default */ else if (unformat (input, "detail")) verbose = 2; else if (unformat (input, "brief")) verbose = 0; else if (unformat (input, "bond")) { show_bond = 1; if (verbose < 0) verbose = 0; /* default to brief for link bonding */ } else { error = clib_error_return (0, "unknown input `%U'", format_unformat_error, input); goto done; } } /* Gather interfaces. */ if (vec_len (hw_if_indices) == 0) pool_foreach (hi, im->hw_interfaces, vec_add1 (hw_if_indices, hi - im->hw_interfaces)); if (verbose < 0) verbose = 1; /* default to verbose (except bond) */ if (is_show) { /* Sort by name. */ vec_sort_with_function (hw_if_indices, compare_interface_names); vlib_cli_output (vm, "%U\n", format_vnet_hw_interface, vnm, 0, verbose); for (i = 0; i < vec_len (hw_if_indices); i++) { hi = vnet_get_hw_interface (vnm, hw_if_indices[i]); if (show_bond == 0) /* show all interfaces */ vlib_cli_output (vm, "%U\n", format_vnet_hw_interface, vnm, hi, verbose); else if ((hi->bond_info) && (hi->bond_info != VNET_HW_INTERFACE_BOND_INFO_SLAVE)) { /* show only bonded interface and all its slave interfaces */ int hw_idx; vnet_hw_interface_t *shi; vlib_cli_output (vm, "%U\n", format_vnet_hw_interface, vnm, hi, verbose); /* *INDENT-OFF* */ clib_bitmap_foreach (hw_idx, hi->bond_info, ({ shi = vnet_get_hw_interface(vnm, hw_idx); vlib_cli_output (vm, "%U\n", format_vnet_hw_interface, vnm, shi, verbose); })); /* *INDENT-ON* */ } } } else { for (i = 0; i < vec_len (hw_if_indices); i++) { vnet_device_class_t *dc; hi = vnet_get_hw_interface (vnm, hw_if_indices[i]); dc = vec_elt_at_index (im->device_classes, hi->dev_class_index); if (dc->clear_counters) dc->clear_counters (hi->dev_instance); } } done: vec_free (hw_if_indices); return error; } /*? * Display more detailed information about all or a list of given interfaces. * The verboseness of the output can be controlled by the following optional * parameters: * - brief: Only show name, index and state (default for bonded interfaces). * - verbose: Also display additional attributes (default for all other interfaces). * - detail: Also display all remaining attributes and extended statistics. * * To limit the output of the command to bonded interfaces and their slave * interfaces, use the 'bond' optional parameter. * * @cliexpar * Example of how to display default data for all interfaces: * @cliexstart{show hardware-interfaces} * Name Idx Link Hardware * GigabitEthernet7/0/0 1 up GigabitEthernet7/0/0 * Ethernet address ec:f4:bb:c0:bc:fc * Intel e1000 * carrier up full duplex speed 1000 mtu 9216 * rx queues 1, rx desc 1024, tx queues 3, tx desc 1024 * cpu socket 0 * GigabitEthernet7/0/1 2 up GigabitEthernet7/0/1 * Ethernet address ec:f4:bb:c0:bc:fd * Intel e1000 * carrier up full duplex speed 1000 mtu 9216 * rx queues 1, rx desc 1024, tx queues 3, tx desc 1024 * cpu socket 0 * VirtualEthernet0/0/0 3 up VirtualEthernet0/0/0 * Ethernet address 02:fe:a5:a9:8b:8e * VirtualEthernet0/0/1 4 up VirtualEthernet0/0/1 * Ethernet address 02:fe:c0:4e:3b:b0 * VirtualEthernet0/0/2 5 up VirtualEthernet0/0/2 * Ethernet address 02:fe:1f:73:92:81 * VirtualEthernet0/0/3 6 up VirtualEthernet0/0/3 * Ethernet address 02:fe:f2:25:c4:68 * local0 0 down local0 * local * @cliexend * Example of how to display 'verbose' data for an interface by name and * software index (where 2 is the software index): * @cliexstart{show hardware-interfaces GigabitEthernet7/0/0 2 verbose} * Name Idx Link Hardware * GigabitEthernet7/0/0 1 up GigabitEthernet7/0/0 * Ethernet address ec:f4:bb:c0:bc:fc * Intel e1000 * carrier up full duplex speed 1000 mtu 9216 * rx queues 1, rx desc 1024, tx queues 3, tx desc 1024 * cpu socket 0 * GigabitEthernet7/0/1 2 down GigabitEthernet7/0/1 * Ethernet address ec:f4:bb:c0:bc:fd * Intel e1000 * carrier up full duplex speed 1000 mtu 9216 * rx queues 1, rx desc 1024, tx queues 3, tx desc 1024 * cpu socket 0 * @cliexend ?*/ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (show_hw_interfaces_command, static) = { .path = "show hardware-interfaces", .short_help = "show hardware-interfaces [brief|verbose|detail] [bond] " "[ [ [..]]] [ [ [..]]]", .function = show_or_clear_hw_interfaces, }; /* *INDENT-ON* */ /*? * Clear the extended statistics for all or a list of given interfaces * (statistics associated with the 'show hardware-interfaces' command). * * @cliexpar * Example of how to clear the extended statistics for all interfaces: * @cliexcmd{clear hardware-interfaces} * Example of how to clear the extended statistics for an interface by * name and software index (where 2 is the software index): * @cliexcmd{clear hardware-interfaces GigabitEthernet7/0/0 2} ?*/ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (clear_hw_interface_counters_command, static) = { .path = "clear hardware-interfaces", .short_help = "clear hardware-interfaces " "[ [ [..]]] [ [ [..]]]", .function = show_or_clear_hw_interfaces, }; /* *INDENT-ON* */ static int sw_interface_name_compare (void *a1, void *a2) { vnet_sw_interface_t *si1 = a1; vnet_sw_interface_t *si2 = a2; return vnet_sw_interface_compare (vnet_get_main (), si1->sw_if_index, si2->sw_if_index); } static clib_error_t * show_sw_interfaces (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { clib_error_t *error = 0; vnet_main_t *vnm = vnet_get_main (); unformat_input_t _linput, *linput = &_linput; vnet_interface_main_t *im = &vnm->interface_main; vnet_sw_interface_t *si, *sorted_sis = 0; u32 sw_if_index = ~(u32) 0; u8 show_addresses = 0; u8 show_features = 0; u8 show_tag = 0; int verbose = 0; /* * Get a line of input. Won't work if the user typed * "show interface" and nothing more. */ if (unformat_user (input, unformat_line_input, linput)) { while (unformat_check_input (linput) != UNFORMAT_END_OF_INPUT) { /* See if user wants to show specific interface */ if (unformat (linput, "%U", unformat_vnet_sw_interface, vnm, &sw_if_index)) { si = pool_elt_at_index (im->sw_interfaces, sw_if_index); vec_add1 (sorted_sis, si[0]); } else if (unformat (linput, "address") || unformat (linput, "addr")) show_addresses = 1; else if (unformat (linput, "features") || unformat (linput, "feat")) show_features = 1; else if (unformat (linput, "tag")) show_tag = 1; else if (unformat (linput, "verbose")) verbose = 1; else { error = clib_error_return (0, "unknown input `%U'", format_unformat_error, linput); goto done; } } unformat_free (linput); } if (show_features || show_tag) { if (sw_if_index == ~(u32) 0) return clib_error_return (0, "Interface not specified..."); } if (show_features) { vnet_interface_features_show (vm, sw_if_index, verbose); l2_input_config_t *l2_input = l2input_intf_config (sw_if_index); u32 fb = l2_input->feature_bitmap; /* intf input features are masked by bridge domain */ if (l2_input->bridge) fb &= l2input_bd_config (l2_input->bd_index)->feature_bitmap; vlib_cli_output (vm, "\nl2-input:\n%U", format_l2_input_features, fb, 1); l2_output_config_t *l2_output = l2output_intf_config (sw_if_index); vlib_cli_output (vm, "\nl2-output:"); if (l2_output->out_vtr_flag) vlib_cli_output (vm, "%10s (%s)", "VTR", "--internal--"); vlib_cli_output (vm, "%U", format_l2_output_features, l2_output->feature_bitmap, 1); return 0; } if (show_tag) { u8 *tag; tag = vnet_get_sw_interface_tag (vnm, sw_if_index); vlib_cli_output (vm, "%U: %s", format_vnet_sw_if_index_name, vnm, sw_if_index, tag ? (char *) tag : "(none)"); return 0; } if (!show_addresses) vlib_cli_output (vm, "%U\n", format_vnet_sw_interface, vnm, 0); if (vec_len (sorted_sis) == 0) /* Get all interfaces */ { /* Gather interfaces. */ sorted_sis = vec_new (vnet_sw_interface_t, pool_elts (im->sw_interfaces)); _vec_len (sorted_sis) = 0; /* *INDENT-OFF* */ pool_foreach (si, im->sw_interfaces, ({ int visible = vnet_swif_is_api_visible (si); if (visible) vec_add1 (sorted_sis, si[0]);} )); /* *INDENT-ON* */ /* Sort by name. */ vec_sort_with_function (sorted_sis, sw_interface_name_compare); } if (show_addresses) { vec_foreach (si, sorted_sis) { ip4_main_t *im4 = &ip4_main; ip6_main_t *im6 = &ip6_main; ip_lookup_main_t *lm4 = &im4->lookup_main; ip_lookup_main_t *lm6 = &im6->lookup_main; ip_interface_address_t *ia = 0; u32 fib_index4 = 0, fib_index6 = 0; if (vec_len (im4->fib_index_by_sw_if_index) > si->sw_if_index) fib_index4 = vec_elt (im4->fib_index_by_sw_if_index, si->sw_if_index); if (vec_len (im6->fib_index_by_sw_if_index) > si->sw_if_index) fib_index6 = vec_elt (im6->fib_index_by_sw_if_index, si->sw_if_index); ip4_fib_t *fib4 = ip4_fib_get (fib_index4); ip6_fib_t *fib6 = ip6_fib_get (fib_index6); if (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED) vlib_cli_output (vm, "%U (%s): \n unnumbered, use %U", format_vnet_sw_if_index_name, vnm, si->sw_if_index, (si->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? "up" : "dn", format_vnet_sw_if_index_name, vnm, si->unnumbered_sw_if_index); else vlib_cli_output (vm, "%U (%s):", format_vnet_sw_if_index_name, vnm, si->sw_if_index, (si->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? "up" : "dn"); /* Display any L2 info */ l2_input_config_t *l2_input = l2input_intf_config (si->sw_if_index); if (l2_input->bridge) { bd_main_t *bdm = &bd_main; u32 bd_id = l2input_main.bd_configs[l2_input->bd_index].bd_id; vlib_cli_output (vm, " L2 bridge bd-id %d idx %d shg %d %s", bd_id, bd_find_index (bdm, bd_id), l2_input->shg, l2_input->bvi ? "bvi" : " "); } else if (l2_input->xconnect) vlib_cli_output (vm, " L2 xconnect %U", format_vnet_sw_if_index_name, vnm, l2_input->output_sw_if_index); /* *INDENT-OFF* */ /* Display any IP4 addressing info */ foreach_ip_interface_address (lm4, ia, si->sw_if_index, 1 /* honor unnumbered */, ({ ip4_address_t *r4 = ip_interface_address_get_address (lm4, ia); if (fib4->table_id) vlib_cli_output (vm, " L3 %U/%d ip4 table-id %d fib-idx %d", format_ip4_address, r4, ia->address_length, fib4->table_id, ip4_fib_index_from_table_id (fib4->table_id)); else vlib_cli_output (vm, " L3 %U/%d", format_ip4_address, r4, ia->address_length); })); /* *INDENT-ON* */ /* *INDENT-OFF* */ /* Display any IP6 addressing info */ foreach_ip_interface_address (lm6, ia, si->sw_if_index, 1 /* honor unnumbered */, ({ ip6_address_t *r6 = ip_interface_address_get_address (lm6, ia); if (fib6->table_id) vlib_cli_output (vm, " L3 %U/%d ip6 table-id %d fib-idx %d", format_ip6_address, r6, ia->address_length, fib6->table_id, ip6_fib_index_from_table_id (fib6->table_id)); else vlib_cli_output (vm, " L3 %U/%d", format_ip6_address, r6, ia->address_length); })); /* *INDENT-ON* */ } } else { vec_foreach (si, sorted_sis) { vlib_cli_output (vm, "%U\n", format_vnet_sw_interface, vnm, si); } } done: vec_free (sorted_sis); return error; } /* *INDENT-OFF* */ VLIB_CLI_COMMAND (show_sw_interfaces_command, static) = { .path = "show interface", .short_help = "show interface [address|addr|features|feat] [ [ [..]]] [verbose]", .function = show_sw_interfaces, .is_mp_safe = 1, }; /* *INDENT-ON* */ /* Root of all interface commands. */ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (vnet_cli_interface_command, static) = { .path = "interface", .short_help = "Interface commands", }; /* *INDENT-ON* */ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (vnet_cli_set_interface_command, static) = { .path = "set interface", .short_help = "Interface commands", }; /* *INDENT-ON* */ static clib_error_t * clear_interface_counters (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { vnet_main_t *vnm = vnet_get_main (); vnet_interface_main_t *im = &vnm->interface_main; vlib_simple_counter_main_t *sm; vlib_combined_counter_main_t *cm; static vnet_main_t **my_vnet_mains; int i, j, n_counters; vec_reset_length (my_vnet_mains); for (i = 0; i < vec_len (vnet_mains); i++) { if (vnet_mains[i]) vec_add1 (my_vnet_mains, vnet_mains[i]); } if (vec_len (vnet_mains) == 0) vec_add1 (my_vnet_mains, vnm); n_counters = vec_len (im->combined_sw_if_counters); for (j = 0; j < n_counters; j++) { for (i = 0; i < vec_len (my_vnet_mains); i++) { im = &my_vnet_mains[i]->interface_main; cm = im->combined_sw_if_counters + j; vlib_clear_combined_counters (cm); } } n_counters = vec_len (im->sw_if_counters); for (j = 0; j < n_counters; j++) { for (i = 0; i < vec_len (my_vnet_mains); i++) { im = &my_vnet_mains[i]->interface_main; sm = im->sw_if_counters + j; vlib_clear_simple_counters (sm); } } return 0; } /*? * Clear the statistics for all interfaces (statistics associated with the * 'show interface' command). * * @cliexpar * Example of how to clear the statistics for all interfaces: * @cliexcmd{clear interfaces} ?*/ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (clear_interface_counters_command, static) = { .path = "clear interfaces", .short_help = "clear interfaces", .function = clear_interface_counters, }; /* *INDENT-ON* */ /** * Parse subinterface names. * * The following subinterface syntax is supported. The first two are for * backwards compatability: * * * - a subinterface with the name .. The subinterface * is a single dot1q vlan with vlan id and exact-match semantics. * * - * - a set of the above subinterfaces, repeating for each id * in the range to * * In the following, exact-match semantics (i.e. the number of vlan tags on the * packet must match the number of tags in the configuration) are used only if * the keyword exact-match is present. Non-exact match is the default. * * dot1q [exact-match] * - a subinterface with the name .. The subinterface * is a single dot1q vlan with vlan id . * * dot1q any [exact-match] * - a subinterface with the name .. The subinterface * is a single dot1q vlan with any vlan id. * * dot1q inner-dot1q [exact-match] * - a subinterface with the name .. The subinterface * is a double dot1q vlan with outer vlan id and inner vlan id * . * * dot1q inner-dot1q any [exact-match] * - a subinterface with the name .. The subinterface * is a double dot1q vlan with outer vlan id and any inner vlan id. * * dot1q any inner-dot1q any [exact-match] * * - a subinterface with the name .. The subinterface * is a double dot1q vlan with any outer vlan id and any inner vlan id. * * For each of the above CLI, there is a duplicate that uses the keyword * "dot1ad" in place of the first "dot1q". These interfaces use ethertype * 0x88ad in place of 0x8100 for the outer ethertype. Note that for double- * tagged packets the inner ethertype is always 0x8100. Also note that * the dot1q and dot1ad naming spaces are independent, so it is legal to * have both "Gig3/0/0.1 dot1q 100" and "Gig3/0/0.2 dot1ad 100". For example: * * dot1ad inner-dot1q
---
metadata:
  version: 0.1
  schema:
    - resources/topology_schemas/3_node_topology.sch.yaml
    - resources/topology_schemas/topology.sch.yaml
  tags: [hw, 3-node]

nodes:
  TG:
    type: TG
    subtype: TREX
    host: "10.30.51.20"
    port: 22
    username: testuser
    password: Csit1234
    interfaces:
      port1:
        # t2-tg1-c1/p1 - 40GE port1 on Intel NIC xl710 2p40GE.
        mac_address: "68:05:ca:35:76:a8"
        pci_address: "0000:02:00.0"
        ip4_address: "172.16.10.2"
        driver: i40e
        link: link1
        model: Intel-XL710
      port2:
        # t2-tg1-c1/p2 - 40GE port2 on Intel NIC xl710 2p40GE.
        mac_address: "68:05:ca:35:76:a9"
        pci_address: "0000:02:00.1"
        ip4_address: "172.16.20.2"
        driver: i40e
        link: link2
        model: Intel-XL710
      port3:
        # t2-tg1-c2/p1 - 10GE port1 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ed:5c"
        pci_address: "0000:05:00.0"
        ip4_address: "172.16.30.2"
        driver: i40e
        link: link3
        model: Intel-X710
      port4:
        # t2-tg1-c2/p2 - 10GE port2 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ed:5d"
        pci_address: "0000:05:00.1"
        ip4_address: "172.16.40.2"
        driver: i40e
        link: link4
        model: Intel-X710
      port5:
        # t2-tg1-c3/p1 - 10GE port1 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ee:5c"
        pci_address: "0000:07:00.0"
        ip4_address: "172.16.50.2"
        driver: i40e
        link: link5
        model: Intel-X710
      port6:
        # t2-tg1-c3/p2 - 10GE port2 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ee:5d"
        pci_address: "0000:07:00.1"
        ip4_address: "172.16.60.2"
        driver: i40e
        link: link6
        model: Intel-X710
      port7:
        # t2-tg1-c4/p1 - 40GE port1 on Intel NIC xl710 2p40GE.
        mac_address: "68:05:ca:37:1f:1c"
        pci_address: "0000:86:00.0"
        ip4_address: "172.16.70.2"
        driver: i40e
        link: link7
        model: Intel-XL710
      port8:
        # t2-tg1-c4/p2 - 40GE port2 on Intel NIC xl710 2p40GE.
        mac_address: "68:05:ca:37:1f:19"
        pci_address: "0000:86:00.1"
        ip4_address: "172.16.80.2"
        driver: i40e
        link: link8
        model: Intel-XL710
      port9:
        # t2-tg1-c5/p1 - 10GE port1 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ed:7c"
        pci_address: "0000:88:00.0"
        ip4_address: "172.16.90.2"
        driver: i40e
        link: link9
        model: Intel-X710
      port10:
        # t2-tg1-c5/p2 - 10GE port2 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ed:7d"
        pci_address: "0000:88:00.1"
        ip4_address: "172.16.100.2"
        driver: i40e
        link: link10
        model: Intel-X710
      port11:
        # t2-tg1-c6/p1 - 10GE port1 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ee:58"
        pci_address: "0000:84:00.0"
        ip4_address: "172.16.110.1"
        driver: i40e
        link: link11
        model: Intel-X710
      port12:
        # t2-tg1-c6/p2 - 10GE port2 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ee:59"
        pci_address: "0000:84:00.1"
        ip4_address: "172.16.110.2"
        driver: i40e
        link: link11
        model: Intel-X710
  DUT1:
    type: DUT
    host: "10.30.51.21"
    port: 22
    username: testuser
    password: Csit1234
    cryptodev: 0000:86:00.0
    uio_driver: igb_uio
    honeycomb:
      user: admin
      passwd: admin
      port: 8183
      netconf_port: 2831
    interfaces:
      port1:
        # t2-sut1-c1/p1 - 10GE port1 on Intel NIC x520 2p10GE.
        mac_address: "90:e2:ba:b5:02:b8"
        pci_address: "0000:0a:00.0"
        ip4_address: "172.17.21.1"
        link: link21
        model: Intel-X520-DA2
      port2:
        # t2-sut1-c1/p2 - 10GE port2 on Intel NIC x520 2p10GE.
        mac_address: "90:e2:ba:b5:02:b9"
        pci_address: "0000:0a:00.1"
        ip4_address: "172.17.30.1"
        link: link3
        model: Intel-X520-DA2
      port3:
        # t2-sut1-c2/p1 - 40GE port1 on Cisco VIC 1385 2p40GE.
        mac_address: "04:62:73:8c:ca:cd"
        pci_address: "0000:13:00.0"
        ip4_address: "172.17.22.1"
        link: link22
        model: Cisco-VIC-1385
      port4:
        # t2-sut1-c2/p2 - 40GE port2 on Cisco VIC 1385 2p40GE.
        mac_address: "04:62:73:8c:ca:ce"
        pci_address: "0000:15:00.0"
        ip4_address: "172.16.10.1"
        link: link1
        model: Cisco-VIC-1385
      port5:
        # t2-sut1-c4/p1 - 40GE port1 on Intel NIC xl710 2p40GE.
        mac_address: "68:05:ca:35:77:08"
        pci_address: "0000:88:00.0"
        ip4_address: "172.17.23.1"
        link: link23
        model: Intel-XL710
      port6:
        # t2-sut1-c4/p2 - 40GE port2 on Intel NIC xl710 2p40GE.
        mac_address: "68:05:ca:35:77:09"
        pci_address: "0000:88:00.1"
        ip4_address: "172.16.70.1"
        link: link7
        model: Intel-XL710
      port7:
        # t2-sut1-c5/p1 - 10GE port1 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ee:ec"
        pci_address: "0000:8a:00.0"
        ip4_address: "172.17.24.1"
        link: link24
        model: Intel-X710
      port8:
        # t2-sut1-c5/p2 - 10GE port2 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ee:ed"
        pci_address: "0000:8a:00.1"
        ip4_address: "172.16.90.1"
        link: link9
        model: Intel-X710
      port9:
        # t2-sut1-cm/p1 - 10GE port1 on Cisco VIC 1227 2p10GE.
        mac_address: "00:fe:c8:e4:d0:9b"
        pci_address: "0000:06:00.0"
        ip4_address: "172.17.25.1"
        link: link25
        model: Cisco-VIC-1227
      port10:
        # t2-sut1-cm/p2 - 10GE port2 on Cisco VIC 1227 2p10GE.
        mac_address: "00:fe:c8:e4:d0:9c"
        pci_address: "0000:07:00.0"
        ip4_address: "172.16.50.1"
        link: link5
        model: Cisco-VIC-1227
  DUT2:
    type: DUT
    host: "10.30.51.22"
    port: 22
    username: testuser
    password: Csit1234
    cryptodev: 0000:86:00.0
    uio_driver: igb_uio
    honeycomb:
      user: admin
      passwd: admin
      port: 8183
      netconf_port: 2831
    interfaces:
      port1:
        # t2-sut2-c1/p1 - 10GE port1 on Intel NIC x520 2p10GE.
        mac_address: "90:e2:ba:b5:01:d8"
        pci_address: "0000:0a:00.0"
        ip4_address: "172.16.40.1"
        link: link4
        model: Intel-X520-DA2
      port2:
        # t2-sut2-c1/p2 - 10GE port2 on Intel NIC x520 2p10GE.
        mac_address: "90:e2:ba:b5:01:d9"
        pci_address: "0000:0a:00.1"
        ip4_address: "172.17.21.2"
        link: link21
        model: Intel-X520-DA2
      port3:
        # t2-sut2-c2/p1 - 40GE port1 on Cisco VIC 1385 2p40GE.
        mac_address: "ec:bd:1d:08:8f:88"
        pci_address: "0000:13:00.0"
        ip4_address: "172.16.20.1"
        link: link2
        model: Cisco-VIC-1385
      port4:
        # t2-sut2-c2/p2 - 40GE port2 on Cisco VIC 1385 2p40GE.
        mac_address: "ec:bd:1d:08:8f:89"
        pci_address: "0000:15:00.0"
        ip4_address: "172.17.22.2"
        link: link22
        model: Cisco-VIC-1385
      port5:
        # t2-sut2-c4/p1 - 40GE port1 on Intel NIC xl710 2p40GE.
        mac_address: "68:05:ca:35:76:98"
        pci_address: "0000:88:00.0"
        ip4_address: "172.16.80.1"
        link: link8
        model: Intel-XL710
      port6:
        # t2-sut2-c4/p2 - 40GE port2 on Intel NIC xl710 2p40GE.
        mac_address: "68:05:ca:35:76:99"
        pci_address: "0000:88:00.1"
        ip4_address: "172.17.23.2"
        link: link23
        model: Intel-XL710
      port7:
        # t2-sut2-c5/p1 - 10GE port1 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ee:e4"
        pci_address: "0000:8a:00.0"
        ip4_address: "172.16.100.1"
        link: link10
        model: Intel-X710
      port8:
        # t2-sut2-c5/p2 - 10GE port2 on Intel NIC x710 2p10GE.
        mac_address: "3c:fd:fe:9c:ee:e5"
        pci_address: "0000:8a:00.1"
        ip4_address: "172.17.24.2"
        link: link24
        model: Intel-X710
      port9:
        # t2-sut2-cm/p1 - 10GE port1 on Cisco VIC 1227 2p10GE.
        mac_address: "00:fe:c8:e4:eb:4b"
        pci_address: "0000:06:00.0"
        ip4_address: "172.16.60.1"
        link: link6
        model: Cisco-VIC-1227
      port10:
        # t2-sut2-cm/p2 - 10GE port2 on Cisco VIC 1227 2p10GE.
        mac_address: "00:fe:c8:e4:eb:4c"
        pci_address: "0000:07:00.0"
        ip4_address: "172.17.25.2"
        link: link25
        model: Cisco-VIC-1227
line_input); if (errorFlag == 0) { /* Since no error, save configured values. */ if (chroot_filename) { if (vm->pcap[rx_tx].pcap_main.file_name) vec_free (vm->pcap[rx_tx].pcap_main.file_name); vec_add1 (chroot_filename, 0); vm->pcap[rx_tx].pcap_main.file_name = (char *) chroot_filename; } if (max) vm->pcap[rx_tx].pcap_main.n_packets_to_capture = max; if (enabled) { if (vm->pcap[rx_tx].pcap_main.file_name == 0) vm->pcap[rx_tx].pcap_main.file_name = (char *) format (0, "/tmp/vpe.pcap%c", 0); vm->pcap[rx_tx].pcap_main.n_packets_captured = 0; vm->pcap[rx_tx].pcap_main.packet_type = PCAP_PACKET_TYPE_ethernet; if (vm->pcap[rx_tx].pcap_main.lock == 0) clib_spinlock_init (&(vm->pcap[rx_tx].pcap_main.lock)); vm->pcap[rx_tx].pcap_enable = 1; vlib_cli_output (vm, "pcap %s capture on...", rx_tx == VLIB_RX ? "rx" : "tx"); } } else if (chroot_filename) vec_free (chroot_filename); return error; } static clib_error_t * pcap_rx_trace_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { return pcap_trace_command_internal (vm, input, cmd, VLIB_RX); } static clib_error_t * pcap_tx_trace_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { return pcap_trace_command_internal (vm, input, cmd, VLIB_TX); } /*? * This command is used to start or stop a packet capture, or show * the status of packet capture. Note that both "pcap rx trace" and * "pcap tx trace" are implemented. The command syntax is identical, * simply substitute rx for tx as needed. * * This command has the following optional parameters: * * - on|off - Used to start or stop a packet capture. * * - max - Depth of local buffer. Once 'nn' number * of packets have been received, buffer is flushed to file. Once another * 'nn' number of packets have been received, buffer is flushed * to file, overwriting previous write. If not entered, value defaults * to 100. Can only be updated if packet capture is off. * * - intfc |any - Used to specify a given interface, * or use 'any' to run packet capture on all interfaces. * 'any' is the default if not provided. Settings from a previous * packet capture are preserved, so 'any' can be used to reset * the interface setting. * * - file - Used to specify the output filename. The file will * be placed in the '/tmp' directory, so only the filename is * supported. Directory should not be entered. If file already exists, file * will be overwritten. If no filename is provided, '/tmp/vpe.pcap' * will be used. Can only be updated if packet capture is off. * * - status - Displays the current status and configured attributes * associated with a packet capture. If packet capture is in progress, * 'status' also will return the number of packets currently in * the local buffer. All additional attributes entered on command line * with 'status' will be ignored and not applied. * * @cliexpar * Example of how to display the status of a tx packet capture when off: * @cliexstart{pcap tx trace status} * max is 100, for any interface to file /tmp/vpe.pcap * pcap tx capture is off... * @cliexend * Example of how to start a tx packet capture: * @cliexstart{pcap tx trace on max 35 intfc GigabitEthernet0/8/0 file vppTest.pcap} * pcap tx capture on... * @cliexend * Example of how to display the status of a tx packet capture in progress: * @cliexstart{pcap tx trace status} * max is 35, for interface GigabitEthernet0/8/0 to file /tmp/vppTest.pcap * pcap tx capture is on: 20 of 35 pkts... * @cliexend * Example of how to stop a tx packet capture: * @cliexstart{vppctl pcap tx trace off} * captured 21 pkts... * saved to /tmp/vppTest.pcap... * @cliexend ?*/ /* *INDENT-OFF* */ VLIB_CLI_COMMAND (pcap_tx_trace_command, static) = { .path = "pcap tx trace", .short_help = "pcap tx trace [on|off] [max ] [intfc |any] [file ] [status]", .function = pcap_tx_trace_command_fn, }; VLIB_CLI_COMMAND (pcap_rx_trace_command, static) = { .path = "pcap rx trace", .short_help = "pcap rx trace [on|off] [max ] [intfc |any] [file ] [status]", .function = pcap_rx_trace_command_fn, }; /* *INDENT-ON* */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */