Traffic stability test method and device, equipment and storage medium
By automatically configuring static link aggregation and monitoring the number of packets, the problems of low efficiency and insufficient accuracy of m-lag traffic stability testing in the prior art are solved, and efficient and accurate traffic stability testing is achieved.
Patent Information
- Application Number
- CN202510050249.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-05-06
AI Technical Summary
In the prior art, m-lag flow stability testing relies on manual operation, is inefficient, cannot simulate faults at regular and fixed points, and is easy to introduce human errors, affecting the accuracy of the test results.
By configuring static link aggregation, automatically switching lines, sending traffic packets and monitoring the number of packets received, we can automate the traffic stability testing process.
The flow stability test process is simplified, the testing efficiency and accuracy are improved, and the faults can be simulated regularly and at regular intervals, and the switching time is automatically recorded and the flow stability is evaluated.
Smart Images

Figure CN119945948A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of network communications, and in particular to a flow stability testing method, device, equipment and storage medium. Background Art
[0002] In the current field of network communication technology, m-lag (Multi-chassis Link Aggregation Group) technology is widely used to improve the reliability and stability of the network. However, for the test of m-lag traffic stability, the traditional method mainly relies on manual instrument flow testing, which has many shortcomings. Specifically, the traditional manual instrument flow testing requires artificial fault creation to trigger the line switching of m-lag, and manually check the switching time and results. This method is not only inefficient, but also unable to simulate the occurrence of faults at a fixed time and point, and it is difficult to fully evaluate the traffic stability of m-lag in various scenarios. In addition, manual operation is also prone to introduce human errors, affecting the accuracy of the test results. In view of the shortcomings of traditional testing methods, the industry urgently needs a test method that can automatically, efficiently and accurately detect the stability of m-lag traffic. The method should be able to simulate the occurrence of faults at a fixed time and point, automatically record the switching time, and automatically evaluate the traffic stability after switching, thereby improving the test efficiency and accuracy.
[0003] Therefore, how to simplify the test process of traffic stability and improve test efficiency is a problem that needs to be solved urgently. Summary of the invention
[0004] The main purpose of this application is to provide a flow stability testing method, device, equipment and storage medium, aiming to solve the technical problem of how to simplify the flow stability testing process and improve the testing efficiency.
[0005] To achieve the above-mentioned purpose, the present application proposes a flow stability test method, which is applied to a flow stability test system, wherein the flow stability test system comprises: a network packet processing module, a switch to be tested, and a network card, wherein the network card is used to connect the switch to be tested with the network packet processing module; the method comprises:
[0006] When the traffic stability test function of the switch to be tested is turned on, configuring static link aggregation according to the switch to be tested;
[0007] Testing the test line in the static link aggregation based on the network packet processing module to obtain the transfer time and flow rate increase;
[0008] The traffic stability of the static link aggregation is determined according to the transfer time and the traffic growth rate.
[0009] In one embodiment, the step of testing the test line in the static link aggregation based on the network packet processing module to obtain the transfer time and traffic growth rate includes:
[0010] Determining a line to be tested according to the static link aggregation;
[0011] Open a thread pool according to the network packet processing module and send a traffic packet to the test line, wherein the thread pool includes a first thread, a second thread and a third thread;
[0012] After detecting the traffic packet of the test line, a fault simulation test is performed on the test line according to the first thread, the second thread and the third thread to obtain the transfer time and the traffic growth rate.
[0013] In one embodiment, after detecting the traffic packet of the test line, the step of performing a fault simulation test on the test line according to the first thread, the second thread, and the third thread to obtain the transfer time and traffic growth rate includes:
[0014] After detecting the traffic packets of the test line, counting the number of received traffic packets of the test line according to the third thread;
[0015] Performing a line fault simulation according to the second thread and the number of received packets, and recording a transfer time during the line fault simulation according to the first thread;
[0016] The line fault simulation is repeated according to the preset test time and the preset time interval to obtain the flow rate growth rate after each fault simulation.
[0017] In one embodiment, the step of performing line fault simulation according to the second thread and the number of received packets includes:
[0018] Obtaining a packet receiving threshold of the test line;
[0019] When the number of received packets is greater than or equal to the packet receiving threshold, one of the test lines is selected as a simulated fault line according to a preset random simulation strategy, and the simulated fault line is closed according to the second thread to perform line fault simulation.
[0020] In one embodiment, the step of determining the traffic stability of the static link aggregation according to the transfer time and the traffic growth rate includes:
[0021] When the transfer time is less than or equal to the preset transfer time or the absolute value of the flow rate increase is less than or equal to the preset flow fluctuation threshold, it is determined that the flow of the current test line is stable, and the number of times the flow of the current test line is stable is recorded;
[0022] When the transfer time is greater than the preset transfer time or the absolute value of the flow rate increase is greater than the preset flow rate fluctuation threshold, it is determined that the flow of the current test line is unstable, and the number of times the flow of the current test line is unstable is recorded;
[0023] The flow stability of the static link aggregation is determined according to the flow stability times and the flow instability times.
[0024] In one embodiment, the step of judging the traffic stability of the static link aggregation according to the number of traffic stability times and the number of traffic instability times includes:
[0025] Obtaining a flow stability probability according to the flow stability times and the flow instability times;
[0026] When the traffic stability probability is greater than a preset traffic stability probability, it is determined that the traffic stability of the static link aggregation is normal.
[0027] In one embodiment, the switch to be tested includes a first switch, a second switch, a third switch, and a fourth switch. When the traffic stability test function of the switch to be tested is turned on, the step of configuring static link aggregation according to the switch to be tested specifically includes:
[0028] When the flow stability test function of the switch to be tested is turned on, the first switch and the second switch are configured as a multi-chassis link aggregation, and the interface connecting the first interactive machine and the second interactive machine is set as a link detection interface;
[0029] The interfaces of the first switch and the second switch connected to the third switch and the fourth switch respectively are set as down-link interfaces to complete the static link aggregation configuration of the switch to be tested.
[0030] In addition, to achieve the above-mentioned purpose, the present application also proposes a flow stability testing device, the device comprising:
[0031] A link configuration module, configured to configure static link aggregation according to the switch to be tested when the traffic stability test function of the switch to be tested is turned on;
[0032] A simulation test module, used to test the test line in the static link aggregation based on the network packet processing module to obtain the transfer time and traffic growth rate;
[0033] A performance testing module is used to determine the flow stability of the static link aggregation according to the transfer time and the flow growth rate.
[0034] In addition, to achieve the above-mentioned purpose, the present application also proposes a flow stability testing device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the flow stability testing method described above.
[0035] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the flow stability testing method described above are implemented.
[0036] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the flow stability testing method described above are implemented.
[0037] The present application provides a method for testing flow stability, and the method of the present application includes: when the flow stability test function of the switch to be tested is turned on, static link aggregation is configured according to the switch to be tested; based on the network packet processing module, the test line in the static link aggregation is tested to obtain the transfer time and flow growth rate; the flow stability of the static link aggregation is determined according to the transfer time and flow growth rate. In summary, the present application realizes the automation of the flow stability test process, simplifies the flow stability test process, and improves the test efficiency by configuring static link aggregation, automatically switching lines, sending flow packets, and monitoring the number of received packets. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0039] 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0040] Figure 1 A flow chart showing a first embodiment of the flow stability testing method of the present application;
[0041] Figure 2 This is a network diagram of a flow stability test system in an embodiment of a flow stability test method of the present application;
[0042] Figure 3A flow chart showing a second embodiment of the flow stability testing method of the present application;
[0043] Figure 4 This is a schematic diagram of the module structure of the flow stability testing device according to an embodiment of the present application;
[0044] Figure 5 Schematic diagram of the equipment structure of the hardware operating environment involved in the flow stability testing method in the embodiment of the present application.
[0045] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0046] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0047] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0048] The main solution of the embodiment of the present application is: when the flow stability test function of the switch to be tested is turned on, static link aggregation is configured according to the switch to be tested; based on the network packet processing module, the test line in the static link aggregation is tested to obtain the transfer time and the flow growth rate; the flow stability of the static link aggregation is determined according to the transfer time and the flow growth rate.
[0049] In the current field of network communication technology, M-LAG (multi-chassis link aggregation group) technology is widely used to improve the reliability and stability of the network. However, for the test of M-LAG traffic stability, the traditional method mainly relies on manual instrument flow testing, which has many shortcomings. Specifically, the traditional manual instrument flow testing requires artificial fault creation to trigger the line switching of M-LAG, and manually check the switching time and results. This method is not only inefficient, but also unable to simulate the occurrence of faults at a fixed time and point, and it is difficult to fully evaluate the traffic stability of M-LAG in various scenarios. In addition, manual operation is also prone to introduce human errors, affecting the accuracy of the test results. In view of the shortcomings of traditional test methods, the industry urgently needs a test method that can automatically, efficiently and accurately detect the stability of M-LAG traffic. The method should be able to simulate the occurrence of faults at a fixed time and point, automatically record the switching time, and automatically evaluate the traffic stability after switching, thereby improving the test efficiency and accuracy. Therefore, how to simplify the test process of traffic stability and improve the test efficiency is a problem that needs to be solved urgently.
[0050] This application automates the flow stability test process by configuring static link aggregation, automatically switching lines, sending traffic packets and monitoring the number of received packets, thereby simplifying the flow stability test process and improving test efficiency.
[0051] It should be noted that the execution subject of this embodiment can be a flow stability test system, or a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device that can realize the above-mentioned flow stability test function, etc., and this embodiment does not specifically limit this. The following takes the flow stability test system as an example to illustrate this embodiment and the following embodiments.
[0052] Based on this, an embodiment of the present application provides a flow stability test method, which is applied to a flow stability test system, wherein the flow stability test system comprises: a network packet processing module, a switch to be tested, and a network card, wherein the network card is used to connect the switch to be tested with the network packet processing module; Figure 1 , Figure 1 This is a flow chart of the first embodiment of the flow stability testing method of the present application.
[0053] In this embodiment, the flow stability testing method includes steps S10 to S30:
[0054] Step S10: When the traffic stability test function of the switch to be tested is turned on, static link aggregation is configured according to the switch to be tested.
[0055] It should be noted that if Figure 2 As shown, in this step, it is necessary to ensure that the switch to be tested has turned on the traffic stability test function. Subsequently, the system will connect the switch through the G6 interface and configure static link aggregation. In addition, it should be noted that static link aggregation is a technology that combines multiple physical links into one logical link to improve the reliability and bandwidth of the network. In this embodiment, static link aggregation is used to simulate and test the traffic stability of m-lag. The static link aggregation protocol can merge multiple physical links between switches into a logical link with higher bandwidth. At the same time, when one of the links fails, it will automatically guide the traffic to be transmitted from other links, which plays a role in link redundancy and effectively prevents the occurrence of network failures.
[0056] In a feasible implementation manner, the step S10 specifically includes:
[0057] Step A10: When the flow stability test function of the switch to be tested is turned on, the first switch and the second switch are configured as multi-chassis link aggregation, and the interface connecting the first interactive machine and the second interactive machine is set as a link detection interface.
[0058] It should be noted that if Figure 2 As shown, in this step, the system ensures that the traffic stability test function of the switch to be tested is turned on. Then, through the network management tool or command line interface, the first switch (SW1) and the second switch (SW2) are configured to m-lag mode. It can be understood that the role of this step is to establish a redundant connection between the two switches to improve the reliability and availability of the network. When configuring m-lag, one or more interfaces need to be specially designated as link detection interfaces. In this embodiment, an interface (such as the G3 port) between the first switch and the second switch is selected as the link detection interface. The role of the link detection interface is to monitor the status of the m-lag link. Once a link failure is detected, the switching mechanism of m-lag will be triggered to ensure the continuity and stability of the traffic.
[0059] Step A20: setting the interfaces of the first switch and the second switch connected to the third switch and the fourth switch respectively as downlink interfaces to complete the static link aggregation configuration of the switch to be tested.
[0060] It should be noted that after completing the m-lag configuration, the interfaces of the first switch and the second switch connected to the third switch and the fourth switch, respectively, need to be set as the downlink interfaces. It can be understood that the role of this step is to establish a connection between m-lag and the external network and ensure that the traffic can be correctly transmitted through these interfaces. Specifically, the interfaces (such as G1 port and G4 port) of the first switch connected to the third switch and the fourth switch and the interfaces (such as G2 port and G5 port) of the second switch connected to the third switch and the fourth switch are designated as downlink interfaces. In addition, it should be noted that the downlink interface refers to the interface through which m-lag communicates with the external network. In the m-lag configuration, the role of the downlink interface is to forward the traffic inside m-lag to the external network, or to receive traffic from the external network and forward it to the inside of m-lag. By correctly configuring the downlink interface, the system can ensure smooth communication between m-lag and the external network, thereby achieving efficient transmission and redundant protection of traffic.
[0061] Step S20: testing the test line in the static link aggregation based on the network packet processing module to obtain the transfer time and traffic growth rate.
[0062] It should be noted that if Figure 2As shown, in this step, the network packet processing module constructs UDP traffic packets through the scapy module therein, and uses network card A to send these traffic packets. At the same time, the threading module is used to open the thread pool to concurrently execute the test tasks in a multi-threaded manner, and the packet receiving situation of the test line is monitored in real time to obtain the transfer time and traffic growth rate of the test line. In addition, it should be noted that the transfer time refers to the time required for the traffic packet to be completely transferred from one line to another. The traffic growth rate refers to the rate of change of the number of traffic packets received per second on the test line after the line is switched or a certain line is closed.
[0063] In addition, it should be noted that the network packet processing module also includes: (1) paramiko module, which is generally used for remote SSH connection. In this embodiment, the paramiko module is used to connect to the switch command line through network card B. This allows the automated test script to remotely configure the switch, such as setting manual static link aggregation, performing port shutdown operations, etc., without the need for manual intervention in the switch configuration, thereby improving the test efficiency and automation level. (2) opepyxl module, which is generally used to process Excel type files. In this embodiment, the openpyxl module is used to record key data in the test process, such as the number of packets received for each comparison, whether the test passed, and other information. These data are saved in an Excel spreadsheet to facilitate subsequent troubleshooting and data analysis. By automatically recording and saving test data, the test efficiency and accuracy can be further improved. (3) The time module provides various time-related functions. In this embodiment, the time module is used for timing functions, especially for recording the transfer time during the traffic switching process.
[0064] Step S30: determining the traffic stability of the static link aggregation according to the transfer time and the traffic growth rate.
[0065] It should be noted that the transfer time and the traffic growth rate are only two indicators for evaluating traffic stability. In practical applications, other indicators can be added or the thresholds of existing indicators can be adjusted according to specific needs to more comprehensively evaluate the traffic stability of m-lag. At the same time, the automated testing method in this embodiment is not only applicable to the traffic stability test of m-lag, but can also be extended to traffic testing scenarios of other network devices. Specifically, in this step, the system will judge whether the speed of traffic conversion is normal based on the transfer time. If the transfer time exceeds a certain threshold, it means that the switching speed of m-lag is not fast enough and the traffic stability is poor. Similarly, if the traffic change before and after the switch is large (i.e., the traffic growth rate), it means that the traffic stability after the switch is poor.
[0066] In a feasible implementation manner, the step S30 specifically includes:
[0067] Step S301: When the transfer time is less than or equal to the preset transfer time or the absolute value of the flow rate increase is less than or equal to the preset flow fluctuation threshold, determine that the flow of the current test line is stable, and record the number of times the flow of the current test line is stable.
[0068] It should be noted that after the thread pool executes the port closing operation, it will monitor the packet receiving situation of the receiving end (such as the G4 and G5 ports of SW4). If it is detected that the time for the packet receiving port to transfer from one line to another (i.e., the transfer time) is less than or equal to the preset transfer time threshold (e.g., 1.5 seconds), and the absolute value of the traffic growth rate before and after the transfer (i.e., the absolute value of the change in the number of packets received per second) is less than or equal to the preset traffic fluctuation threshold, then the traffic of the current test line is considered to be stable. At this time, the system will record a traffic stabilization event and accumulate the number of traffic stabilization events. For example, during a test, the thread monitored that after closing the G4 port, the packet receiving situation quickly transferred from the G4 port to the G5 port, and the transfer time was only 1.3 seconds. At the same time, the absolute value of the traffic growth rate before and after the transfer remained within the preset threshold (e.g., 5%). Therefore, it is judged that the traffic of the current test line is stable and a stabilization event is recorded.
[0069] In addition, it should be noted that the preset transfer time is set based on the switching speed of m-lag and the system convergence time to ensure that the line switching is completed and the traffic transfer is detected within a reasonable time. The preset traffic fluctuation threshold is set based on the error of normal line traffic changes to avoid misjudgment caused by normal traffic fluctuations.
[0070] Step S302: When the transfer time is greater than the preset transfer time or the absolute value of the flow rate increase is greater than the preset flow fluctuation threshold, it is determined that the flow of the current test line is unstable, and the number of times the flow of the current test line is unstable is recorded.
[0071] It should be noted that, similarly, if the detected transfer time is greater than the preset transfer time threshold, or the absolute value of the traffic growth rate before and after the transfer exceeds the preset traffic fluctuation threshold, the traffic of the current test line is considered unstable. At this time, the system will record a traffic instability event and accumulate the number of traffic instability events. It is understandable that traffic instability may be caused by a variety of reasons, such as network failure, poor link quality, or hardware failure. By recording unstable events, data support can be provided for subsequent problem investigation and repair.
[0072] Step S303: Determine the traffic stability of the static link aggregation according to the number of traffic stability times and the number of traffic instability times.
[0073] It should be noted that after completing a series of tests, the system will count the number of stable traffic times and the number of unstable traffic times. If the number of stable traffic times accounts for a large proportion and the number of unstable traffic times is small, it can be considered that the traffic stability of the static link aggregation is good. On the contrary, if the number of unstable times is large, it is necessary to further analyze the cause of the problem and take corresponding repair measures. In addition, it should be noted that the judgment criteria for traffic stability can be adjusted according to actual business needs. For example, in some scenarios with extremely high requirements for business continuity, even a few unstable events may be considered unacceptable. Therefore, in actual applications, it is necessary to set reasonable judgment criteria and thresholds based on specific scenarios and needs.
[0074] In a feasible implementation manner, the step S303 specifically includes:
[0075] Step B10: Obtaining a flow stability probability according to the flow stability times and the flow instability times.
[0076] It should be noted that in this step, the system will count the number of stable traffic times (denoted as N_stable) and the number of unstable traffic times (denoted as N_unstable) during the entire test cycle. If the number of received packets after switching maintains a similar growth trend to the initial number of received packets (for example, the increase or decrease does not exceed a certain threshold), the traffic is considered stable; otherwise, it is considered unstable. Based on the statistically obtained number of stable and unstable traffic times, the system will calculate the probability of stable traffic P_stable, and the calculation formula is: P_stable = N_stable / (N_stable+N_unstable). This probability value reflects the relative frequency of stable traffic during multiple line switches.
[0077] Step B20: When the traffic stability probability is greater than a preset traffic stability probability, determining that the traffic stability of the static link aggregation is normal.
[0078] It should be noted that the system will obtain a preset traffic stability probability threshold, which can be determined according to the needs of the actual application scenario, and it reflects the expected level of traffic stability. For example, the system will set the preset traffic stability probability threshold to 0.9, which means that there is at least a 90% probability that the line traffic before and after the switch will remain stable. In this step, the system will compare the calculated traffic stability probability with the preset traffic stability probability threshold. If the traffic stability probability is greater than the preset threshold, it is determined that the traffic stability of the static link aggregation is normal; otherwise, it is considered that the traffic stability is abnormal.
[0079] This embodiment provides a method for testing flow stability, and the method of this embodiment includes: when the flow stability test function of the switch to be tested is turned on, static link aggregation is configured according to the switch to be tested; based on the network packet processing module, the test line in the static link aggregation is tested to obtain the transfer time and flow growth rate; and the flow stability of the static link aggregation is determined according to the transfer time and flow growth rate. In summary, this embodiment realizes the automation of the flow stability test process, simplifies the flow stability test process, and improves the test efficiency by configuring static link aggregation, automatically switching lines, sending flow packets, and monitoring the number of received packets.
[0080] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 3 , Figure 3 This is a flow chart of the second embodiment of the flow stability testing method of the present application, wherein step S20 specifically includes:
[0081] Step S201: determining a line to be tested according to the static link aggregation.
[0082] It should be noted that in this step, the system will use the configured network topology, such as Figure 2 The manual static link aggregation configuration shown in the figure determines the line to be tested (for example, the G4 and G5 ports of the fourth switch SW4, which are connected to different m-lag paths respectively). In addition, it should be noted that static link aggregation is a technology that bundles multiple physical interfaces into one logical interface to improve the reliability and bandwidth of the network. In this embodiment, it is used to build an m-lag environment to ensure that traffic can be evenly distributed on two paths.
[0083] Step S202: Open a thread pool according to the network packet processing module and send a traffic packet to the test line, the thread pool including a first thread, a second thread and a third thread.
[0084] It should be noted that in this step, the system will use Python's threading module to open the thread pool, and construct a UDP traffic packet through the scapy module for sending. The thread pool includes the first thread, the second thread and the third thread, which each undertakes different tasks. Specifically, the first thread uses the time module to assist in timing and records the time during the normal test process, such as the time when the fault simulation starts, the time when the transfer is completed, etc.; the second thread is responsible for closing the specified port to simulate the fault scenario and trigger the switching mechanism of m-lag; the third thread is responsible for continuously monitoring and recording the packet receiving situation of the interface of the test line (such as G4 and G5) every second.
[0085] Step S203: after detecting the traffic packet of the test line, performing a fault simulation test on the test line according to the first thread, the second thread and the third thread to obtain a transfer time and a traffic growth rate.
[0086] It should be noted that in this step, when the third thread detects the traffic packet of the test line, it starts to perform the fault simulation test. Specifically, the second thread will close the port on a route according to the preset random simulation strategy based on the packet receiving situation recorded by the third thread to simulate the link failure. At this time, the m-lag mechanism will trigger the switch and transfer the traffic to another path. The third thread will continue to monitor and record the packet receiving situation after the transfer (i.e., the traffic growth rate), and the first thread will record the transfer time.
[0087] In a feasible implementation manner, the step S203 specifically includes:
[0088] Step C10: after detecting the traffic packets of the test line, counting the number of received traffic packets of the test line according to the third thread.
[0089] It should be noted that in this step, the system will ensure that the test environment has been completed according to the configuration, that is, the UDP traffic packet has been sent through network card A, and the first thread, second thread and third thread applied by network card A are all in working state. When the third thread detects the traffic packet on the test line, it will start to count the number of received packets of these traffic packets. It can be understood that the role of this step is to provide benchmark data for subsequent line fault simulations, to ensure that the changes in traffic growth rate can be compared before and after the fault simulation, so as to judge the stability of traffic.
[0090] Step C20: performing line fault simulation according to the second thread and the number of received packets, and recording the transfer time during the line fault simulation according to the first thread.
[0091] It should be noted that in this step, after the third thread counts the number of received packets, the second thread will select a route with a large number of received packets for fault simulation according to the preset fault simulation strategy. The specific operation of the fault simulation is to connect to the command line of the switch and execute the shutdown command to close the specified port, thereby simulating a line failure. At the same time, the first thread will be responsible for recording the time from the occurrence of the fault to the transfer of traffic to another line, that is, the transfer time. For example, suppose that the third thread counts that the number of UDP traffic packets received by the G4 port of SW4 per second is 1000 / second, while the G5 port is 800 / second. At this time, the second thread will select the G4 port for fault simulation and close the G4 port by executing the shutdown command. The first thread will record the time difference from the closure of the G4 port to the start of the G5 port receiving the traffic packets originally received by the G4 port, that is, the transfer time.
[0092] Step C30: Repeat the line fault simulation according to the preset test time and the preset time interval to obtain the flow rate growth rate after each fault simulation.
[0093] It should be noted that in order to fully evaluate the traffic stability of m-lag, it is necessary to repeat the line fault simulation according to the preset test time and time interval. Each fault simulation will record the transfer time and the traffic growth rate after switching, and save these data in an Excel file for subsequent analysis. In addition, it should be noted that the predicted test time and the preset time interval can be set according to actual needs, such as lasting for one hour and performing a fault simulation every 5 minutes or 10 minutes. For example, under the condition that the preset test time is one hour and the preset time interval is 5 minutes, the system will automatically perform a line fault simulation every 5 minutes, and record each transfer time and the traffic growth rate after switching. These data will be saved in an Excel spreadsheet for subsequent data analysis and troubleshooting.
[0094] In a feasible implementation manner, the step of simulating a line fault according to the second thread and the number of received packets includes steps D10 to D20:
[0095] Step D10: Obtain the packet receiving threshold of the test line.
[0096] It should be noted that the packet receiving threshold is a reference value used to determine whether the flow of the test line is normal, so as to determine whether to continue the fault simulation. In this embodiment, the number of packets received by at least one port in the test line is greater than or equal to the packet receiving threshold before the system continues the fault simulation.
[0097] Step D20: When the number of received packets is greater than or equal to the packet receiving threshold, one of the test lines is selected as a simulated fault line according to a preset random simulation strategy, and the simulated fault line is closed according to the second thread to perform line fault simulation.
[0098] It should be noted that when the third thread detects that the number of packets received by a certain port reaches or exceeds the packet receiving threshold, it will select a line with a larger flow rate in the test line as a simulated fault line according to the preset random simulation strategy. It can be understood that the preset random simulation strategy is to randomly select a route with a larger number of packets for fault simulation to ensure the randomness and comprehensiveness of the test. Once the simulated fault line is determined, the second thread will close the designated port of the line according to the command line instruction to simulate the line failure.
[0099] In this embodiment, by determining the line to be tested and using different threads in the thread pool to send traffic packets, count the number of received packets and simulate line failures, automated testing of m-lag traffic stability is achieved. It can be executed efficiently at a fixed time and point without human intervention. At the same time, it can accurately record the transfer time during line failure simulation and monitor the traffic growth rate to judge the traffic stability, effectively improving the test efficiency and accuracy of traffic stability.
[0100] This application also provides a flow stability test device, please refer to Figure 4 , the flow stability testing device comprises:
[0101] A link configuration module 10, configured to configure static link aggregation according to the switch to be tested when the traffic stability test function of the switch to be tested is turned on;
[0102] A simulation test module 20, configured to test the test line in the static link aggregation based on the network packet processing module to obtain the transfer time and flow rate growth rate;
[0103] The performance testing module 30 is used to determine the traffic stability of the static link aggregation according to the transfer time and the traffic growth rate.
[0104] The flow stability test device provided by the present application adopts the flow stability test method in the above embodiment, which can solve the technical problem of how to simplify the test process of flow stability and improve the test efficiency. Compared with the prior art, the beneficial effects of the flow stability test device provided by the present application are the same as the beneficial effects of the flow stability test method provided by the above embodiment, and the other technical features in the flow stability test device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0105] In one embodiment, the link configuration module 10 is further used to configure the first switch and the second switch as multi-chassis link aggregation when the traffic stability test function of the switch to be tested is turned on, and set the interface connecting the first interactive machine and the second interactive machine as a link detection interface; set the interfaces connecting the first switch and the second switch to the third switch and the fourth switch respectively as lower connection ports to complete the static link aggregation configuration of the switch to be tested.
[0106] In one embodiment, the simulation test module 20 is also used to determine the line to be tested based on the static link aggregation; open a thread pool according to the network packet processing module and send traffic packets to the test line, the thread pool includes a first thread, a second thread and a third thread; after detecting the traffic packet of the test line, perform a fault simulation test on the test line according to the first thread, the second thread and the third thread to obtain the transfer time and traffic growth rate.
[0107] In one embodiment, the simulation test module 20 is also used to count the number of received traffic packets of the test line according to the third thread after detecting the traffic packets of the test line; perform line fault simulation according to the second thread and the number of received packets, and record the transfer time during the line fault simulation according to the first thread; repeat the line fault simulation according to the preset test time and the preset time interval to obtain the traffic growth rate after each fault simulation.
[0108] In one embodiment, the simulation test module 20 is also used to obtain the packet receiving threshold of the test line; when the number of received packets is greater than or equal to the packet receiving threshold, one of the test lines is selected as a simulated fault line according to a preset random simulation strategy, and the simulated fault line is closed according to the second thread to perform a line fault simulation.
[0109] In one embodiment, the performance testing module 30 is also used to determine that the traffic of the current test line is stable and record the number of traffic stabilization times of the current test line when the transfer time is less than or equal to the preset transfer time or the absolute value of the traffic growth rate is less than or equal to the preset traffic fluctuation threshold; determine that the traffic of the current test line is unstable and record the number of traffic instability times of the current test line when the transfer time is greater than the preset transfer time or the absolute value of the traffic growth rate is greater than the preset traffic fluctuation threshold; determine the traffic stability of the static link aggregation based on the number of traffic stabilization times and the number of traffic instability times.
[0110] In one embodiment, the performance testing module 30 is further used to obtain a flow stability probability based on the flow stability times and the flow instability times; when the flow stability probability is greater than a preset flow stability probability, it is determined that the flow stability of the static link aggregation is normal.
[0111] The present application provides a flow stability testing device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the flow stability testing method in the above-mentioned embodiment one.
[0112] Reference below Figure 5 , which shows a schematic diagram of the structure of a flow stability test device suitable for implementing the embodiment of the present application. The flow stability test device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The flow stability testing device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0113] like Figure 5 As shown, the flow stability test device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the flow stability test device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the flow stability test device to communicate wirelessly or wired with other devices to exchange data. Although the flow stability test device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided alternatively.
[0114] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0115] The flow stability test device provided by the present application adopts the flow stability test method in the above embodiment, which can solve the technical problem of how to simplify the test process of flow stability and improve the test efficiency. Compared with the prior art, the beneficial effects of the flow stability test device provided by the present application are the same as the beneficial effects of the flow stability test method provided by the above embodiment, and the other technical features in the flow stability test device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0116] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0117] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0118] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the flow stability testing method in the above-mentioned embodiment.
[0119] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0120] The computer-readable storage medium may be included in the flow stability testing device; or may exist independently without being assembled into the flow stability testing device.
[0121] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the traffic stability testing device, the traffic stability testing device: when the traffic stability testing function of the switch to be tested is turned on, configures static link aggregation according to the switch to be tested; tests the test line in the static link aggregation based on the network packet processing module to obtain the transfer time and the traffic growth rate; determines the traffic stability of the static link aggregation according to the transfer time and the traffic growth rate.
[0122] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0123] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0124] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0125] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned flow stability test method, and can solve the technical problem of how to simplify the flow stability test process and improve the test efficiency. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the flow stability test method provided by the above-mentioned embodiment, and will not be repeated here.
[0126] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned flow stability testing method when executed by a processor.
[0127] The computer program product provided by this application can solve the technical problem of how to simplify the test process of flow stability and improve the test efficiency. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the flow stability test method provided by the above embodiment, which will not be repeated here.
[0128] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A flow stability testing method, characterized in that: The method is applied to a flow stability test system, which includes: a network packet processing module, a switch to be tested, and a network card, wherein the network card is used to connect the switch to be tested with the network packet processing module; the method includes: When the traffic stability test function of the switch to be tested is turned on, configuring static link aggregation according to the switch to be tested; Testing the test line in the static link aggregation based on the network packet processing module to obtain the transfer time and flow rate increase; The traffic stability of the static link aggregation is determined according to the transfer time and the traffic growth rate.
2. The method according to claim 1, characterized in that The step of testing the test line in the static link aggregation based on the network packet processing module to obtain the transfer time and flow rate increase includes: Determining a line to be tested according to the static link aggregation; Open a thread pool according to the network packet processing module and send a traffic packet to the test line, the thread pool including a first thread, a second thread and a third thread; After detecting the traffic packet of the test line, a fault simulation test is performed on the test line according to the first thread, the second thread and the third thread to obtain the transfer time and the traffic growth rate.
3. The method according to claim 2, characterized in that After detecting the traffic packet of the test line, the step of performing a fault simulation test on the test line according to the first thread, the second thread, and the third thread to obtain the transfer time and the traffic growth rate includes: After detecting the traffic packets of the test line, counting the number of received traffic packets of the test line according to the third thread; Performing a line fault simulation according to the second thread and the number of received packets, and recording a transfer time during the line fault simulation according to the first thread; The line fault simulation is repeated according to the preset test time and the preset time interval to obtain the flow rate growth rate after each fault simulation.
4. The method according to claim 3, characterized in that The step of simulating a line fault according to the second thread and the number of received packets includes: Obtaining a packet receiving threshold of the test line; When the number of received packets is greater than or equal to the packet receiving threshold, one of the test lines is selected as a simulated fault line according to a preset random simulation strategy, and the simulated fault line is closed according to the second thread to perform line fault simulation.
5. The method according to claim 1, characterized in that The step of determining the traffic stability of the static link aggregation according to the transfer time and the traffic growth rate comprises: When the transfer time is less than or equal to the preset transfer time or the absolute value of the flow rate increase is less than or equal to the preset flow fluctuation threshold, it is determined that the flow of the current test line is stable, and the number of times the flow of the current test line is stable is recorded; When the transfer time is greater than the preset transfer time or the absolute value of the flow rate increase is greater than the preset flow rate fluctuation threshold, it is determined that the flow of the current test line is unstable, and the number of times the flow of the current test line is unstable is recorded; The flow stability of the static link aggregation is determined according to the flow stability times and the flow instability times.
6. The method according to claim 5, characterized in that The step of determining the traffic stability of the static link aggregation according to the number of traffic stability times and the number of traffic instability times comprises: Obtaining a flow stability probability according to the flow stability times and the flow instability times; When the traffic stability probability is greater than a preset traffic stability probability, it is determined that the traffic stability of the static link aggregation is normal.
7. The method according to any one of claims 1 to 6, characterized in that The switch to be tested includes a first switch, a second switch, a third switch and a fourth switch. When the traffic stability test function of the switch to be tested is turned on, the step of configuring static link aggregation according to the switch to be tested specifically includes: When the flow stability test function of the switch to be tested is turned on, the first switch and the second switch are configured as a multi-chassis link aggregation, and the interface connecting the first interactive machine and the second interactive machine is set as a link detection interface; The interfaces of the first switch and the second switch connected to the third switch and the fourth switch respectively are set as down-link interfaces to complete the static link aggregation configuration of the switch to be tested.
8. A flow stability testing device, characterized in that: The device comprises: A link configuration module, configured to configure static link aggregation according to the switch to be tested when the traffic stability test function of the switch to be tested is turned on; A simulation test module, used to test the test line in the static link aggregation based on the network packet processing module to obtain the transfer time and traffic growth rate; A performance testing module is used to determine the flow stability of the static link aggregation according to the transfer time and the flow growth rate.
9. A flow stability testing device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the flow stability testing method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the flow stability testing method according to any one of claims 1 to 7 are implemented.