Network traffic generation method and device, equipment and storage medium
By identifying and copying network data packets in the switch and combining reprocessing operations, the problem of low flexibility in network traffic generation in the prior art is solved, and the effect of high load performance testing and reducing test costs is achieved.
Patent Information
- Application Number
- CN202411684199.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-22
AI Technical Summary
The existing network traffic generation methods are not flexible enough to quickly adapt to the needs of different test scenarios.
By receiving network messages in the switch, identifying the target network packet to be copied, and copying them using a preset multicast processing mechanism to obtain multiple network packet copies. In combination with the reprocessing operation, the data packet copy is injected into the switch's data processing entrance, and replicated and allocated to the output port again.
It realizes high-load performance testing under the limited number of ports, reduces testing costs, improves the flexibility and applicability of network traffic generation, and enhances the convenience of performance testing.
Smart Images

Figure CN119520403A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing and cloud network technology, and in particular to a network traffic generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] In the performance test of network equipment, it is usually necessary to generate high traffic load to evaluate the processing capacity and stability of the equipment. Regarding the generation of network traffic, professional test equipment is usually used to generate a large amount of network traffic. However, these test equipment are usually expensive, and the number of ports limits the maximum amount of traffic that can be generated. In addition, in the process of generating network traffic, complex configuration is often required, and it is impossible to quickly generate network traffic suitable for different test scenarios.
[0003] It can be seen that the existing network traffic generation method has the problem of low generation flexibility. Summary of the invention
[0004] Based on this, it is necessary to provide a network traffic generation method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve the flexibility of network traffic generation in response to the above technical problems.
[0005] In a first aspect, the present application provides a network traffic generation method, which is applied to a switch, and the method includes:
[0006] Receiving a network message, the network message includes a plurality of network data packets;
[0007] When a target network data packet to be copied is identified from a plurality of network data packets, for each target network data packet, copy processing is performed on the target network data packet through a preset multicast processing mechanism to obtain a plurality of first network data packet copies of the target network data packet;
[0008] In the case where it is determined that the first network data packet copy needs to be reprocessed, reprocessing the first network data packet copy to inject the first network data packet copy into the data processing entrance of the switch;
[0009] In the case where it is determined that the first network data packet copy needs to be copied, the first network data packet copy is copied based on a preset multicast processing mechanism to obtain multiple second network data packet copies of the first network data packet copy;
[0010] The plurality of second network data packet copies are distributed to corresponding switch output ports and forwarded to the target network device.
[0011] In one embodiment, duplicating the target network data packet through a preset multicast processing mechanism to obtain multiple first network data packet copies of the target network data packet includes:
[0012] Determine the number of available ports on the switch;
[0013] Based on the number of available ports and a preset multicast processing mechanism, the target network data packet is copied and processed to obtain multiple first network data packet copies of the target network data packet, and the number of the first network data packet copies is proportional to the number of available ports.
[0014] In one embodiment, determining the number of available ports of a switch includes:
[0015] Get the current network status;
[0016] Based on the network status, determine the number of available ports on the switch.
[0017] In one embodiment, identifying a target network data packet to be copied from a plurality of network data packets includes:
[0018] Parse the header information of each network data packet to obtain the header parsing result;
[0019] Based on the packet header parsing result, determine whether the network data packet needs to be copied.
[0020] In one embodiment, determining whether a network data packet needs to be copied based on a packet header parsing result includes:
[0021] When the packet header analysis result indicates that there are target traffic features that need to be copied in the network data packet, it is determined that the network data packet needs to be copied;
[0022] Target traffic characteristics include target source address, destination address or protocol type.
[0023] In one embodiment, reprocessing the first network data packet copy includes:
[0024] In the case where it is determined that the header information of the first network data packet copy needs to be modified, modifying the header information of the first network data packet copy;
[0025] The modified copy of the first network data packet is reprocessed.
[0026] In a second aspect, the present application also provides a network traffic generation device, including:
[0027] A data packet receiving module, used for receiving a network message sent by a test device, wherein the network message includes a plurality of network data packets;
[0028] A multicast processing module, for, when a target network data packet to be copied is identified from a plurality of network data packets, for each target network data packet, copying the target network data packet through a preset multicast processing mechanism to obtain a plurality of first network data packet copies of the target network data packet; when it is determined that the first network data packet copy needs to be copied, copying the first network data packet copy based on the preset multicast processing mechanism to obtain a plurality of second network data packet copies of the first network data packet copy;
[0029] A reprocessing module, configured to, when determining that the first network data packet copy needs to be reprocessed, perform a reprocessing operation on the first network data packet copy so as to inject the first network data packet copy into a data processing inlet of the switch;
[0030] The data packet forwarding module is used to distribute multiple second network data packet copies to corresponding switch output ports and forward them to the target network device.
[0031] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in any one of the above-mentioned network traffic generation method embodiments when executing the computer program.
[0032] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in any one of the above-mentioned network traffic generation method embodiments are implemented.
[0033] In a fifth aspect, the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps in any one of the above-mentioned network traffic generation method embodiments.
[0034] The above-mentioned network traffic generation method, device, computer equipment, computer-readable storage medium and computer program product are different from the traditional method of using professional testing equipment to generate network traffic. The target network data packet to be copied is identified from the network data packet, and the target network data packet is copied and processed using a multicast processing mechanism to obtain multiple first network data packet copies of the target network data packet. In combination with the reprocessing operation, the first network data packet copy is injected into the corresponding switch input port, and then the data packet is copied and processed again through the multicast processing mechanism to obtain multiple second network data packet copies of the first network data packet copy. Finally, the multiple second network data packet copies are distributed to the corresponding switch output ports and forwarded to the target network device to facilitate performance testing of high-concurrency network devices. Therefore, compared with the method of using multiple professional test devices to generate network traffic, the network traffic generation method of the present application, on the one hand, generates network traffic through a multicast processing mechanism and heavy operations, and can perform high-load performance testing even when the number of ports is limited; on the other hand, there is no need to add more test equipment or more advanced equipment to increase the number of ports and enhance testing capabilities, which greatly reduces the overall cost of performance testing of network equipment; on the other hand, the multicast processing mechanism can be adjusted according to different test scenarios and requirements, thereby improving the flexibility and applicability of network traffic generation, and further improving the convenience of performance testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 A schematic diagram of a flow chart of a method for generating network traffic in one embodiment;
[0037] Figure 2 It is a flowchart of a method for generating network traffic in another embodiment;
[0038] Figure 3 It is a flowchart of a method for generating network traffic in another embodiment;
[0039] Figure 4 A schematic diagram of a flow chart of a method for generating network traffic in a detailed embodiment;
[0040] Figure 5 is a structural block diagram of a network traffic generating device in one embodiment;
[0041] Figure 6FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0043] The network traffic generation method provided in the embodiment of the present application can be applied to a switch. The switch is connected to an input port and an output port of a target network device.
[0044] In this embodiment, the switch is a programmable network switch that allows the use of the P4 programming language to define and implement specific network data plane functions. The target network device can be a dedicated hardware device that connects various servers, PCs, application terminals and other nodes to form an information communication network, including but not limited to switches, routers, firewalls, bridges, hubs, gateways, VPN servers, network interface cards (NICs), wireless access points (WAPs), modems, 5G base stations, optical terminals and optical transceivers, etc.
[0045] P4 (Programming Protocol-independent Packet Processors): is a domain-specific language (DSL) designed specifically for programming network devices, allowing developers to define how data packets are processed.
[0046] In an exemplary embodiment, Figure 2 As shown, a network traffic generation method is provided, and the method is applied to Figure 1 The switch 102 in FIG. 1 is used as an example to illustrate the invention, which includes the following S100 to S400. Among them:
[0047] S100, receiving a network message, where the network message includes a plurality of network data packets.
[0048] In this embodiment, a Tofino switch is used as an example for description. The Tofino switch is a high-performance, fully programmable network processor designed by Barefoot Networks. It supports the P4 programming language to define and implement specific network functions.
[0049] In actual applications, the Tofino switch receives network messages in the network. The network messages can be randomly generated by the test tool and sent to the Tofino switch, or sent by other devices in the network.
[0050] S200, when a target network data packet to be copied is identified from multiple network data packets, for each target network data packet, the target network data packet is copied through a preset multicast processing mechanism to obtain multiple first network data packet copies of the target network data packet.
[0051] Among them, the multicast processing mechanism (Multicast) is a function defined in the Tofino switch, which is used to copy a data packet into multiple copies and distribute them to different output ports.
[0052] In practical applications, the Tofino switch can be programmed based on the P4 language to implement a multicast processing mechanism. Specifically, after identifying the target network data packet to be processed, the replication rules of the target network data packet (such as the number of copies and the content of the copies) and the port allocation rules of the replicated network data packet are defined. For the identification of the target network data packet, it can be based on the test requirements of the performance test of the network device, determine the characteristics of the network data packet used for the performance test, and set the identification rules of the destination data to be copied according to the characteristics. Exemplarily, the performance test of the network device may include a throughput test, a delay test, a packet loss rate test, or a concurrent connection number test. Different test requirements may have different requirements for the content of the data packet. For example, in the throughput test, the main focus is on the amount of data between the sender and the receiver. Then the identification rule for the target network data packet may be that the target network data packet meets the preset fixed data packet size (such as 64 bytes, etc.); if it is a delay test, it can be considered to generate data packets of different sizes to detect the delay performance of the network device when processing data packets of different sizes. The identification rule of the target network data packet may include different data packet sizes.
[0053] Therefore, after the Tofino switch obtains multiple network data packets, after identifying the target network data packet that needs to be amplified from the multiple network data packets, it performs replication processing according to the replication rule of the target network data packet in the preset multicast processing mechanism to obtain multiple copies of the target network data packet. Exemplarily, in the replication rule, the number of replications is set to the number of ports of the switch. If the number of ports of the switch is 32, then one target network data packet passes through the multicast processing mechanism to obtain 32 copies of the first network data packet. During the replication process, a replication marker is added to the first network data packet copy obtained by replication to distinguish the original data packet from the replicated data packet.
[0054] S300, when it is determined that the first network data packet copy needs to be reprocessed, reprocess the first network data packet copy to inject the first network data packet copy into the data processing entrance of the switch.
[0055] Recirculate refers to the operation of sending the partially processed network data packets that have entered the switch processor back to the starting stage of the processor for secondary processing. The data processing entrance is also the entrance of the data plane. The data plane of the switch is mainly responsible for processing and forwarding various types of data.
[0056] In practical applications, the triggering conditions of the reprocessing operation of the switch can be pre-programmed, such as the data packet carries a copy marker, and the number of reprocessing operations does not reach the reprocessing number threshold. Therefore, after obtaining the first network data packet copy carrying the copy marker, according to the copy marker and the current number of reprocessing operations, when it is determined that the first network data packet copy needs to be reprocessed, the reprocessing operation condition is triggered, the reprocessing operation function is called, and these first network data packet copies are sent to the Recirculate queue, so that the switch injects the first network data packet copies into the data plane inlet of the processor of the switch.
[0057] S400, when it is determined that the first network data packet copy needs to be copied, the first network data packet copy is copied based on a preset multicast processing mechanism to obtain multiple second network data packet copies of the first network data packet copy.
[0058] In actual applications, after the first network data packet copy is re-injected into the data plane inlet through a reprocessing operation, the multiple copied first network data packet copies can be used as a newly received network data packet, and the multiple first network data packet copies can be identified again according to the preset target network data packet identification rules. In the case where it is determined that the first network data packet copy also meets the identification conditions of the target network, it is characterized that the first network data packet copy needs to be copied, and the first network data packet copy is copied according to the data packet copy rules in the preset multicast processing mechanism to obtain multiple second network data packet copies. Exemplarily, 32 copies of the first network data packet are copied again through a reprocessing operation to obtain 32*32=1024 copies of the second network data packet.
[0059] S500, distribute multiple second network data packet copies to corresponding switch output ports, and forward them to the target network device.
[0060] In actual applications, in the preset multicast processing mechanism, a port allocation rule for the replicated network data packet is defined. Specifically, the port allocation rule specifies the output port of the switch corresponding to the second network data packet copy.
[0061] After obtaining multiple copies of the second network data packet, the multiple copies of the second network data packet are distributed to the output ports of the corresponding switches, and forwarded to the target network devices (such as the network devices to be tested for performance) connected to the Tofino switch through the output ports. Thus, different numbers of copies of the second network data packet can be sent to multiple different target network devices at the same time according to different ports.
[0062] In the above network traffic generation method, different from the traditional method of using professional test equipment to generate network traffic, by identifying the target network data packet to be copied from the network data packet, using the multicast processing mechanism to copy the target network data packet, obtaining multiple first network data packet copies of the target network data packet, combining with the reprocessing operation, injecting the first network data packet copy into the corresponding switch input port, and then copying the data packet again through the multicast processing mechanism to obtain multiple second network data packet copies of the first network data packet copy, and finally allocating the multiple second network data packet copies to the corresponding switch output port, forwarding to the target network device, so as to facilitate the performance test of the high-concurrency network device. Therefore, compared with the method of using multiple professional test equipment to generate network traffic, the network traffic generation method of the present application, on the one hand, generates network traffic through the multicast processing mechanism and reoperation, and can perform high-load performance testing even when the number of ports is limited; on the other hand, there is no need to add more test equipment or more advanced equipment to increase the number of ports and strengthen the test capability, which greatly reduces the overall cost of the performance test of the network device; on the other hand, the multicast processing mechanism can be adjusted according to different test scenarios and requirements, which improves the flexibility and applicability of network traffic generation, and further improves the convenience of performance testing.
[0063] In order to improve the generation efficiency of network traffic, in an exemplary embodiment, Figure 2 As shown, the target network data packet is copied and processed by a preset multicast processing mechanism to obtain multiple first network data packet copies of the target network data packet, including S220 to S240. Among them:
[0064] S220, determine the number of available ports of the switch.
[0065] In actual applications, the number of available ports of the switch can be queried through the command line interface of the switch.
[0066] S240, based on the number of available ports and a preset multicast processing mechanism, the target network data packet is replicated to obtain multiple first network data packet copies of the target network data packet, and the number of the first network data packet copies is proportional to the number of available ports.
[0067] In practical applications, multicast groups can be set through the P4 language according to the number of available ports, and each multicast group corresponds to a set of specified output ports. The multicast processing mechanism performs replication processing according to the multicast group to obtain network data packet copies that are proportional to the number of available ports in the multicast group. For example, if the switch has 32 available ports, a multicast group can be set to correspond to 32 ports. After identifying the data packet to be replicated, according to the set multicast group, a network data packet will be replicated into 32 copies, and each network data packet copy will be assigned to a unique output port. These copies will be sent to the corresponding ports in parallel to prepare for the subsequent reprocessing process. This process is efficient because all copies are generated almost simultaneously, ensuring extremely low latency and high throughput.
[0068] In this embodiment, the target network data packet is replicated through the number of available ports of the switch and a preset multicast processing mechanism to obtain multiple copies of the first network data packet that are proportional to the number of available ports, thereby achieving flexible replication of the target data packet, reducing network latency, and improving network throughput.
[0069] In order to improve the real-time adaptability of network traffic generation, in an exemplary embodiment, S220 also includes S222 to S224. Among them:
[0070] S222, obtaining the current network status.
[0071] S224, determining the number of available ports of the switch based on the network status.
[0072] In practical applications, the current network status can be obtained through built-in statistics tables, monitoring the traffic of each port, etc. After obtaining the traffic of each port, the number of available ports of the switch can be determined according to the traffic of different ports, so as to dynamically adjust the switch port corresponding to the multicast group to realize the dynamic adjustment of the replication strategy of the network data packet.
[0073] In this embodiment, the number of available ports of the switch is determined according to the current network status, which is conducive to adjusting the processing method of the target data packet in real time according to the change of the network status, and improves the real-time adaptability of network traffic generation.
[0074] In an exemplary embodiment, identifying a target network data packet to be copied from a plurality of network data packets includes S260 to S280. In which:
[0075] S260, parsing the packet header information of each network data packet to obtain the packet header parsing result.
[0076] S280: Determine whether the network data packet needs to be copied based on the packet header parsing result.
[0077] In actual applications, after the switch receives multiple network data packets, these network data packets enter the entrance of the data plane, and pass through the pre-defined data packet header structure, such as including multiple header fields (destination address, source address, total length, lifetime and protocol type, etc.). The data packet is parsed by the parser, and the fields in the data packet header are extracted to obtain the packet header parsing results.
[0078] According to the performance test requirements, the target packet header field can be set to exist in the switch table, such as a specified destination IP (Internet Protocol) address, a specified protocol type (such as TCP protocol). After obtaining the packet header parsing results, the packet header parsing results of multiple network data packets are matched through table search, and based on the matching results, it is determined that the network data packet needs to be copied.
[0079] In this embodiment, the packet header information in the network data packet is parsed through the data packet screening mechanism to determine the network data packet that needs to be copied, so as to facilitate targeted traffic amplification, which is conducive to improving the flexibility of network traffic generation.
[0080] In order to improve the effectiveness of network traffic generation, in an exemplary embodiment, Figure 4 As shown, S280 includes S282. Among them:
[0081] S282, when the packet header parsing result indicates that there are target traffic features that need to be copied in the network data packet, determine that the network data packet needs to be copied, and the target traffic features include a target source address, a destination address or a protocol type.
[0082] In practical applications, the target traffic characteristics can be determined according to the requirements of the performance test. For example, if the test requirement is to evaluate the performance of the network device when processing traffic of different protocols, the specific protocol type can be specified in the target traffic characteristics;
[0083] In this embodiment, by designing target traffic characteristics, screening is performed before the network data packets are copied and processed. The target traffic characteristics can be set according to different performance test requirements, so that traffic amplification can be performed in a targeted manner, thereby improving the flexibility of network traffic generation.
[0084] In an exemplary embodiment, reprocessing the first network data packet copy includes S320 to S340.
[0085] S320: When it is determined that the header information of the copy of the first network data packet needs to be modified, modify the header information of the copy of the first network data packet.
[0086] In actual applications, it can be that according to the test requirements, in the process of copying the first network data packet copy, a header modification mark is added to the first network data packet copy, and then, after the first network data packet copy is injected into the data plane entrance through reprocessing, the header information of the first network data packet copy is parsed. If the header modification mark is identified, it indicates that the header information needs to be modified to meet the test requirements, and the header information of the first network data packet copy is modified according to the header modification logic corresponding to the header modification mark. Exemplarily, in the test scenario involving load sharing such as ECMP (Equal-cost multi-path routing), it is necessary to modify the src_port (source port) or dst_port (destination port) in the header for copy processing to ensure that the hash algorithm can produce different results, thereby ensuring effective simulation of the load sharing test scenario.
[0087] S340: reprocess the modified copy of the first network data packet.
[0088] In actual applications, the first network data packet copy with modified header information is re-injected into the processing entrance so that after obtaining the first network data packet copy with modified header information, based on the copy marker and the current number of reprocessing operations, when it is determined that the modified first network data packet copy needs to be reprocessed, the reprocessing operation condition is triggered, the reprocessing operation function is called, and these modified first network data packet copies are sent to the Recirculate queue, so that the switch injects the first network data packet copy into the data plane entrance of the switch's processor.
[0089] In this embodiment, by modifying the packet header information of the network data packet copy and then performing a reprocessing operation, a corresponding network data packet copy can be adaptively generated according to the needs of different test scenarios, which is beneficial to improving the flexibility of traffic generation.
[0090] In order to make a clearer description of the network traffic generation method provided by the present application, the following is a specific embodiment and the attached Figure 4 To illustrate, this specific embodiment includes the following steps:
[0091] S1, receiving a network message, the network message includes a plurality of network data packets.
[0092] S2, parse the header information of each network data packet to obtain the header parsing result. When the header parsing result indicates that there are target traffic features that need to be copied in the network data packet, determine that the network data needs to be copied. The target traffic features include the target source address, destination address or protocol type.
[0093] S3, obtain the current network status, determine the number of available ports of the switch based on the network status, copy and process the target network data packet based on the number of available ports and a preset multicast processing mechanism, and obtain multiple first network data packet copies of the target network data packet, and the number of first network data packet copies is proportional to the number of available ports.
[0094] S4, when it is determined that the header information of the first network data packet copy needs to be modified, modify the header information of the first network data packet copy, and reprocess the modified first network data packet copy to inject the modified first network data packet copy into the data processing entrance of the switch.
[0095] S5, when it is determined that the modified first network data packet copy needs to be copied, the modified first network data packet copy is copied based on a preset multicast processing mechanism to obtain multiple second network data packet copies of the first network data packet copy.
[0096] S6, allocating multiple copies of the second network data packet to corresponding switch output ports, and forwarding them to the target network device.
[0097] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0098] In an exemplary embodiment, Figure 5 As shown, a network traffic generation device 600 is provided, comprising: a data packet receiving module 610, a multicast processing module 620, a reprocessing module 630 and a data packet forwarding module 640, wherein:
[0099] The data packet receiving module 610 is used to receive a network message, where the network message includes a plurality of network data packets.
[0100] The multicast processing module 620 is used to, when a target network data packet to be copied is identified from multiple network data packets, copy the target network data packet for each target network data packet through a preset multicast processing mechanism to obtain multiple first network data packet copies of the target network data packet; when it is determined that the first network data packet copy needs to be copied, copy the first network data packet copy based on the preset multicast processing mechanism to obtain multiple second network data packet copies of the first network data packet copy.
[0101] The reprocessing module 630 is used to reprocess the first network data packet copy when it is determined that the first network data packet copy needs to be reprocessed, so as to inject the first network data packet copy into the data processing entrance of the switch.
[0102] The data packet forwarding module 640 is used to distribute the multiple second network data packet copies to the corresponding switch output ports and forward them to the target network device.
[0103] In an exemplary embodiment, the multicast processing module 620 is also used to determine the number of available ports of the switch; based on the number of available ports and a preset multicast processing mechanism, the target network data packet is replicated to obtain multiple first network data packet copies of the target network data packet, and the number of first network data packet copies is proportional to the number of available ports.
[0104] In an exemplary embodiment, the multicast processing module 620 is further configured to obtain the current network status; and determine the number of available ports of the switch based on the network status.
[0105] In an exemplary embodiment, the network traffic generating device 600 further includes a target network data packet identification module 650 for parsing the header information of each network data packet to obtain a header parsing result; based on the header parsing result, determining whether the network data packet needs to be copied.
[0106] In an exemplary embodiment, the target network data packet identification module 650 is also used to determine that network data needs to be copied when the packet header parsing result indicates that there are target traffic characteristics that need to be copied in the network data packet; the target traffic characteristics include the target source address, destination address or protocol type.
[0107] In an exemplary embodiment, the multicast processing module 620 is further configured to modify the header information of the first network data packet copy if it is determined that the header information of the first network data packet copy needs to be modified;
[0108] The reprocessing module 630 is further configured to reprocess the modified copy of the first network data packet.
[0109] Each module in the network traffic generating device 600 can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0110] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a network traffic generation method is implemented.
[0111] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0112] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps in any one of the above-mentioned network traffic generation method embodiments are implemented.
[0113] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in any one of the above-mentioned network traffic generation method embodiments are implemented.
[0114] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in any one of the above network traffic generation method embodiments when executed by a processor.
[0115] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0116] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0117] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0118] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A network traffic generation method, characterized in that: Applied to a switch, the method comprises: Receiving a network message, wherein the network message includes a plurality of network data packets; When a target network data packet to be copied is identified from the plurality of network data packets, for each of the target network data packets, the target network data packet is copied by a preset multicast processing mechanism to obtain a plurality of first network data packet copies of the target network data packet; In the case where it is determined that the first network data packet copy needs to be reprocessed, reprocessing the first network data packet copy to inject the first network data packet copy into the data processing entrance of the switch; In the case where it is determined that the first network data packet copy needs to be copied, the first network data packet copy is copied based on a preset multicast processing mechanism to obtain multiple second network data packet copies of the first network data packet copy; The plurality of copies of the second network data packet are distributed to corresponding switch output ports and forwarded to the target network device.
2. The method according to claim 1, characterized in that The method of duplicating the target network data packet by a preset multicast processing mechanism to obtain a plurality of first network data packet copies of the target network data packet includes: Determining the number of available ports of the switch; The target network data packet is copied based on the number of available ports and a preset multicast processing mechanism to obtain multiple first network data packet copies of the target network data packet, and the number of the first network data packet copies is proportional to the number of available ports.
3. The method according to claim 2, characterized in that Determining the number of available ports of the switch includes: Get the current network status; Based on the network status, the number of available ports of the switch is determined.
4. The method according to claim 1, characterized in that: Identifying a target network data packet to be copied from the plurality of network data packets includes: Parsing the packet header information of each of the network data packets to obtain a packet header parsing result; Based on the packet header parsing result, determine whether the network data packet needs to be copied.
5. The method according to claim 4, characterized in that The determining whether the network data packet needs to be copied based on the packet header parsing result includes: When the packet header analysis result indicates that there are target traffic features to be copied in the network data packet, determining that the network data packet needs to be copied; The target traffic characteristics include a target source address, a destination address or a protocol type.
6. The method according to any one of claims 1 to 5, characterized in that: The reprocessing operation on the first network data packet copy includes: In the case where it is determined that the header information of the first network data packet copy needs to be modified, modifying the header information of the first network data packet copy; The modified copy of the first network data packet is reprocessed.
7. A network traffic generation device, characterized in that: The device comprises: A data packet receiving module, used for receiving a network message sent by a test device, wherein the network message includes a plurality of network data packets; A multicast processing module, for, when a target network data packet to be copied is identified from a plurality of the network data packets, for each of the target network data packets, copying the target network data packet through a preset multicast processing mechanism to obtain a plurality of first network data packet copies of the target network data packet; when it is determined that the first network data packet copy needs to be copied, copying the first network data packet copy based on a preset multicast processing mechanism to obtain a plurality of second network data packet copies of the first network data packet copy; a reprocessing module, configured to, when determining that the first network data packet copy needs to be reprocessed, reprocess the first network data packet copy to inject the first network data packet copy into a data processing inlet of the switch; The data packet forwarding module is used to distribute multiple copies of the second network data packet to corresponding switch output ports and forward them to the target network device.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Data stream amplification method and device, convergence diverter and storage medium
CN113489652A
Multicasting within a distributed control plane of a switch
US20120069842A1
Generating high-speed test traffic in a network switch
US20170366442A1
Reprogramming multicast replication using real-time buffer feedback
US20210320887A1