Method and system for automatically testing multiple network cards in parallel
By creating an independent VRF instance and parallel traffic generator on the server, and sharing the traffic generator, the hardware and resource requirements of the traditional multi-network card testing method are solved, efficient multi-network card testing is achieved, operation and maintenance costs are reduced, and operation and maintenance costs are improved. Test efficiency.
Patent Information
- Application Number
- CN202410956877.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-10-01
AI Technical Summary
The traditional multi-network card testing method requires additional hardware and network resources, has low testing efficiency and high cost, and cannot meet the needs of efficient batch testing.
By creating an independent VRF instance and binding the network port, using a parallel traffic generator for simultaneous testing of multiple network cards, sharing the traffic generator, and utilizing multi-threading and multi-core processing capabilities, a fully automated testing process is achieved.
It reduces hardware and network resource requirements, improves test efficiency and performance, reduces operation and maintenance costs, is suitable for production and R&D test scenarios, and provides a flexible and efficient solution.
Smart Images

Figure CN118740706A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automated testing, and in particular to a method and system for parallel automated testing of multiple network cards. Background Art
[0002] When dealing with servers with multiple network cards, traditional testing methods do have some limitations and challenges:
[0003] Additional hardware and network resource requirements: In the traditional testing process, common tools such as iperf require additional servers to run. This means that all network ports to be tested must be connected to a switch or connected to another dedicated auxiliary test server. This setup not only increases the complexity of hardware investment and network resource configuration, but also brings higher technical and management costs.
[0004] Low test efficiency and performance bottleneck: In traditional multi-NIC testing, only one pair of network ports can be tested at a time, which obviously cannot meet the needs of efficient and batch testing. Although you can try to test multiple network ports at the same time by increasing the number of processes, the limitation of CPU performance may cause the test to fail. To avoid this, we usually need to test in batches, which undoubtedly reduces the overall test efficiency.
[0005] Therefore, the existing network interface testing technology urgently needs to be improved and optimized in order to more effectively handle multi-NIC server scenarios, improve testing efficiency, and reduce complexity and overall cost. Summary of the invention
[0006] In order to solve the problems in the prior art, the present invention proposes a method and system for parallel automatic testing of multiple network cards, thereby realizing rapid detection of the performance of multiple network cards.
[0007] The present invention is specifically implemented through the following technical solutions:
[0008] A method for parallel automated testing of multiple network cards, wherein the multiple network cards include multiple network ports of different types, the method comprising the following steps:
[0009] Connecting the network ports of the multiple network cards using optical fibers and / or network cables, specifically, connecting two network ports with the same rate and medium;
[0010] Group the network ports to be tested;
[0011] Create a VRF and bind the corresponding network port. Specifically, each network port group to be tested will create an independent VRF instance and bind the corresponding network port.
[0012] Configure and start the test traffic generator. The test uses the CPU core as the basic unit to configure and start the test traffic generator.
[0013] Obtain and record the test results of the network port.
[0014] As a further improvement of the present invention, when there is a single available network port, an additional network port is configured as a mirror port for testing the tooling, and the mirror port is connected to the network port to be tested.
[0015] As a further improvement of the present invention, the network port grouping to be tested includes:
[0016] Collecting attribute information of each network port to be tested, the attribute information includes: rate, interface type;
[0017] According to the collected information, the network ports to be tested are grouped according to predefined standards.
[0018] The grouping information is recorded, wherein the grouping information includes: a grouping standard and names or numbers of all network ports belonging to the group.
[0019] As a further improvement of the present invention, the creating of VRF and binding of the corresponding network port includes:
[0020] Create a VRF instance: In the Linux system, each network port group to be tested needs to create a corresponding VRF instance;
[0021] Bind network ports to VRF: Once the VRF instance is created successfully, the network ports of the corresponding group need to be bound to the VRF;
[0022] Verify configuration: To confirm that the configuration is correct, you need to verify the settings;
[0023] Iterate the above steps: After completing the above steps, similar operations need to be repeated for all other network port groups to be tested until all network ports have been bound to the corresponding VRF instances.
[0024] As a further improvement of the present invention, one or more traffic generators are shared within a network port group with the same rate.
[0025] As a further improvement of the present invention, for each network port group, a clear traffic path is planned, and a bidirectional traffic test will be performed on the path.
[0026] As a further improvement of the present invention, in the step of obtaining and recording the test results of the network port, it is necessary to obtain and record the test result statistical information of each network port, and the statistical information includes: error data packet statistics, throughput, packet loss rate and confirmation data packet rate.
[0027] The present invention also proposes a system for parallel automatic testing of multiple network cards, the system comprising a testing device and multiple network cards to be tested, the multiple network cards comprising multiple network ports of different types, and the system is used to implement the method of the present invention.
[0028] The beneficial effects of the present invention are as follows: Compared with the existing technology, the present invention has the following advantages: 1. Independent test network and parallel traffic generation: By creating an independent test network on the server and using parallel traffic generator instances to test multiple network cards at the same time, the present invention solves the problem that traditional testing methods require additional servers and complex connection settings. 2. Fully utilize multi-threaded and multi-core processing capabilities: The present invention takes advantage of multi-threaded and multi-core processing capabilities, thereby improving test efficiency and performance. Especially in the case of a large number of network cards, since each port group with the same rate shares a set of traffic generators, the present invention reduces the demand for the number of CPU cores. 3. Fully automated test process: After careful design, the present invention can run fully automatically without manual intervention, reducing operation and maintenance costs and the possibility of misoperation. 4. Good scalability: The present invention is easy to expand, suitable for both production testing and R&D testing scenarios, and provides flexible and efficient solutions for various testing environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 The method flow of the present invention;
[0030] Figure 2 It is a schematic diagram of the connection and grouping of the network ports to be tested of the present invention. DETAILED DESCRIPTION
[0031] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods.
[0032] like Figure 1 As shown, the present invention proposes a method for parallel automated testing of multiple network cards, wherein the multiple network cards include multiple different types of network interfaces (or network ports, ports, network ports), and the method includes the following steps.
[0033] S101: Use optical fiber and / or network cables to connect the network ports of multiple network cards and prepare for testing.
[0034] First, you should select the appropriate optical module or network cable according to the test you need to perform. For example, if you are testing a 10Gbps Ethernet interface, you may need to use an SFP+ optical module and the corresponding optical fiber. For a 1Gbps Ethernet interface, you may only need to use a standard Cat5e or Cat6 network cable.
[0035] Then, you need to connect two network ports with the same rate and media (for example, both are 10Gbps and both use SFP+ optical modules). This pairing method allows traffic to be sent from one port, through the connected line, and received at the other port. This form of "loopback" ensures that network performance can be accurately measured and evaluated.
[0036] Special situation handling
[0037] For testing scenarios where there is only one available port, an additional network port needs to be configured as a mirror port for testing. In this case, specific tooling or equipment is required so that a single port can be tested without an actual network connection.
[0038] Assume that the device under test contains three 2-port GE network cards, one 4-port 10G network card, and two 1-port 50G network cards. The connection diagram is as follows: Figure 2 As shown, network port 1 and network port 2 of the GE network card are connected, network port 3 and network port 4 are connected, network port 5 and network port 6 are connected, network port 7 and network port 8 of the 10G network card are connected, network port 9 and network port 10 are connected, and network port 11 and network port 12 of the 50G network card are connected.
[0039] S102: Grouping of network ports to be tested
[0040] First, you need to determine which network ports need to be tested. This is done by querying the list of network interfaces provided by the operating system. For example, in Linux, you can use the ip link show or ifconfig -a command to view all available network interfaces.
[0041] Collect the attribute information of each network port to be tested, including but not limited to: rate (such as 1000Mbps, 10Gbps), interface type (such as Ethernet, fiber). This information can usually be obtained through the operating system configuration file, system call or specific hardware query tool.
[0042] Then, based on the collected information, the network ports are grouped according to predefined standards. The most common grouping method is to group by rate and interface type. For example, all interfaces that support 10Gbps and are Ethernet type can be grouped into one group, interfaces that support 1Gbps can be grouped into another group, and so on. This ensures that interfaces in the same group have similar performance, making the test results more accurate and valuable for reference.
[0043] After creating the interface groups, they need to be recorded in the system. This can be done in a variety of ways, such as using arrays or lists to store information about each group, or writing the information to a file or database. The recorded information should include: the grouping criteria (such as rate and type), and the names or numbers of all interfaces belonging to the group.
[0044] like Figure 2 As shown, network ports 1, 2, 3, 4, 5, and 6 of the GE network card are divided into group 1-GE group, network ports 7, 8, 9, and 10 of the 10G network card are divided into group 2-10G group, and network ports 11 and 12 of the 50G network card are divided into group 3-50G group.
[0045] S103: Create VRF and bind the corresponding network port
[0046] In this step, each network port group to be tested will create an independent Virtual Routing and Forwarding (VRF) instance and bind the corresponding network interface. The specific steps are as follows:
[0047] Create a VRF instance: In Linux, each network port group to be tested needs to have a corresponding VRF instance created. This can be done using the ip vrf add command.
[0048] Bind network ports to VRF: Once a VRF instance is created, the network ports of the corresponding group need to be bound to the VRF. This can be done by ip link set dev <interface>vrf <vrf>Command implementation.
[0049] Verify the configuration: To confirm that the configuration is correct, you need to verify the settings. A simple and effective way is to check the status of the network interface, which can be obtained by executing the ip link show command.
[0050] Iterate the above steps: After completing the above steps, similar operations need to be repeated for all other network port groups to be tested until all network ports have been bound to the corresponding VRF instances.
[0051] It is worth noting that the test process does not require additional server or device support. The device under test can act as both a traffic client and a traffic server. It is only necessary to run the iperf service on the first and last VRFs. In this way, the test process can be greatly simplified, the hardware cost can be reduced, and the test efficiency can be improved.
[0052] Table 1 VRF and port binding correspondence
[0053]
[0054] S104: Configure and start the test traffic generator
[0055] The test uses the CPU core as the basic unit to configure and start the test traffic generator. The key optimization point is to share one or more traffic generators with the same rate in the network port group.
[0056] Traffic generator allocation and sharing: To improve efficiency and fully utilize resources, a traffic generator is not allocated to each network port. Instead, one or more traffic generators are shared within a group of network ports at the same rate. For low-speed network ports, one traffic generator is sufficient to meet test requirements. However, for high-speed network ports, multiple traffic generators may be required to meet the requirements of high-speed bandwidth testing.
[0057] Traffic path setting: For each network port group, a clear traffic path will be planned. For example, suppose there are three network port groups:
[0058] The traffic path of network port group 1 is: 1->2->3->4->5->6
[0059] The traffic path of network port group 2 is: 7->8->9->10
[0060] The traffic path of network port group 3 is: 11->12
[0061] On these paths, bidirectional traffic testing will be performed.
[0062] In summary, for the above configuration, only 3 traffic generators (i.e. 3 CPU cores) are needed. If a strategy of one traffic generator for each pair of network ports is adopted, 6 traffic generators are required. In many cases, due to the limited number or performance of CPU cores, too many processes cannot be provided for testing at the same time, so it may be necessary to complete the test in multiple times.
[0063] This optimization method significantly reduces the demand for the number of CPU cores, thereby saving resources and improving test efficiency.
[0064] S105: Obtain and record the test result of the network port.
[0065] In this step, you need to obtain and record the test result statistics of each network port. Specifically, the following are the necessary operations:
[0066] Collect error packet statistics: It is necessary to obtain the statistics of error packets received and sent on each port, including but not limited to CRC errors, alignment errors, collisions, discards, etc.
[0067] Calculate throughput and packet loss rate: Based on the collected data, calculate the throughput (the amount of data successfully transmitted per unit time) and packet loss rate (the ratio of the number of lost data packets to the total number of sent data packets) for each port.
[0068] Check for packet loss: The test program needs to check for packet loss. Any lost packets may indicate a network problem and may affect the results of the performance test.
[0069] Confirm the packet rate: The test program should also check and calculate the packet rate sent and received by each port to confirm whether they meet the pre-set standards. If the actual rate is lower than the preset value, it may be necessary to adjust the network configuration or hardware equipment to improve performance.
[0070] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention. For ordinary technicians in this field, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as belonging to the protection scope of the present invention.< / vrf> < / interface>
Claims
1. A method for parallel automated testing of multiple network cards, wherein the multiple network cards include multiple network ports of different types, characterized in that: The method comprises the following steps: Connecting the network ports of the multiple network cards using optical fibers and / or network cables, specifically, connecting two network ports with the same rate and medium; Group the network ports to be tested; Create a VRF and bind the corresponding network port. Specifically, each network port group to be tested will create an independent VRF instance and bind the corresponding network port. Configure and start the test traffic generator. The test uses the CPU core as the basic unit to configure and start the test traffic generator. Obtain and record the test results of the network port.
2. The method of claim 1, wherein: When there is a single available network port, an additional network port is configured as a mirror port for testing the tooling, and the mirror port is connected to the network port to be tested.
3. The method of claim 1, wherein: The network port groups to be tested include: The attribute information of each network port to be tested is collected, wherein the attribute information includes: rate and interface type; and the network ports to be tested are grouped according to the collected information and predefined standards. The grouping information is recorded, wherein the grouping information includes: a grouping standard and names or numbers of all network ports belonging to the group.
4. The method of claim 1, wherein: The step of creating a VRF and binding the corresponding network port includes: creating a VRF instance: in a Linux system, each network port group to be tested needs to create a corresponding VRF instance; Bind network ports to VRF: Once the VRF instance is created successfully, the network ports of the corresponding group need to be bound to the VRF; Verify configuration: To confirm that the configuration is correct, you need to verify the settings; Iterate the above steps: After completing the above steps, similar operations need to be repeated for all other network port groups to be tested until all network ports have been bound to the corresponding VRF instances.
5. The method of claim 1, wherein: Share one or more traffic generators within a group of network ports of the same rate.
6. The method of claim 1, wherein: For each network port group, a clear traffic path is planned, on which bidirectional traffic testing will be performed.
7. The method of claim 1, wherein: In the step of obtaining and recording the test results of the network ports, it is necessary to obtain and record statistical information of the test results of each network port, the statistical information including: error data packet statistics, throughput, packet loss rate and confirmed data packet rate.
8. A system for parallel automated testing of multiple network cards, characterized in that: The system includes a test device and multiple network cards to be tested, the multiple network cards include multiple network ports of different types, and the system is used to implement the method according to any one of claims 1-7.
