Traffic testing method and device and electronic equipment
By receiving traffic test requests and selecting suitable test equipment using the preset utilization prediction model, the problem of limited traffic size of a single test equipment is solved, which improves the effectiveness of network equipment testing and reduces manual operation costs.
Patent Information
- Application Number
- CN202411954766.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-11
AI Technical Summary
In the prior art, the traffic generated by a single test device is limited and cannot meet the testing needs of network equipment, resulting in poor testing results.
By receiving traffic test requests, the processor performance parameters of multiple available test devices are obtained, the preset utilization prediction model is used to predict, and the available test devices that meet the preset conditions are selected as the target device to conduct traffic testing.
It realizes that the appropriate equipment is automatically selected according to the operation of available test equipment, and jointly generates traffic that meets the testing needs of network equipment, improves the test effect and reduces manual operation costs.
Smart Images

Figure CN119814624A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing technology, and in particular to a flow testing method and device, and electronic equipment. Background Art
[0002] When a network device is used as a device under test, it is usually necessary to perform stress or abnormal traffic testing. At this time, it is necessary to construct traffic or perform message playback operations to perform traffic testing on the device under test. In related technologies, a test device that constructs traffic is usually used to perform traffic testing on network devices. During the specific test, the user and a single test device are bound, and only the user who binds the test device can use the test device. The user then uses the bound single test device to perform traffic testing on the network device. However, during the test using the test device, the traffic generated by a single test device may be limited and cannot meet the test requirements of the network device, resulting in poor testing results for the network device.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.
[0005] The embodiments of the present application provide a flow testing method and device, and an electronic device to improve the testing effect of network equipment.
[0006] An embodiment of the present application provides a traffic testing method, including: receiving a traffic test request, and obtaining processor performance parameters of each available test device among a plurality of available test devices; predicting using a preset utilization prediction model based on the test parameters carried in the traffic test request and the processor performance parameters of each of the available test devices, to obtain a first CPU utilization corresponding to each of the available test devices under the test parameters; selecting the available test device whose first CPU utilization meets preset conditions as a first target device; and using the first target device to perform a traffic test on the network device to be tested.
[0007] In the above implementation, by setting a plurality of available test devices, according to the test parameters carried in the traffic test request and the processor performance parameters of each available test device, a preset utilization prediction model is used to predict, and the first CPU utilization corresponding to each available test device under the test parameters is obtained. In this way, the CPU utilization of each available test device in a specific test scenario can be automatically evaluated to automatically select a suitable available test device, so that one or more test devices can be selected according to the operation status of the available test devices to perform traffic testing at the same time, and each test device can jointly generate traffic that meets the test requirements of the network device to be tested, so as to improve the test effect of the network device to be tested. At the same time, there is no need for manual traffic testing, which can reduce the cost of manual operation.
[0008] Furthermore, the traffic test request is obtained in the following manner: obtaining a traffic replay request; the traffic replay request includes: a data packet storage path, a set number of new connections CPS, a gateway IP to be used by available test equipment, and a network segment for traffic replay; wherein the gateway IP is used to initialize available test equipment; obtaining the average number of packets and the average packet size from the file under the data packet storage path; determining the number of client IPs and the number of server IPs based on the network segment for traffic replay; and using the average number of packets, the average packet size, the set CPS, the number of client IPs, and the number of server IPs as test parameters in the traffic test request.
[0009] In the above implementation, the data packet storage path in the traffic playback request can be used to find the files stored in the path, so that the average number of packets and the average packet size related to the packets can be easily obtained. The network segment of the traffic playback can intuitively reflect the number of client IPs and the number of server IPs, and thus the test parameters used for the traffic test in the traffic test request can be easily obtained.
[0010] Furthermore, the traffic test request also includes: an expected number of cores; the available test device is determined by: obtaining the remaining number of available cores corresponding to a plurality of preset test devices; for each of the test devices, if the remaining number of available cores of the test device is greater than or equal to the expected number of cores and the test device has at least one pair of unused interfaces, the test device is determined as the available test device.
[0011] In the above implementation, by screening the test equipment that meets the requirements as available test equipment according to the expected number of cores set by the user, it can be ensured that the equipment that subsequently participates in the flow test can participate in the test normally, thereby improving the reliability of the flow test.
[0012] Furthermore, the utilization prediction model is obtained in the following manner: obtaining multiple sample data each with a CPU utilization label; the sample data includes: sample test parameters and processor performance parameters of the sample test device; using the sample data to train a preset training model to obtain the utilization prediction model.
[0013] In the above implementation, the model can capture the underlying rules behind the data through the learning process, and learn the relationship between sample test parameters, processor performance parameters of sample test equipment and CPU utilization through the model, so that the utilization prediction model has the ability to infer CPU utilization, so that the utilization prediction model can be used to quickly predict CPU utilization in the future.
[0014] Furthermore, the available test device whose first CPU utilization meets the preset conditions is selected as the first target device, including: for each of the available test devices, when the first CPU utilization of the available test devices is greater than the first set utilization, determining the alternative CPS corresponding to the available test device at the second set utilization; in order of the alternative CPS from large to small, selecting the available test devices corresponding to the first N alternative CPS as the first target device; wherein the sum of the first N alternative CPS is greater than or equal to the set CPS contained in the test parameters; or, in the case that there are available test devices whose first CPU utilization is less than or equal to the first set utilization, randomly selecting the available test device corresponding to the first CPU utilization less than the first set utilization as the first target device.
[0015] In the above implementation, when there is an available test device whose first CPU utilization is less than the first set utilization, it indicates that only a single available test device is needed to meet the flow test requirements. However, when the first CPU utilization is greater than the first set utilization, a single available test device may not be able to meet the flow test requirements. At this time, according to the set CPS requirements of the flow test, it is inferred which available test devices can meet the flow test requirements when the performance of the available test devices is better, and the selected available test devices are used to perform the flow test. In this way, it is possible to adapt to different test scenarios and make full use of the performance of multiple available test devices, thereby improving the overall performance and stability of the flow test.
[0016] Furthermore, determining the alternative CPS corresponding to the available test device at the second set utilization includes: obtaining a pending CPS between the set CPS and the locally pre-configured minimum CPS; predicting through the utilization prediction model according to the pending CPS, the processor performance parameters of the available test device, and other parameters in the test parameters except the set CPS, to obtain a second CPU utilization; when the difference between the second CPU utilization and the second set utilization is within a preset range, determining the pending CPS corresponding to the second CPU utilization as the alternative CPS corresponding to the available test device at the second set utilization.
[0017] Here, other parameters besides the set CPS may include the average number of packets, the average packet size, the number of client IPs, and the number of server IPs.
[0018] Considering that when the CPU utilization of the test equipment is higher than a certain value, the test equipment may experience packet loss, CPS may not meet expectations, etc. In the above implementation, the utilization prediction model can accurately infer the CPS that the test equipment can achieve without affecting the performance of the test equipment, thereby maximizing the use of test equipment resources while ensuring the test effect.
[0019] Furthermore, there are multiple first target devices, and the first target devices are used to perform traffic tests on the network device to be tested, including: initializing each of the first target devices; determining the CPS value to be used for each of the first target devices based on the number of the first target devices, the set CPS and the alternative CPS of each of the first target devices; modifying the CPS value in the configuration information of each of the first target devices to the CPS value to be used; and performing traffic tests on the network device to be tested according to the modified configuration information of each of the first target devices.
[0020] In the above implementation, by automatically modifying the configuration information of the flow test, there is no need to manually configure the test equipment, which can improve the equipment configuration efficiency and reduce the labor cost.
[0021] Furthermore, the traffic testing method also includes: for the first target device that meets the preset fault condition, obtaining the used CPS value in the configuration information of the first target device; the preset fault condition includes: the actual CPU utilization of the first target device is greater than the third set utilization, or the first target device is disconnected; using the used CPS value to replace the set CPS carried in the traffic test request; based on the test parameters carried in the replaced traffic test request and the processor performance parameters of each alternative test device, using a preset utilization prediction model to predict and obtain the third CPU utilization corresponding to each of the alternative test devices under the replaced test parameters; the alternative test device is an available test device other than the first target device; selecting the alternative test device as the second target device according to the third CPU utilization; using the second target device and the first target device that does not meet the preset fault condition to perform a traffic test on the network device to be tested.
[0022] In the above implementation, for the first target device with a fault, an available test device with suitable processor performance is automatically selected from the remaining available test devices for replacement, thereby avoiding abnormal test results caused by the fault of the first target device and ensuring the stability of the flow test.
[0023] An embodiment of the present application provides a flow testing device, including: an acquisition module, used to receive a flow test request, and obtain processor performance parameters of each available test device among a plurality of available test devices; a prediction module, used to predict based on the test parameters carried in the flow test request and the processor performance parameters of each of the available test devices, using a preset utilization prediction model to obtain a first CPU utilization corresponding to each of the available test devices under the test parameters; a selection module, used to select the available test device whose first CPU utilization meets preset conditions as a first target device; and a testing module, used to use the first target device to perform a flow test on the network device to be tested.
[0024] An embodiment of the present application provides an electronic device, including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the above-mentioned flow testing method.
[0025] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:
[0027] Figure 1 is a schematic diagram of a flow rate testing method provided in an embodiment of the present application;
[0028] Figure 2 is a schematic diagram of a flow testing device provided in an embodiment of the present application;
[0029] Figure 3 It is a schematic diagram of an electronic device provided in an embodiment of the present application.
[0030] Reference numerals:
[0031] 1: Acquisition module; 2: Prediction module; 3: Selection module; 4: Test module; 5: Processor; 6: Bus; 7: Memory; 8: Communication interface. DETAILED DESCRIPTION
[0032] In order to be able to understand the features and technical contents of the embodiments of the present application in more detail, the implementation of the embodiments of the present application is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0033] The terms "first", "second", etc. in the specification and claims of the embodiments of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of the present application described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0034] Unless otherwise stated, the term "plurality" means two or more.
[0035] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0036] In some embodiments, the test device is deployed with a network traffic generation tool. Multiple test devices can be set up, all of which are organized into a test device cluster, and the management IP (Internet Protocol), CPU (processor) main frequency, number of CPU cores, interface and other information of all test devices in the test device cluster are recorded in the setting database. The traffic test method of the present application is used to manage the operation of the test device cluster.
[0037] When a user initiates a traffic playback request, the information of each test device in the test device cluster in VMware vCenter Server (the core management component in VMware virtualization environment) is compared with the data recorded in the device database, and the records in the device database are automatically updated. It is worth noting that the test device cluster serves the outside world as a whole, and the user terminal will not communicate with any individual test device in the cluster.
[0038] Exemplarily, the network traffic generation tool deployed by the test device can be TRex. TRex is an open source traffic generation software based on DPDK (a high-performance network driver component). Multiple Linux (an operating system) devices virtualized by VMware ESXi (virtual machines) can be used as test devices.
[0039] Embodiment 1
[0040] The present application provides a flow rate testing method. Figure 1 As shown, Figure 1 The basic flow chart of the flow test method provided in the embodiment of the present application includes:
[0041] Step S101: receiving a traffic test request and obtaining processor performance parameters of each of a plurality of available test devices.
[0042] The processor performance parameters are parameters that can characterize the processor performance, such as CPU main frequency, CPU core number, etc.
[0043] Exemplarily, the processor performance parameters of the available test device may include one or more parameters. For example, only the number of CPU cores of the available test device may be obtained. Another example is that the CPU main frequency and the number of CPU cores of the available test device may be obtained.
[0044] In some examples, the condition for determining whether the test device is an available test device may include: whether the test device has at least one CPU core and at least one pair of interfaces. If the test device has at least one CPU core and at least one pair of interfaces, the test device is an available test device.
[0045] The test parameters carried in the traffic test request may include: average number of packets, average packet size, set CPS, number of client IPs, number of server IPs, etc.
[0046] In some embodiments, the traffic test request is obtained by: obtaining a traffic playback request. The traffic playback request includes: a data packet storage path, a set CPS, a gateway IP to be used by an available test device, and a network segment for traffic playback. The average number of packets and the average packet size are obtained from the file under the data packet storage path; the number of client IPs and the number of server IPs are determined according to the network segment for traffic playback; the average number of packets, the average packet size, the set CPS, the number of client IPs and the number of server IPs are used as test parameters in the traffic test request.
[0047] The gateway IP is used to initialize the available test equipment. The gateway IP includes the client gateway IP and the server gateway IP; the client gateway IP is used to initialize the available test equipment as the client, and the server gateway IP is used to initialize the available test equipment as the server.
[0048] In the case where the same available test device includes a client and a server, the client gateway IP is used to initialize the client in the available test device, and the server gateway IP is used to initialize the server in the available test device.
[0049] In the above embodiment, obtaining the average number of packets and the average packet size from the files under the data packet storage path can be: searching for multiple storage files under the data packet storage path; obtaining the number of packets of the packets stored in each storage file, and calculating the average of each packet number as the average number of packets; obtaining the packet size of the packets stored in each storage file, and calculating the average of each packet size as the average packet size.
[0050] The message size may refer to the length of a data packet in the message.
[0051] In the above embodiment, the network segment used for traffic playback includes the client network segment and the server network segment. The number of IP addresses contained in the client network segment is determined as the number of client IPs; the number of IP addresses contained in the server network segment is determined as the number of server IPs.
[0052] Exemplarily, a user transmits a traffic playback request to an electronic device (e.g., a master device) that manages a cluster of test devices. The traffic playback request carries parameters such as the data packet storage path (pcap), the set CPS, the gateway IP to be used by the available test devices, and the network segment used for traffic playback. The request proxy module of the electronic device determines the average number of messages, average message size, and other information of the pcap that needs to be replayed through pcap, and then determines the number of client IPs and the number of server IPs through the network segment used for traffic playback. Then the request proxy module sends the average number of messages, average message size, set CPS, number of client IPs, number of server IPs, and other information to the selection module of the electronic device to select the first target device.
[0053] In some embodiments, the traffic test request further includes: an expected number of cores. The available test device is determined by: obtaining the remaining available core numbers corresponding to a plurality of preset test devices; for each test device, if the remaining available core number of the test device is greater than or equal to the expected number of cores and the test device has at least one pair of unused interfaces, the test device is determined as an available test device.
[0054] Exemplarily, assuming that the expected number of cores is 1, a test device in the test device cluster has at least one remaining CPU core and at least one pair of unused interfaces, then the test device is an available test device. The interface refers to a physical or virtual network interface used by the test device to send and receive data packets.
[0055] Step S102, based on the test parameters carried in the traffic test request and the processor performance parameters of each available test device, a preset utilization prediction model is used to perform prediction to obtain a first CPU utilization corresponding to each available test device under the test parameters.
[0056] In some embodiments, the test parameters carried in the traffic test request include: average number of packets, average packet size, set CPS, number of client IPs, and number of server IPs; the processor performance parameters of the available test device include: CPU main frequency and number of CPU cores. Step S102 may include: for each available test device: inputting the average number of packets, average packet size, set CPS, number of client IPs, number of server IPs, CPU main frequency of the available test device, and number of CPU cores of the available test device into a preset utilization prediction model for prediction, and obtaining a first CPU utilization of the available test device.
[0057] In some embodiments, the utilization prediction model is obtained by: obtaining a plurality of sample data each having a CPU utilization label; and using the sample data to train a preset training model to obtain the utilization prediction model.
[0058] The training model may be a linear regression model or a neural network model, which is not limited here.
[0059] The sample data includes: sample test parameters and processor performance parameters of the sample test equipment.
[0060] Optionally, the sample test parameters used to train the utilization prediction model need to be consistent with the parameter types of the test parameters carried in the traffic test request when the test is performed. The processor performance parameters of the sample test equipment used to train the utilization prediction model need to be consistent with the types of processor performance parameters of the available test equipment when the test is performed.
[0061] Exemplarily, when training the utilization prediction model, the sample test parameters include: average number of packets, average packet size, set CPS, number of client IPs, and number of server IPs. When testing, the test parameters carried in the traffic test request also include average number of packets, average packet size, set CPS, number of client IPs, and number of server IPs. When training the utilization prediction model, the processor performance parameters of the sample test equipment include: CPU main frequency and number of CPU cores. During actual testing, the processor performance parameters of the available test equipment that need to be obtained include: CPU main frequency and number of CPU cores.
[0062] In the above embodiment, the user can set the sample average number of messages, sample average message size, sample CPS, sample client IP number, and sample server IP number for the test device, measure the CPU utilization of the test device at this time, and record the relationship between the sample average number of messages, sample average message size, sample CPS, sample client IP number, sample server IP number, sample CPU main frequency, sample CPU core number, and CPU utilization in the training data set, thereby obtaining sample data with a CPU utilization label. Exemplarily, the relationship between the sample average number of messages, sample average message size, sample CPS, sample client IP number, sample server IP number, sample CPU main frequency, sample CPU core number, and CPU utilization is shown in Table 1 below.
[0063] Table 1:
[0064]
[0065] In some embodiments, the training model is a linear regression model; training the preset training model with sample data with CPU utilization labels to obtain a utilization prediction model may include: inputting sample data with CPU utilization labels into the linear regression model for training to obtain a prediction value; calculating using the prediction value according to the loss function to obtain a loss value corresponding to the prediction value; updating the parameters of the linear regression model according to the loss value and a preset optimization algorithm to reach a set number of iterations to obtain a utilization prediction model. In this way, since the CPU utilization of a single test device has a certain linear correlation with the number of messages, message size, CPS, CPU main frequency, number of CPU cores, etc., the accuracy of the prediction can be improved by predicting the CPU utilization of a single test device through training a linear regression model.
[0066] Among them, the mean square error can be used as the loss function, and SGD (stochastic gradient descent) can be used as the optimization algorithm for updating parameters.
[0067] Exemplarily, define a linear regression model Linear(7, 1), Linear(7, 1) means that the input feature is 7-dimensional and the output feature is 1-dimensional. Among them, the 7-dimensional features used in this application are: sample average number of messages, sample average message size, sample CPS, sample client IP number, sample server IP number, sample CPU main frequency and sample CPU core number. Using mean square error as the loss function and SGD (stochastic gradient descent algorithm) as the optimization algorithm, import the training data set into the defined linear regression model, perform a preset number of trainings, and obtain a trained utilization prediction model. Among them, the preset number of times, for example: 1000 times. Specifically, the training data set D, for example: D = {(x 1 ,y 1 ),(x 2 ,y 2 )...(x i ,y i )}, where x is the input feature, y is the output feature, and (xi,yi) represents the i-th sample data in the data set D. Find the optimized function So that f(x i ) and y i The value of is as close as possible. Wherein, w is the first preset weight, b is the second preset weight, j=1,2,3,4...n; n represents the total number of training samples.
[0068] In the above example, we can use the pytorch library to write a training function to find the function that makes f(x i ) and y iThe values of w and b are as close as possible. For example, the model uses torch.nn.Linear, the loss function uses torch.nn.MSELoss, and the optimizer uses torch.optim.SGD. Among them, torch.nn.Linear is used in pytorch to create linear layers, torch.nn.MSELoss is used in pytorch to implement the mean square error loss function, and torch.optim.SGD is used in pytorch to implement the stochastic gradient descent algorithm.
[0069] In some embodiments, after a user initiates a traffic replay request, new data generated during the traffic playback process is collected and added to a training data set, and a new round of model training is triggered using the updated training data set, thereby achieving the effect of continuous training to continuously optimize the utilization prediction model.
[0070] Step S103: Select an available test device whose first CPU utilization meets a preset condition as a first target device.
[0071] In some embodiments, step S103 may include: for each available test device, when the first CPU utilization of the available test devices is greater than the first set utilization, determining the alternative CPS corresponding to the available test device at the second set utilization; in order of the alternative CPS from large to small, selecting the available test devices corresponding to the first N alternative CPS as the first target device; wherein the sum of the first N alternative CPS is greater than or equal to the set CPS; or, in the case that there are available test devices whose first CPU utilization is less than or equal to the first set utilization, randomly selecting an available test device corresponding to the first CPU utilization less than the first set utilization as the first target device.
[0072] In this way, when the sum of the current N candidate CPSs is greater than or equal to the set CPS, the available test equipment corresponding to the candidate CPS can meet the flow test requirements without affecting the performance of the equipment when the available test equipment is used to perform flow testing together.
[0073] In some examples, the first set utilization is greater than the second set utilization. For example, the difference between the first set utilization and the second set utilization is a preset value.
[0074] In some embodiments, the first set utilization rate and the second set utilization rate can both be set according to expert experience. The setting criteria of the first set utilization rate and the second set utilization rate can be: if the test device will experience packet loss when the utilization rate is higher than the candidate CPU utilization rate, then the candidate CPU utilization rate is set to the first set utilization rate or the second set utilization rate.
[0075] Exemplarily, the first set utilization rate may be equal to the second set utilization rate, for example, the first set utilization rate and the second set utilization rate are both 70%.
[0076] In the above embodiment, for a single available test device, determining the alternative CPS corresponding to the available test device at the second set utilization rate can be: obtaining a pending CPS between the set CPS and the locally pre-configured minimum CPS; using the pending CPS, the CPU main frequency corresponding to the available test device, the number of CPU cores corresponding to the available test device, the average number of packets, the average packet size, the number of client IPs, and the number of server IPs to perform prediction using a utilization prediction model to obtain the second CPU utilization rate; when the difference between the second CPU utilization rate and the second set utilization rate is within a preset range, determining the pending CPS corresponding to the second CPU utilization rate as the alternative CPS corresponding to the available test device at the second set utilization rate.
[0077] Among them, the locally pre-configured minimum CPS is smaller than the set CPS. The minimum CPS can be pre-configured in the traffic test script of the master control device and can be set according to expert experience.
[0078] The process of predicting the second CPU utilization is similar to the process of predicting the first CPU utilization, and will not be described in detail here. Since it is not necessarily possible to find a second CPU utilization that is exactly equal to the second set utilization, when the second CPU utilization is within the preset range of the second set utilization, the pending CPS corresponding to the second CPU utilization can be determined as the candidate CPS corresponding to the second set utilization, so that the candidate CPS corresponding to the second set utilization can be determined more flexibly.
[0079] Exemplarily, step 1, obtain the middle value or average value between the set CPS and the pre-configured minimum CPS as the pending CPS. Step 2, use the pending CPS, the CPU main frequency corresponding to the available test equipment, the number of CPU cores corresponding to the available test equipment, the average number of packets, the average packet size, the number of client IPs, and the number of server IPs to use the utilization prediction model to predict and obtain the second CPU utilization. Step 3, when the second CPU utilization is higher than the second set utilization, select the value between the pending CPS and the pre-configured minimum CPS as the new pending CPS; when the second CPU utilization is lower than the second set utilization, select the value between the pending CPS and the set CPS as the new pending CPS. Repeat steps 2 and 3 until the difference between the second CPU utilization and the second set utilization is within a preset range. In this way, by means of dichotomy, the alternative CPS corresponding to the available test equipment at the second set utilization can be found more quickly.
[0080] Step S104: Utilize the first target device to perform a traffic test on the network device to be tested.
[0081] In some embodiments, if there is only one first target device, step S104 may be: initializing each first target device; starting the first target device, and modifying the CPS value in the configuration information of the first target device to the set CPS value; performing a traffic test on the network device to be tested according to the modified configuration information.
[0082] In some embodiments, there are multiple first target devices, and step S104 may be: initialize each first target device; determine the CPS value to be used for each first target device based on the number of first target devices, the set CPS and the alternative CPS of each first target device; start each first target device, and modify the CPS value in the configuration information of each first target device to the corresponding CPS value to be used; and perform traffic testing on the network device to be tested according to the modified configuration information.
[0083] In the above embodiment, initializing each first target device may include: generating a configuration file for each first target device; and configuring port information for each first target device.
[0084] Generating the configuration file of each first target device may include: obtaining parameters to be configured; unbinding the interface, and filling in the parameters to be configured according to the set configuration format, and obtaining a YAML (a highly readable format for expressing data serialization) format file as the configuration file. The parameters to be configured include: interface name, pci value (product compatibility identifier), streaming IP, gateway, MAC value (unique identifier of network device), and ID (identity identification number) of the CPU core to be used.
[0085] It is worth noting that the IP addresses of different test devices are different.
[0086] Configuring the port information of each first target device may be automatically configuring VLAN information (virtual local area network information) of the interface of each test device.
[0087] Exemplarily, the PCI value (Peripheral Component Interconnect standard) of the test device is obtained, and the network adapter related to the PCI value of the test device is found through the API (Application Programming Interface) of VMware vCenterServer as the network adapter corresponding to the test device, and then a port group with the same VLAN as the test device interface is created through the API, and the network adapter is added to the created port group, thereby setting the VLAN information of the test device interface.
[0088] In the above embodiment, the CPS value to be used of each first target device is determined according to the number of first target devices, the set CPS and the candidate CPS of each first target device, which can be: calculating Obtain the CPS value to be used by the first target device. i ' is the CPS value to be used for the i-th first target device, CPS 设定 is the set CPS, CPS i is the candidate CPS of the i-th first target device, and n is the number of first target devices.
[0089] In some embodiments, after using the first target device to perform a traffic test on the network device to be tested, the method further includes: updating the use status of the first target device in a preset device database as used. The preset device database can record the status information of the test device, and the status information can include: whether the test device is used, the interface status of the test device, the number of available cores of the test device, etc.
[0090] In some embodiments, the flow test method further includes: for a first target device that meets a preset fault condition, obtaining a used CPS value in the flow configuration information of the first target device; using the used CPS value to replace the set CPS carried in the flow test request; according to the test parameters carried in the replaced flow test request and the processor performance parameters of each candidate test device, using a preset utilization prediction model to predict and obtain the third CPU utilization corresponding to each candidate test device under the replaced test parameters. Select the candidate test device as the second target device according to the third CPU utilization; use the second target device and the first target device that does not meet the preset fault condition to perform a flow test on the network device to be tested.
[0091] The fault conditions include: the actual CPU utilization is greater than the third set utilization, or the first target device is disconnected.
[0092] The candidate test device is an available test device other than the first target device.
[0093] Optionally, the third CPU utilization is higher than the first CPU utilization, and the third CPU utilization is higher than the second CPU utilization.
[0094] In the above embodiment, using the second target device and the first target device that does not meet the preset fault condition to perform a flow test on the network device to be tested may include: disabling the first target device that meets the preset fault condition, and enabling the second target device to perform a flow test on the network device to be tested. In this way, since the first target device that does not meet the preset fault condition is originally performing flow testing normally, only the first target device that meets the preset fault condition needs to be disabled, and then the second target device needs to be enabled, so that the device replacement of the first target device with a fault can be achieved, and the fault can be handled conveniently to ensure the stability and high reliability of the flow test.
[0095] Optionally, the process of predicting the third CPU utilization is similar to the process of predicting the first CPU utilization, which is not described in detail here. The process of selecting the second target device is similar to the process of selecting the first target device, which is not described in detail here.
[0096] In some embodiments, the traffic testing method further includes: acquiring and recording the measured CPS value and actual CPU utilization of each first target device at every preset time period.
[0097] In this way, the recorded measured CPS value and actual CPU utilization can be subsequently used as a data set for training the utilization prediction model, which can facilitate continuous training of the utilization prediction model.
[0098] The measured CPS value is a CPS value obtained by actual measurement. The actually measured CPU utilization of each test device that performs the traffic test is taken as the actual CPU utilization.
[0099] Exemplarily, after the flow test begins, the monitoring program is started, and the measured CPS value and actual CPU utilization of each test device performing the flow test are obtained and recorded every preset time period, for example: 5 seconds, and the recorded information can be used as a data set for training the utilization prediction model. At the same time, according to the monitoring results, if the actual CPU utilization of a test device in the test device performing the flow test reaches more than 90%, or a test device cannot be connected, it is considered that there is a device failure. The average number of messages, the average message size, the CPS value used by the faulty test device to make a flow, the number of client IPs, the number of server IPs, the CPU main frequency and the number of CPU cores are used to predict using the preset utilization prediction model to obtain the third CPU utilization corresponding to the remaining available test devices in the test device cluster, and select the second target device from the remaining available test devices in the test device cluster according to the third CPU utilization. If the second target device can be obtained: for the fault situation with high actual CPU utilization, first stop the faulty test device and start the second target device to make a flow. For the fault situation that cannot be connected, directly start the new second target device to make a flow. If no available device is available: For a high actual CPU utilization fault, ignore the fault. For a connection failure, try to start the test device that cannot be connected.
[0100] In some embodiments, the traffic testing method further includes: upon receiving a stop request from a user, deactivating the test device indicated by the stop request, and updating the status information of the test device in the device database.
[0101] Exemplarily, deactivating the test device indicated by the stop request may include: connecting the test device corresponding to the stop request, stopping the test device service of the test device, and deleting a screen (a terminal multiplexing tool) session.
[0102] Exemplarily, the use mark of the test device in the database may be cleared, that is, the use status of the first target device is set to not being used.
[0103] In some embodiments, the network device to be tested may be, for example, a firewall, a NIPS (Network Intrusion Prevention System), etc.
[0104] In summary, the flow rate testing method provided in the embodiment of the present application brings at least the following beneficial effects:
[0105] (1) By establishing a unified management equipment cluster, the utilization rate of equipment is improved and the manual operation cost is reduced through automation;
[0106] (2) The trained prediction model is used to predict the CPU utilization of devices in the cluster under specified test conditions, so that devices can be selected more reasonably and the device resources can be used to the maximum extent while ensuring the test results.
[0107] (3) Distributed traffic testing is implemented, fully utilizing the performance of multiple devices in the cluster and improving overall performance and stability;
[0108] (4) Through failover technology, cluster devices are dynamically scheduled to ensure the stability and high reliability of the test.
[0109] Embodiment 2
[0110] Based on the same inventive concept, the present application embodiment provides a flow testing device, such as Figure 2 As shown, the flow test device includes: an acquisition module 1, a prediction module 2, a selection module 3 and a test module 4. Among them, the acquisition module 1 is used to receive a flow test request and obtain the processor performance parameters of each available test device among multiple available test devices; the prediction module 2 is used to predict the test parameters carried in the flow test request and the processor performance parameters of each available test device using a preset utilization prediction model to obtain the first CPU utilization corresponding to each available test device under the test parameters; the selection module 3 is used to select an available test device whose first CPU utilization meets the preset conditions as the first target device; the test module 4 is used to use the first target device to perform a flow test on the network device to be tested.
[0111] In some embodiments, the traffic testing device also includes: a request proxy module, which is used to obtain a traffic test request in the following manner: obtain a traffic replay request; the traffic replay request includes: a data packet storage path, a set number of new connections CPS, a gateway IP to be used by available test equipment, and a network segment for traffic replay; wherein the gateway IP is used to initialize available test equipment; obtain the average number of packets and the average packet size from the file under the data packet storage path; determine the number of client IPs and the number of server IPs based on the network segment used for traffic replay; and use the average number of packets, the average packet size, the set CPS, the number of client IPs and the number of server IPs as test parameters in the traffic test request.
[0112] In some embodiments, the traffic test request also includes: the expected number of cores; the selection module 3 is also used to determine the available test devices in the following manner: obtaining the remaining number of available cores corresponding to a plurality of preset test devices; for each test device, if the remaining number of available cores of the test device is greater than or equal to the expected number of cores and the test device has at least one pair of unused interfaces, the test device is determined as an available test device.
[0113] In some embodiments, the traffic testing device also includes: a model training module, which is used to obtain a utilization prediction model in the following manner: obtaining multiple sample data each with a CPU utilization label; the sample data includes: sample test parameters and processor performance parameters of the sample test equipment; using the sample data to train a preset training model to obtain a utilization prediction model.
[0114] In some embodiments, the selection module 3 is used to select an available test device whose first CPU utilization meets a preset condition as a first target device in the following manner: for each available test device, when the first CPU utilization of the available test device is greater than the first set utilization, determine the alternative CPS corresponding to the available test device at the second set utilization; in order of the alternative CPS from large to small, select the available test devices corresponding to the first N alternative CPS as the first target device; wherein the sum of the first N alternative CPS is greater than or equal to the set CPS contained in the test parameters; or, in the case that there is an available test device whose first CPU utilization is less than or equal to the first set utilization, randomly select an available test device corresponding to the first CPU utilization less than the first set utilization as the first target device.
[0115] In some embodiments, the selection module 3 is used to determine the alternative CPS corresponding to the available test device at the second set utilization in the following manner: obtain a pending CPS between the set CPS and the locally pre-configured minimum CPS; based on the pending CPS, the processor performance parameters of the available test device, and other parameters in the test parameters except the set CPS, predict through the utilization prediction model to obtain the second CPU utilization; when the difference between the second CPU utilization and the second set utilization is within a preset range, determine the pending CPS corresponding to the second CPU utilization as the alternative CPS corresponding to the available test device at the second set utilization.
[0116] In some embodiments, there are multiple first target devices, and the test module 4 is used to perform a traffic test on the network device to be tested using the first target devices in the following manner: initialize each first target device; determine the CPS value to be used for each first target device based on the number of first target devices, the set CPS and the alternative CPS of each first target device; modify the CPS value in the configuration information of each first target device to the CPS value to be used; and perform a traffic test on the network device to be tested according to the modified configuration information of each first target device.
[0117] In some embodiments, the traffic testing device also includes: a fault replacement module, which is used to: for a first target device with a preset fault condition, obtain a used CPS value in the configuration information of the first target device; the preset fault condition includes: the actual CPU utilization is greater than the third set utilization, or the first target device is disconnected; use the used CPS value to replace the set CPS carried in the traffic test request; according to the test parameters carried in the replaced traffic test request and the processor performance parameters of each alternative test device, use a preset utilization prediction model to predict and obtain the third CPU utilization corresponding to each alternative test device; the alternative test device is an available test device other than the first target device; select the alternative test device as the second target device according to the third CPU utilization; use the second target device and the first target device that does not meet the preset fault condition to perform a traffic test on the network device to be tested.
[0118] It can be understood that the various embodiments described in the first embodiment are also applicable to the second embodiment if there is no conflict. Based on the consideration of brevity of description, they will not be repeated here.
[0119] Embodiment 3
[0120] Combination Figure 3 As shown, an embodiment of the present application provides an electronic device, including a processor 5 and a memory 7. Optionally, the device may also include a communication interface 8 and a bus 6. The processor 5, the communication interface 8, and the memory 7 may communicate with each other through the bus 6. The communication interface 8 may be used for information transmission. The processor 5 may call the logic instructions in the memory 7 to execute the flow test method of the above embodiment.
[0121] In addition, the logic instructions in the above-mentioned memory 7 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0122] The memory 7 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present application. The processor 5 executes functional applications and data processing by running the program instructions / modules stored in the memory 7, that is, implementing the flow test method in the above embodiment.
[0123] The memory 7 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 7 may include a high-speed random access memory and may also include a non-volatile memory.
[0124] The electronic device may be a computer or a server, etc.
[0125] An embodiment of the present application provides a storage medium storing computer executable instructions, wherein the computer executable instructions are configured to execute the above-mentioned flow testing method.
[0126] An embodiment of the present application provides a computer program product, which includes a computer program stored on a storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the above-mentioned flow testing method.
[0127] The computer-readable storage medium mentioned above may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0128] The technical solution of the embodiment of the present application can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method of the embodiment of the present application. The aforementioned storage medium can be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., which can store program codes, or a transient storage medium.
[0129] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0130] The embodiments or examples of the present disclosure are not exhaustive, but are only illustrative of some embodiments or examples, and are not intended to be specific limitations on the scope of protection of the present disclosure. In the absence of contradiction, each step in a certain embodiment or example can be implemented as an independent example, and the steps can be combined arbitrarily. For example, the scheme after removing some steps in a certain embodiment or example can also be implemented as an independent example, and the order of the steps in a certain embodiment or example can be arbitrarily exchanged. In addition, the optional methods or optional examples in a certain embodiment or example can be combined arbitrarily; in addition, the various embodiments or examples can be combined arbitrarily, for example, some or all steps of different embodiments or examples can be combined arbitrarily, and a certain embodiment or example can be combined arbitrarily with the optional methods or optional examples of other embodiments or examples.
[0131] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A flow testing method, characterized in that: include: receiving a traffic test request and obtaining processor performance parameters of each of a plurality of available test devices; According to the test parameters carried in the traffic test request and the processor performance parameters of each of the available test devices, a preset utilization prediction model is used to perform prediction to obtain a first CPU utilization corresponding to each of the available test devices under the test parameters; Selecting the available test device whose first CPU utilization meets a preset condition as the first target device; The first target device is used to perform a traffic test on the network device to be tested.
2. The method according to claim 1, characterized in that The traffic test request is obtained in the following way: Obtain a traffic replay request; the traffic replay request includes: a data packet storage path, a set number of new connections CPS, a gateway IP to be used by an available test device, and a network segment for traffic replay; wherein the gateway IP is used to initialize an available test device; Obtaining an average number of packets and an average packet size from files under the data packet storage path; Determine the number of client IPs and server IPs based on the network segment used for traffic playback; The average number of packets, the average packet size, the set CPS, the number of client IPs and the number of server IPs are used as test parameters in the traffic test request.
3. The method according to claim 1, characterized in that The traffic test request also includes: the expected number of cores; the available test equipment is determined by: Get the remaining available core numbers corresponding to the preset multiple test devices respectively; For each of the test devices, if the number of remaining available cores of the test device is greater than or equal to the expected number of cores and the test device has at least one pair of unused interfaces, the test device is determined as the available test device.
4. The method according to claim 1, characterized in that The utilization prediction model is obtained in the following way: Acquire a plurality of sample data each having a CPU utilization tag; the sample data includes: sample test parameters and processor performance parameters of the sample test device; The sample data is used to train a preset training model to obtain the utilization prediction model.
5. The method according to claim 1, characterized in that Selecting the available test device whose first CPU utilization meets a preset condition as a first target device includes: For each of the available test devices, when the first CPU utilization of the available test devices is greater than the first set utilization, determine the alternative CPS corresponding to the available test device at the second set utilization; in descending order of the alternative CPS, select the available test devices corresponding to the first N alternative CPS as the first target device; wherein the sum of the first N alternative CPS is greater than or equal to the set CPS contained in the test parameters; or, In the case that there is an available test device whose first CPU utilization is less than or equal to a first set utilization, the available test device corresponding to the first CPU utilization less than the first set utilization is randomly selected as the first target device.
6. The method according to claim 5, characterized in that Determining the candidate CPS corresponding to the available test equipment at the second set utilization rate includes: Obtaining a pending CPS between the set CPS and a locally pre-configured minimum CPS; According to the undetermined CPS, the processor performance parameters of the available test device, and other parameters of the test parameters except the set CPS, the utilization prediction model is used to predict and obtain a second CPU utilization; When the difference between the second CPU utilization and the second set utilization is within a preset range, the undetermined CPS corresponding to the second CPU utilization is determined as the candidate CPS corresponding to the available test device at the second set utilization.
7. The method according to claim 5, characterized in that There are multiple first target devices, and using the first target devices to perform a traffic test on the network device to be tested includes: Initializing each of the first target devices; Determine a CPS value to be used for each of the first target devices according to the number of the first target devices, the set CPS, and the candidate CPS of each of the first target devices; Modify the CPS value in the configuration information of each of the first target devices to the CPS value to be used; A flow test is performed on the network device to be tested according to the modified configuration information of each first target device.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: For the first target device that meets a preset fault condition, obtaining a used CPS value in the configuration information of the first target device; the preset fault condition includes: an actual CPU utilization rate of the first target device is greater than a third set utilization rate, or the first target device is disconnected; Replacing the set CPS carried in the traffic test request with the used CPS value; According to the test parameters carried in the replaced traffic test request and the processor performance parameters of each candidate test device, a preset utilization prediction model is used to perform prediction to obtain a third CPU utilization corresponding to each candidate test device under the replaced test parameters; the candidate test device is an available test device other than the first target device; Selecting the candidate test device as the second target device according to the third CPU utilization; A flow test is performed on the network device to be tested by using the second target device and the first target device that does not meet the preset fault condition.
9. A flow testing device, characterized in that: include: An acquisition module, used for receiving a traffic test request and acquiring a processor performance parameter of each of a plurality of available test devices; A prediction module, configured to predict, based on the test parameters carried in the traffic test request and the processor performance parameters of each of the available test devices, using a preset utilization prediction model to obtain a first CPU utilization corresponding to each of the available test devices under the test parameters; A selection module, configured to select the available test device whose first CPU utilization meets a preset condition as a first target device; The testing module is used to use the first target device to perform a flow test on the network device to be tested.
10. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the flow testing method according to any one of claims 1 to 8.