Switch performance testing method, device, storage medium and computer equipment
By connecting to a single test port and service port, and configuring port loopback and vlan hybrid modes on the switch, the problem of high number and type of test instrument ports in the existing technology is solved, and low-cost and highly applicable switch performance testing is achieved.
Patent Information
- Application Number
- CN202411957857.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, switch performance testing requires that the test instrument has the same number of test ports as the switch port, and has high requirements for the test port type, strong dependency, and complex testing traffic configuration, resulting in high testing costs.
By docking one of the test ports of the test instrument with one of the service ports of the switch and configuring port loopback at other service ports of the switch, the internal loopback characteristics supported by the switch chip are simplified in traffic configuration and evaluation.
Reduces dependence on the number and type of test ports for testing instruments, simplifies traffic configuration, reduces testing costs, and eliminates the need for physical connections to individual ports.
Smart Images

Figure CN119788562A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of switch testing, and in particular to a method, device, storage medium and computer equipment for switch performance testing. Background Art
[0002] A switch is a data transmission device. When it receives data, it checks the destination MAC address of the data frame, searches the internal MAC address table for the corresponding port of the address, and forwards the data from the corresponding port. When testing the overall performance of a switch, a test instrument is usually used to analyze the traffic in and out of each port of the switch.
[0003] In the prior art, the test instrument needs to have the same number of test ports as the ports of the switch, and the test instrument also has high requirements on the type of test ports, is too dependent, and has complex test traffic configuration. It also requires a large number of wires, optical modules and other accessories, and the test cost is high. Therefore, how to test the overall performance of the switch with strong applicability and low cost has become an urgent problem to be solved. Summary of the invention
[0004] Based on the above problems, the present application provides a method, apparatus, storage medium and computer equipment for testing switch performance, so as to test the overall performance of the switch with strong applicability and low cost.
[0005] The present application discloses a method for testing switch performance. The switch includes multiple ports G1 to Gn. The method includes:
[0006] Connect one test port T1 of the test instrument to G1, and configure port loopback on G2~Gn;
[0007] Configure VLAN hybrid mode on G1~Gn;
[0008] Configure traffic on T1, start the test instrument to send the traffic to the switch, and receive the return traffic sent back by the switch;
[0009] The performance of the switch is evaluated based on the return traffic.
[0010] Optionally, configuring VLAN hybrid mode on G1 to Gn includes:
[0011] Configure G1's pvid to vlan 1, untag to vlan n, G2's pvid to vlan 2, untag to vlan 1, G3's pvid to vlan 3, untag to vlan 2, ..., Gn's pvid to vlan n, untag to vlan n-1.
[0012] Optionally, the starting test instrument sends the traffic to the switch and receives the return traffic sent back by the switch, including:
[0013] The traffic is sent from T1 to G1;
[0014] According to the pvid configured on G1, the traffic is sent to port G2 whose untag is vlan 1;
[0015] The traffic is looped back according to the port configured on G2, flows out of G2 and then flows into G2;
[0016] According to the pvid configured on G2, the traffic is sent to port G3 whose untag is vlan 2;
[0017] The traffic is looped back according to the port configured on G3, flows out of G3 and then flows into G3;
[0018] Repeat the transmission of the traffic until the traffic flows back into G1 as the return traffic;
[0019] G1 outputs the return flow to T1.
[0020] Optionally, sending the traffic to port G2 whose untag is vlan 1 according to the pvid configured by G1 includes:
[0021] According to the pvid configured by G1, the label of the traffic is set to vlan 1; the vlan 1 label corresponds to the port untagged to vlan 1.
[0022] Optionally, the traffic is looped back according to the port configured on G2, flows out of G2 and then flows into G2, including:
[0023] Stripping the vlan 1 tag of the traffic;
[0024] The unlabeled traffic flows out of G2 and then flows in again.
[0025] Optionally, configuring port loopback on G2 to Gn includes:
[0026] When G2 to Gn are optical ports, optical fibers are used for physical loopback connections.
[0027] Optionally, before T1 configures traffic, the method further includes:
[0028] Configure the link protocol of T1 to make the link layer status available.
[0029] Based on the above switch performance test method, the present application also discloses a switch performance test device, the switch includes multiple ports G1 to Gn, and the device includes: a docking unit, a configuration unit, a startup unit and an evaluation unit;
[0030] The docking unit is used to dock a test port T1 of the test instrument with G1, and configure port loopbacks at G2 to Gn;
[0031] The configuration unit is used to configure the vlan hybrid mode in G1 to Gn;
[0032] The startup unit is used to configure traffic at T1, start the test instrument to send the traffic to the switch, and receive the return traffic sent back by the switch;
[0033] The evaluation unit is used to evaluate the performance of the switch according to the return traffic.
[0034] Optionally, the configuration unit includes:
[0035] The configuration subunit is used to configure the pvid of G1 to be vlan 1, untag to vlan n, the pvid of G2 to be vlan 2, untag to vlan 1, the pvid of G3 to be vlan 3, untag to vlan 2, ..., the pvid of Gn to be vlan n, untag vlann-1.
[0036] Optionally, the starting unit includes:
[0037] An output subunit, used for sending the traffic from T1 to G1;
[0038] The sending subunit is used to send the traffic to the port G2 whose untag is vlan 1 according to the pvid configured by G1;
[0039] A loopback subunit, used for looping back the traffic according to the port configured by G2, flowing out of G2 and then flowing into G2;
[0040] The resending subunit is used to send the traffic to the port G3 whose untag is vlan 2 according to the pvid configured by G2;
[0041] A re-loop subunit, used for looping back the traffic according to the port configured by G3, and then flowing out of G3 and then flowing into G3;
[0042] a repeating subunit, used for repeating the transmission of the traffic until the traffic flows back into G1 as the return traffic;
[0043] The return subunit is used for G1 to output the return flow to T1.
[0044] Optionally, the sending subunit includes:
[0045] The corresponding subunit is used to set the label of the traffic to vlan 1 according to the pvid configured by G1; the vlan 1 label corresponds to the port untagged as vlan 1.
[0046] Optionally, the loopback subunit includes:
[0047] a stripping subunit, configured to strip the vlan 1 label of the traffic;
[0048] The inflow subunit is used to redirect the unlabeled traffic flowing out of G2 and then into G2.
[0049] Optionally, the docking unit includes:
[0050] The physical loopback subunit is used to perform physical loopback connection using optical fiber when G2 to Gn are optical ports.
[0051] Optionally, the device further comprises:
[0052] The protocol unit is used to configure the link protocol of T1 and make the link layer status available.
[0053] Based on the above switch performance testing method, the present application also discloses a storage medium storing a computer program, wherein the computer program is used to execute the above method.
[0054] Based on the above switch performance testing method, the present application also discloses a computer device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method described in the claim is executed.
[0055] The present application discloses a method, device, storage medium and computer equipment for switch performance testing. A test port of a test instrument is docked with a service port of a switch, and port loopback is configured on other service ports of the switch to reduce the requirement for the number of test ports. Since only one test port is docked with the service port, it is only required that the type of the test port is the same as the type of the docked service port, and the requirement for the test port type is also reduced. The switch chip supports the feature of internal loopback of the port, that is, the traffic sent from the port can go through the internal loopback and then enter from the port. And the VLAN hybrid mode is configured on all service ports of the switch, and a traffic is configured on the test port, which can be unicast, multicast, and broadcast. The configuration is simple and there is no restriction on the traffic type, which reduces the configuration time. Start the test instrument to send traffic to the switch and receive the return traffic sent back by the switch. Finally, the performance of the switch is evaluated based on the return traffic. The processing method of the VLAN hybrid mode is used, combined with the port loopback feature, to reduce the dependence on the number and type of test ports, simplify the traffic configuration of the test instrument, and there is no need to physically connect the port, which greatly saves the resources of the test instrument, uses relatively high-quality wires, optical modules and other configurations, and reduces the test cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0057] Figure 1a A schematic diagram of a flow chart of a method for testing switch performance disclosed in an embodiment of the present application;
[0058] Figure 1b A schematic diagram of the principle of a method for testing switch performance disclosed in an embodiment of the present application;
[0059] Figure 2 A flowchart of another method for testing switch performance disclosed in an embodiment of the present application;
[0060] Figure 3 A schematic diagram of the structure of a switch performance test device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0061] In order to make the methods described in this application accurately and fully understood, the professional knowledge involved in the technical field of this application is first introduced and explained in detail.
[0062] When testing the overall performance of a switch, it is necessary to ensure that all service ports of the switch have traffic flowing in and out. For example, a common operation is to configure a traffic flow on the test port T1, with the destination MAC address set to the MAC address of the test port T2. In this way, the service port G1 connected to T1 has traffic flowing in, and the service port G2 has traffic flowing out. This is the forward traffic between T1 and T2. Configure another traffic flow on T2, with the destination MAC address set to the MAC address of T1. Then, G2 has traffic flowing in, and G1 has traffic flowing out. This is the reverse traffic between T1 and T2. And so on, so that each service port has traffic flowing in and out.
[0063] Start the test instrument to send multiple flows to the switch. After receiving the flow, the service port will return the flow to the test instrument according to the above configuration. Then the test instrument will analyze the flow according to actual needs, thereby achieving the purpose of testing the performance of the entire switch.
[0064] However, there are several problems with the usual operation: the test instrument must have the same number of test ports as the service ports of the switch. As the port density of the current switch is increasing, it is actually difficult to find a test instrument with enough test ports for testing. In addition, each service port of the switch needs to be connected. If the optical port is tested, each port needs to be equipped with an optical module, and the cost of the test accessories is high. When the switch has many types of service ports (such as optical ports, electrical ports, etc.), different types of service ports require different cables to connect, which also requires the test instrument to have the same type of test ports, which places high requirements on the test instrument. In addition, configuring multiple flows on the test instrument is both complicated and error-prone.
[0065] In order to overcome the above problems, the present application provides a method for testing switch performance. The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0066] Embodiment 1: This application discloses a method for testing switch performance.
[0067] For details, please refer to Figure 1a A method for testing switch performance disclosed in this embodiment includes the following steps:
[0068] Step 101: Connect a test port T1 of a test instrument to G1, and configure port loopbacks on G2 to Gn.
[0069] In the method described in this embodiment, the switch includes multiple ports G1 to Gn, and only one test port T1 is connected to G1 for connection. Port loopback is configured on G2 to Gn, that is, all other service ports except G1 connected to T1, so that the traffic flowing out of the port flows into the port again. As an optional method, when G2 to Gn are optical ports, optical fiber can be used for physical loopback connection.
[0070] Step 102: Configure VLAN hybrid mode in G1 to Gn.
[0071] VLAN hybrid mode means that when a data frame enters the switch from a hybrid port, the switch will first check whether the data frame has a VLAN tag. If the data frame has a VLAN tag, the switch will search the MAC address table based on the VLAN ID in the tag to determine which port the data frame should be forwarded to. If the data frame has no tag, the switch will mark it with a PVID (Port VLAN ID) and regard it as belonging to the VLAN corresponding to the PVID. Accordingly, when the data frame leaves the switch from the hybrid port, the switch will determine whether the VLAN tag needs to be stripped based on the port configuration and the VLAN ID of the data frame. If the port is configured to allow data frames of the VLAN to leave in untagged mode, the switch will strip the VLAN tag of the data frame. If the port is configured to leave in tagged mode, the data frame will remain tagged.
[0072] In the method described in this embodiment, Figure 1b The schematic diagram of the principle of a method for testing switch performance disclosed in an embodiment of the present application is shown in FIG. Figure 1b As shown, in G1 to Gn, that is, all service ports are configured with VLAN hybrid mode, specifically, the corresponding pvid and untag can be configured. As an optional method, the pvid of G1 is configured as VLAN 1, untag is VLAN n, the pvid of G2 is configured as VLAN 2, untag is VLAN 1, the pvid of G3 is configured as VLAN 3, untag is VLAN 2, ..., the pvid of Gn is configured as VLAN n, untag is VLAN n-1.
[0073] Step 103: Configure traffic at T1, start the test instrument to send the traffic to the switch, and receive return traffic sent back by the switch.
[0074] In the method described in this embodiment, first configure the link protocol of T1 to make the link layer state available. As an optional method, taking the data transmission between T1 and G2 as an example, configure a flow at T1 and send it from T1 to G1. According to the pvid configured for G1, set the label of the flow to vlan 1, and the flow is flooded in vlan 1. The vlan 1 label corresponds to the port untagged as vlan1. Therefore, the flow can be sent from G1 to the port G2 untagged as vlan 1.
[0075] In the method described in this embodiment, according to the port loopback configured by G2, the traffic can flow into G2 again after flowing out from G2. Specifically, after receiving the traffic, G2 strips off the vlan 1 tag of the traffic, and flows the untagged traffic out of G2 and then flows in. Subsequently, according to the pvid configured by G2, the traffic is sent to the port G3 whose untag is vlan 2. The traffic is then looped back according to the port configured by G3, and flows out of G3 and then flows into G3. The transmission of the above traffic is repeated continuously, so that the traffic is transmitted in a serpentine manner until the traffic flows through all service ports according to the vlan forwarding rules and reaches the last service port Gn. According to the pvid configured by Gn, the tag of the traffic is set to vlan n, and the traffic is flooded in vlan n. The traffic is sent from Gn to the port G1 whose untag is vlan n, that is, it flows back into G1 as return traffic, and G1 then outputs the return traffic to T1. At this point, all service ports of the switch have traffic flowing in and out.
[0076] Step 104: Evaluate the performance of the switch according to the return traffic.
[0077] The method described in this embodiment only needs to dock a test port of the test instrument with a service port of the switch to complete the test, which greatly reduces the requirements for the number of test ports of the test instrument. And the type of the test port only needs to be the same as the type of the docked service port, so the requirements for the test port type are also reduced, and the electrical port and optical port of the switch can be tested at the same time. At the same time, only one flow (unicast, multicast, and broadcast) needs to be configured on the test instrument, which simplifies the flow configuration, has no restrictions on the flow type, and reduces the configuration time. In summary, the method described in this embodiment not only reduces the dependence on the number and type of test ports of the test instrument, simplifies the flow configuration, but also reduces the use of accessories such as test wires and optical modules, greatly saves test resources, and reduces the cost of testing. In addition, the port loopback feature of the switch is utilized, that is, the flow sent from the port can be internally looped back and enter from the port without physical connection. At the same time, combined with the vlan tag addition / stripping processing method of the vlan hybrid mode, the flow of any vlan id can be configured to realize vlan tag stripping. Combining the port loopback feature with the vlan hybrid feature can further optimize the test effect.
[0078] Embodiment 2: This application discloses another method for testing switch performance. Figure 2 The method described in this embodiment introduces the traffic transmission process in the switch performance test.
[0079] Step 201: After the test instrument is started, traffic is output from the test port T1 of the test instrument and output to the service port G1 of the switch connected to T1.
[0080] Step 202: According to the pvid (vlan 1) configured by G1, the traffic is labeled with the vlan 1 label.
[0081] Step 203: Traffic is output from G1 and input to service port G2 which is untagged as vlan 1.
[0082] Step 204: According to the port loopback configured on G2, the traffic is stripped of the VLAN 1 label, outputs G2 in an unlabeled form, and re-enters G2.
[0083] Step 205: According to the pvid (vlan 2) configured by G2, the traffic is labeled with the vlan 2 label.
[0084] Step 206: Traffic is output from G2 and input to service port G3 which is untagged as vlan 2.
[0085] Step 207: Repeat the above steps until the traffic is output from Gn and input to G1 with untag vlan n.
[0086] Step 208: According to the untag vlan n configured in G1, the traffic is stripped of the vlan n tag, output from G1 in an untagged form, and input into T1.
[0087] Based on the switch performance test method disclosed in the above embodiment, this embodiment correspondingly discloses a switch performance test device, wherein the switch includes multiple ports G1 to Gn. Figure 3 , the switch performance test device comprises: a docking unit 301, a configuration unit 302, a startup unit 303 and an evaluation unit 304;
[0088] The docking unit 301 is used to dock a test port T1 of the test instrument with G1, and configure port loopbacks at G2 to Gn;
[0089] The configuration unit 302 is used to configure the VLAN hybrid mode in G1-Gn;
[0090] The start unit 303 is used to configure traffic at T1, start the test instrument to send the traffic to the switch, and receive the return traffic sent back by the switch;
[0091] The evaluation unit 304 is configured to evaluate the performance of the switch according to the return traffic.
[0092] Optionally, the configuration unit 302 includes:
[0093] The configuration subunit is used to configure the pvid of G1 to be vlan 1, untag to vlan n, the pvid of G2 to be vlan 2, untag to vlan 1, the pvid of G3 to be vlan 3, untag to vlan 2, ..., the pvid of Gn to be vlan n, untag vlann-1.
[0094] Optionally, the starting unit 303 includes:
[0095] An output subunit, used for sending the traffic from T1 to G1;
[0096] The sending subunit is used to send the traffic to the port G2 whose untag is vlan1 according to the pvid configured by G1;
[0097] A loopback subunit, used for looping back the traffic according to the port configured by G2, flowing out of G2 and then flowing into G2;
[0098] The resending subunit is used to send the traffic to the port G3 whose untag is vlan 2 according to the pvid configured by G2;
[0099] A re-loop subunit, used for looping back the traffic according to the port configured by G3, and then flowing out of G3 and then flowing into G3;
[0100] a repeating subunit, used for repeating the transmission of the traffic until the traffic flows back into G1 as the return traffic;
[0101] The return subunit is used for G1 to output the return flow to T1.
[0102] Optionally, the sending subunit includes:
[0103] The corresponding subunit is used to set the label of the traffic to vlan 1 according to the pvid configured by G1; the vlan 1 label corresponds to the port untagged as vlan 1.
[0104] Optionally, the loopback subunit includes:
[0105] a stripping subunit, configured to strip the vlan 1 label of the traffic;
[0106] The inflow subunit is used to redirect the unlabeled traffic flowing out of G2 and then into G2.
[0107] Optionally, the docking unit 301 includes:
[0108] The physical loopback subunit is used to perform physical loopback connection using optical fiber when G2 to Gn are optical ports.
[0109] Optionally, the device further comprises:
[0110] The protocol unit is used to configure the link protocol of T1 and make the link layer status available.
[0111] Based on the above switch performance testing method, the present application also discloses a storage medium storing a computer program, wherein the computer program is used to execute the above method.
[0112] Based on the above switch performance testing method, the present application also discloses a computer device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method described in the claim is executed.
[0113] The embodiments in this specification are described in a progressive manner. As for the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the methods.
[0114] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0115] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0116] The features described in the embodiments of this specification can be replaced or combined with each other, so that professional and technical personnel in this field can implement or use the present application.
[0117] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for testing switch performance, characterized in that: The switch includes a plurality of ports G1 to Gn, and the method includes: Connect one test port T1 of the test instrument to G1, and configure port loopback on G2~Gn; Configure VLAN hybrid mode on G1~Gn; Configure traffic on T1, start the test instrument to send the traffic to the switch, and receive the return traffic sent back by the switch; The performance of the switch is evaluated based on the return traffic.
2. The method according to claim 1, characterized in that: The configuring of VLAN hybrid mode in G1 to Gn includes: Configure G1's pvid to vlan 1, untag to vlan n, G2's pvid to vlan 2, untag to vlan 1, G3's pvid to vlan 3, untag to vlan 2, ..., Gn's pvid to vlan n, untag to vlan n-1.
3. The method according to claim 2, characterized in that The startup test instrument sends the traffic to the switch and receives the return traffic sent back by the switch, including: The traffic is sent from T1 to G1; According to the pvid configured on G1, the traffic is sent to port G2 whose untag is vlan 1; The traffic is looped back according to the port configured on G2, flows out of G2 and then flows into G2; According to the pvid configured on G2, the traffic is sent to port G3 whose untag is vlan 2; The traffic is looped back according to the port configured on G3, flows out of G3 and then flows into G3; Repeat the transmission of the traffic until the traffic flows back into G1 as the return traffic; G1 outputs the return flow to T1.
4. The method according to claim 3, characterized in that The method of sending the traffic to the port G2 whose untag is vlan 1 according to the pvid configured by G1 includes: According to the pvid configured by G1, the label of the traffic is set to vlan 1; the vlan 1 label corresponds to the port untagged as vlan 1.
5. The method according to claim 4, characterized in that The traffic is looped back according to the port configured on G2, flows out of G2 and then flows into G2, including: Stripping the vlan 1 tag of the traffic; The unlabeled traffic flows out of G2 and then flows in again.
6. The method according to claim 1, characterized in that The configuration of port loopback on G2 to Gn includes: When G2~Gn are optical ports, optical fiber is used for physical loopback connection.
7. The method according to claim 1, characterized in that Before T1 configures traffic, the method further includes: Configure the link protocol of T1 to make the link layer status available.
8. A device for testing switch performance, characterized in that: The switch includes a plurality of ports G1 to Gn, and the device includes: a docking unit, a configuration unit, a startup unit and an evaluation unit; The docking unit is used to dock a test port T1 of the test instrument with G1, and configure port loopbacks at G2 to Gn; The configuration unit is used to configure the vlan hybrid mode in G1 to Gn; The startup unit is used to configure traffic at T1, start the test instrument to send the traffic to the switch, and receive the return traffic sent back by the switch; The evaluation unit is used to evaluate the performance of the switch according to the return traffic.
9. A storage medium, characterized in that: A computer program is stored, and the computer program is used to execute the method according to any one of claims 1 to 7.
10. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method according to any one of claims 1 to 7 is executed.