A method and system for realizing combined simulation of network impairments
Through the combined simulation method of network damage, the combined processing of network damage functions is solved, and the inefficiency problem in traditional methods is achieved, and more efficient and accurate network damage simulation is achieved.
Patent Information
- Application Number
- CN202311777845.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-21
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2043-12-21
AI Technical Summary
Traditional network damage simulation methods are inefficient, logical conflicts and waste of resources due to serial execution, which cannot meet the needs of high throughput and low latency network testing.
A method for combinatorial simulation of network damage is proposed. By acquiring network flow and damage requirements, splitting the damage function, analyzing the feasibility of serial and parallel combinations, generating a combinatorial strategy, and optimizing parallel combinations, building a parallel diagram of network damage combinations for simulation.
On the premise of ensuring the correctness of the damage function logic, the combined processing delay and deployment overhead of the damage function are significantly optimized, and the efficiency and accuracy of network damage simulation are improved.
Smart Images

Figure CN117749637B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network impairment simulation, and particularly to a method and system for realizing combined network impairment simulation. Background Art
[0002] The statements in this section merely mention the background art related to the present invention and do not necessarily constitute prior art.
[0003] Network impairment simulation and emulation can provide technical support for network research, optimization, and operation and maintenance. Therefore, it is widely applied in the academic and industrial fields such as network protocol optimization verification, network device performance analysis, network fault location and troubleshooting, and network system reliability assessment.
[0004] Traditional network impairment simulation methods usually execute each impairment function serially, which limits the efficiency and accuracy of impairment simulation. With the growth and increasing complexity of network communication, network research engineers need more efficient impairment simulation methods to meet the growing high-speed network test requirements.
[0005] The network impairment simulation methods in the prior art have the following limitations:
[0006] (1) There are logical conflicts between different network impairment modules. For example, the packet loss impairment module changes the number of data packets, and if it is before the packet tampering module, it will affect the impairment accuracy of the latter.
[0007] (2) The serial execution of network impairments wrongly leads to waste of device hardware resources. For example, the implementation of the packet loss impairment logic means that there may be no need for additional computing resources to execute other impairment modules.
[0008] (3) Network impairments usually have time constraints, and the serial execution of network impairment functions cannot meet the strict delay limits of per-packet forwarding under high throughput. Summary of the Invention
[0009] To solve the deficiencies of the prior art, the present invention provides a method and system for realizing combined network impairment simulation; the present invention can more effectively simulate complex network conditions while ensuring the logical correctness of network impairment functions, and improve efficiency and reduce overhead. On the premise of ensuring the logical correctness of impairment functions, the combined processing delay and deployment overhead of impairment functions are significantly optimized.
[0010] On the one hand, a method for realizing combined network impairment simulation is provided, including:
[0011] Obtain a network flow and query the network impairment requirements of the network flow;
[0012] Split the network damage requirements into several damage functions, analyze the feasibility of serial combination and parallel combination of damage functions, and generate a combination strategy;
[0013] Check whether there are optimizable parallel combinations in the combination strategy, optimize the optimizable parallel combinations, and obtain the optimized combination strategy;
[0014] Construct a network damage combination parallel graph according to the optimized combination strategy; perform network damage simulation according to the network damage combination parallel graph.
[0015] On the other hand, a network damage combination simulation implementation system is provided, including:
[0016] An acquisition module, which is configured to: acquire network traffic and query the network damage requirements of the network traffic;
[0017] A strategy generation module, which is configured to: split the network damage requirements into several damage functions, analyze the feasibility of serial combination and parallel combination of damage functions, and generate a combination strategy;
[0018] An optimization module, which is configured to: check whether there are optimizable parallel combinations in the combination strategy, optimize the optimizable parallel combinations, and obtain the optimized combination strategy;
[0019] A damage simulation module, which is configured to: construct a network damage combination parallel graph according to the optimized combination strategy; perform network damage simulation according to the network damage combination parallel graph.
[0020] On yet another aspect, an electronic device is further provided, including:
[0021] A memory for non-temporarily storing computer-readable instructions; and
[0022] A processor for running the computer-readable instructions,
[0023] wherein, when the computer-readable instructions are run by the processor, the method described in the first aspect above is executed.
[0024] On yet another aspect, a storage medium is further provided, which non-temporarily stores computer-readable instructions, wherein when the non-temporary computer-readable instructions are executed by a computer, the instructions for executing the method described in the first aspect are executed.
[0025] On yet another aspect, a computer program product is further provided, including a computer program, and the computer program is used to implement the method described in the first aspect above when running on one or more processors.
[0026] The above technical solutions have the following advantages or beneficial effects:
[0027] The present invention can more effectively simulate complex network conditions while ensuring the logical correctness of the network impairment function, and improve efficiency and reduce overhead. On the premise of ensuring the logical correctness of the impairment function, the serial-parallel combination processing delay and deployment overhead of the impairment function are significantly optimized. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings forming a part of this specification are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention.
[0029] Figure 1 It is a flowchart of the implementation method for network impairment combination provided by the present invention;
[0030] Figure 2 It is a system architecture diagram of network impairment combination provided by the present invention;
[0031] Figures 3(a) to 3(d) It is an example of impairment function;
[0032] Figure 4 It is a parallel diagram of network impairment combination, which is Figures 3(a) to 3(d) an example of impairment function combination in
[0033] Figure 5 It is a flowchart for constructing a network impairment combination service diagram. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0034] It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs.
[0035] Embodiment 1
[0036] This embodiment provides a method for simulating the implementation of network impairment combination;
[0037] A method for simulating the implementation of network impairment combination includes:
[0038] S101: Obtain a network flow and query the network impairment requirements of the network flow;
[0039] S102: Split the network impairment requirements into several impairment functions, analyze the feasibility of serial combination and parallel combination of the impairment functions, and generate a combination strategy;
[0040] S103: Check whether there is an optimizable parallel combination in the combination strategy, optimize the optimizable parallel combination, and obtain an optimized combination strategy;
[0041] S104: Construct a network damage combination parallel graph according to the optimized combination strategy; perform network damage simulation according to the network damage combination parallel graph.
[0042] The present invention is used to simulate various damage conditions in a network to evaluate the functions and performances of network devices and network applications. The conventional organizational execution method of network damage functions is usually serial execution, which limits its performance and scalability. The present invention provides a method for combining network damage (serial combination and parallel combination) to improve the execution efficiency of damage simulation and reduce its deployment cost. The present invention can more effectively simulate complex network conditions on the premise of ensuring the logical correctness of network damage functions, and improve efficiency and reduce overhead.
[0043] Further, the S101: Obtain a network flow and query the network damage requirements of the network flow, specifically including:
[0044] S101-1: Obtain a network flow;
[0045] S101-2: Query and store the network damage requirements of the network flow;
[0046] S101-3: If the target network flow does not contain network damage requirements, directly forward the network flow; if the network flow contains network damage requirements, proceed to the next step S102.
[0047] Further, the S101-2: Query and store the network damage requirements of the target network flow, specifically including:
[0048] Create a damage function operation mapping table; the damage function operation mapping table includes: damage functions and operation domains, as well as the operation domains and operation information of the messages corresponding to the damage functions; store the operation domains and operation information of the damage functions into the damage function operation mapping table; wherein, the damage functions include: packet loss damage, message tampering, out-of-order damage, delay damage or shaping damage; the operation domain refers to the set fields in the message, and the operation information refers to read operation or write operation.
[0049] Table 1 Damage function operation mapping table
[0050]
[0051] Table 1 is the damage function operation mapping table, where R represents read operation and W represents write operation.
[0052] Exemplarily, read the network damage requirements in the network flow and create a mapping table named DFAM (Damage Function Action Map) to store the operation domains and operation information of each damage requirement. The operation domain is a set field in the message, and the operation information values should include read operations and write operations.
[0053] Exemplarily, the network damage requirement refers to: the network flow requires packet loss with a probability of 10% and forwarding with a delay of 10 ms.
[0054] Further, the S102: Split the network damage requirements into several damage functions, analyze the feasibility of serial combination and parallel combination of the damage functions, and generate a combination strategy, which specifically includes:
[0055] S102-1: Decompose the network damage requirements into several damage functions; store the operation domain and operation information of each damage function into the damage function operation mapping table.
[0056] S102-2: Set corresponding rules for each damage function; the corresponding rules include: sequence rules, priority rules, and position rules; directly output the damage functions with priority rules and position rules to the policy set.
[0057] S102-3: For any two damage functions corresponding to the sequence rules, judge whether the result of parallel execution of the two damage functions is the same as the result of serial execution. If the same, it means that the two damage functions are allowed to work in parallel; if different, it means that the two damage functions are not allowed to work in parallel.
[0058] S102-4: After all the damage functions corresponding to the sequence rules are analyzed, execute S103 for the sequence rules that allow parallel work; execute S104 for the sequence rules that do not allow parallel work.
[0059] Further, the S102-1 further includes: Analyze and synthesize the operation domains and operation information of all damage functions to obtain the operation domain and operation information of the current damage function for the message; during the analysis and synthesis process, comprehensively consider the operation domains and operation information of the messages that make up the damage function, where the operation domain is a set field in the message, including: source IP address, destination IP address, and port, and the operation information is the specific execution operation on the operation domain, including read operations and write operations.
[0060] For example, for the packet loss damage, perform a write operation on the Drop operation domain of the data packet to discard it, so corresponding settings need to be made in the damage function operation mapping table DFAM (Table 1) corresponding to this damage function.
[0061] Analysis and synthesis is to make a judgment based on the operation domain field in the hash mapping table, and further change the operation information corresponding to the operation domain. For example, for the packet loss operation, a write operation needs to be performed on the Drop operation domain.
[0062] Further, for the S102-2, the sequential rule. If there are two damage functions DF1 and DF2, and they are executed in the order of first executing the first damage function DF1 and then executing the second damage function DF2, then the rules for the two damage functions DF1 and DF2 are sequential rules.
[0063] DF stands for: Damage Function.
[0064] Exemplarily, the sequential rule Order(DF1,DF2): The sequential rule means that two damage functions are executed in the order of first the damage function DF1 and then the damage function DF2. For example, when the user's damage requirement is "first perform a 10ms delay on the data packet with the destination IP of '10.0.0.1', and then perform a 10% probability of packet loss", after the damage function decomposition and analysis of this damage requirement, the packet loss damage and delay damage are judged for combinability with the sequential rule strategy of Order(Delay,Drop).
[0065] Further, for the S102-2, the priority rule means that when two damage operations in a sequential rule satisfy the premise of allowing both parallel execution and serial execution, then the sequential rule is converted into a priority rule; the principle for assigning priorities is: the priority of the packet loss damage function is higher than the priority of the delay damage function, the priority of the delay damage function is higher than the priority of the out-of-order damage, the priority of the out-of-order damage is higher than the priority of the message tampering damage; the priority of the delay damage is equal to the priority of the shaping damage.
[0066] Exemplarily, the priority rule Priority(DF1,DF2): The priority rule is used to assign priorities to the combinable sequential rule Order. For example, when there is packet loss damage, the operations of other damages will conflict with it in terms of whether there is packet loss. Therefore, a higher priority can be selected for the packet loss damage to avoid waste of computing resources.
[0067] Further, for the S102-1, the location rule means setting the location of the damage function to a specified location. The location rule is custom-added by the administrator.
[0068] Exemplarily, the position rule Position(DF, first / last): When defining network impairments, the user can place the impairment function at a set position according to requirements. However, since the final parallel graph structure of the network impairment combination cannot be determined, the impairment function can only be specified as the first or last one in the parallel graph of the network impairment combination. For example, Position(Delay, first) can be specified to ensure that the packet determines the delay time first, avoiding timeout problems caused by performing other impairments.
[0069] Further, in S102-3: For any two impairment functions corresponding to the sequential rule, determine whether the result of their parallel execution is the same as the result of their sequential execution. If they are the same, it means that the two impairment functions are allowed to work in parallel; if they are different, it means that the two impairment functions are not allowed to work in parallel. Specifically, it includes:
[0070] S102-31: Obtain the two impairment functions in the sequential rule Order(DF1, DF2), and create a damage function action dependency table (DFDT, Damage Function Dependency Table). The damage function action dependency table includes the operation information of each of the two impairment functions and the dependency relationship between the operation information of the two impairment functions. The operation information includes: read operation, write operation, add or delete;
[0071] Table 2 Damage Function Action Dependency Table
[0072]
[0073] Table 2 is the damage function action dependency table, where T1 indicates that parallelism is allowed without copying the data packet, T2 indicates that parallelism is allowed but the data packet needs to be copied, and F indicates that parallelism is not allowed.
[0074] S102-32: From the damage function operation mapping table DFAM, obtain all the operations of the two impairment functions, and then obtain all the action pairs of the two impairment functions (such as the read operation of impairment 1 and the read operation of impairment 2 together form an action pair). Based on the damage function action dependency table DFDT, determine whether the two impairment functions can be combined. When the two impairment functions perform read and write operations on the same field of the same data packet respectively, the two impairment functions cannot be combined; when the two impairment functions perform read and read operations on the same field of the same data packet respectively, the two impairment functions can be combined;
[0075] S102-33: For the cases where the action pair is read-write or write-write, further determine whether the read-write or write-write operations are performed on the same field, that is, check whether the operation domains of the read-write or write-write operations are the same. If they are the same, output that parallel execution or sequential execution is not allowed; if they are different, output that parallel execution or sequential execution is allowed;
[0076] For example, there is a sequential rule Order(Tamper, Drop). For the packet loss damage, the packets with the destination IP of 10.0.0.2 need to be discarded, while for the packet tampering, a write operation needs to be performed on the destination IP. Therefore, the operation domains of the read-write action pairs in this sequential rule are the same, and the two cannot be combined for execution.
[0077] S102-34: Configure the output result into the sequential rule Order(DF1, DF2).
[0078] Further, in step S103: Check whether there is an optimizable parallel combination in the combined policy, and optimize the optimizable parallel combination to obtain an optimized combined policy, which specifically includes:
[0079] Check whether there is an optimizable parallel combination in the combined policy. The check rule is determined according to the damage function action dependency table. When two damage functions perform read operations and write operations on the same field of the same packet respectively, it means that there is no optimizable parallel combination; when two damage functions perform read operations on the same field of the same packet respectively, it means that there is an optimizable parallel combination;
[0080] If there is an optimizable parallel combination, optimize the parallel combination by means of memory reuse or only copying the packet header to obtain an optimized combined policy; if there is no optimizable parallel combination, proceed to S104.
[0081] Further, the so-called memory reuse means that in the case of read and write, it is determined whether it is necessary to copy the packet according to whether the two operations operate on the same packet field:
[0082] If two damage functions read or write different fields of the packet, they are allowed to operate on the same packet copy;
[0083] If two damage functions read or write the same field of the packet, they are not allowed to operate on the same packet copy.
[0084] It should be understood that memory reuse can reduce the necessity of packet copying. It should be noted that when two DFs on two CPU cores operate on the same packet copy at the same time, the data header fields they operate on may be mapped to the same cache line, thus causing cache contention and reducing performance.
[0085] Further, the so-called way of only copying the packet header means that for the damage function combination, only the header of the packet is copied, and it is not necessary to copy the entire packet for operation. Only copying the packet header can save the resources of parallel computing.
[0086] Copying only the header can improve performance and save memory by shortening the length of the memory to be copied. It should be noted that after copying the header, the packet length field of the copied header should be modified to the length of the header itself to ensure that the combined impairment function receives a valid packet.
[0087] Further, in step S103: checking whether there is an optimizable parallel combination in the combination strategy, and optimizing the optimizable parallel combination to obtain an optimized combination strategy, specifically including:
[0088] S103-1: Obtain the order rule Order(DF1, DF2) that allows the combination to work, and analyze the value of the combinable parameter within the order rule. If the value of the combinable parameter is false, directly add the current order rule to the output policy set. If the value of the combinable parameter is true, execute S103-2;
[0089] S103-2: For the order rule that allows the combination to work, execute the impairment function combination optimization algorithm. The input value of the impairment function combination optimization algorithm is the order rule Order(DF1, DF2), and the output values are two states: copying the packet or not copying the packet;
[0090] S103-3: Configure the output result into the order rule in the form of a parameter;
[0091] S103-4: Add the optimized order rule to the output policy set.
[0092] Further, in step S103-2: For the order rule that allows the combination to work, execute the impairment function combination optimization algorithm, which is implemented based on memory reuse, specifically including:
[0093] S103-21: First, update the impairment function action dependency table DFDT, that is, extract two operation pairs and store them in the impairment function action dependency table DFDT;
[0094] If both impairment functions are read operations, do not copy the packet;
[0095] If one of the two impairment functions is a read operation and the other is a write operation, and their operation domains are different, do not copy the packet, otherwise copy the packet;
[0096] If both impairment functions are write operations and their write operation domains are different, do not copy the packet, otherwise copy the packet;
[0097] S103-22: Obtain all operations of two damaged functions from the damaged function operation mapping table DFAM, then obtain all action pairs in the two damaged functions, and determine whether the combination of the two damaged functions can be optimized based on the damaged function action dependency table DFDT:
[0098] When two damaged functions perform read operations and write operations respectively on the same field of the same data packet, the combination cannot be optimized; when two damaged functions perform read operations and read operations respectively on the same field of the same data packet, the combination can be optimized;
[0099] S103-23: Configure the output result into the sequential rule Order(DF1,DF2).
[0100] Furthermore, the S104: Execute network damage simulation according to the optimized combination strategy, specifically including:
[0101] Construct a network damage combination parallel graph according to the optimized combination strategy; perform network damage simulation according to the network damage combination parallel graph.
[0102] Furthermore, the S104: Execute network damage simulation according to the optimized combination strategy, specifically including:
[0103] S104-1: Obtain the output policy set, where the output policy set includes sequential rules, priority rules, and location rules;
[0104] S104-2: Convert the output policy into an intermediate language representation, including two different types:
[0105] For the location rule, maintain the damaged function type and record the location of a single damaged function, for example: string DF_name, int position(first / last).
[0106] For the sequential rule and the priority rule, assign priorities to the damaged functions that can be serially combined or parallel combined, for example string DF_name1(high prio), string DF_name(low prio).
[0107] S104-3: Convert the intermediate language representation into a micro damaged function graph:
[0108] S104-31: First, link multiple non-combinable damaged functions sequentially;
[0109] S104-32: Then, use multiple damaged functions with the same starting action as connection points to connect the intermediate language representations of the damaged functions with the same starting action into the micro damaged function graph;
[0110] Among them, the micro-damage function diagram has three types of structures, including: the micro-damage function diagram of a single damage function, the tree-structure micro-damage function diagram, and the combined planar structure micro-damage function diagram;
[0111] The micro-damage function diagram of a single damage function comes from the damage function included in the position rule or the idle damage function without rule restrictions;
[0112] The tree-structure micro-damage function diagram is composed of multiple non-combinable damage functions; for the tree-structure micro-damage function diagram, check the dependency relationship of the operation pairs among all leaf damage functions with the same root according to the damage function action dependency table to determine whether the leaf damage functions can work in combination;
[0113] For the combined planar structure micro-damage function diagram, check the dependency relationship of all damage function pairs, calculate the number of data packet copies they need, and if there are two damage functions that are executed in parallel, the number of replicated data packets is two;
[0114] S104-33: Finally, generate a micro-damage function diagram without overlapping damage functions;
[0115] S104-4: Combine the micro-damage function diagrams into the final network damage combination parallel diagram:
[0116] S104-41: Place the damage functions assigned by the position rule at the head / tail of the finally generated network damage combination parallel diagram;
[0117] S104-42: Then combine each remaining micro-damage function diagram (including idle damage functions) into one damage function, and check the dependency between every two micro-damage function diagrams to determine their combinability. If two damage functions have sequential dependency, they cannot be executed in parallel; if two damage functions do not have position dependency, sequential dependency or priority dependency, they can be executed in parallel;
[0118] If a dependency relationship is detected between the micro-damage function diagrams, the user further specifies their execution priorities;
[0119] S104-43: Finally, connect the independent micro-damage function diagrams according to position, order or priority to obtain the final network damage combination parallel diagram.
[0120] The present invention discloses a method for realizing combined simulation of network impairments. First, for the packet transfer between multiple impairment functions, the present invention uses a zero-copy packet transfer method. Each impairment function is equipped with a receive ring buffer and a send ring buffer, and these two buffers are stored in a shared memory area. The system allocates a large amount of space for this shared memory area, and all impairment functions can access it. The received packets are also stored in the shared memory, and an impairment function only needs to write the packet reference into the receive ring buffer of other impairment functions to achieve packet transfer. This zero-copy delivery method eliminates the copy overhead of packet merging.
[0121] The present invention deploys a Damage Function Composition (DFC) framework in a network impairment device. When a packet enters the DFC server, it is first classified, and the packet enters the appropriate service graph according to the processing of the packet transfer module. The packet transfer module is implemented using a distributed DFRuntime to efficiently transfer packets in parallel between impairment functions. Finally, multiple copies of the packet are sent to the merge module to generate the final output. These modules can be dynamically configured by a coordinator. The DFC server includes: a packet classification module, a packet transfer module, and a packet merge module;
[0122] Packet classification module: Receives incoming packets from a port and finds the impairment function service graph information corresponding to the packet, including the number of packet copies expected in the merge, the way to merge different copies of the packet, and the first hop of the impairment function service graph. Therefore, packet classification maintains a classification table (CT) for storing matching fields (such as five-tuples), the total number of packet copies to be received in the merge, the merge operation for merging packet copies, and the operation of the first impairment function in the service graph. Packet classification sends the packet to the entry of the impairment function service graph according to these operations. It should be noted that different packets in a flow, or different flows following the same service graph, are forwarded and merged in the same pattern according to the structure of their impairment function service graphs. Packets following the same service graph are marked with the same Match Id (MID) to avoid duplicate storage of service graph information. The subsequent module can identify the service graph to which the packet belongs according to the MID to forward or merge the packet.
[0123] Packet Delivery Module: After a damage function finishes processing a packet, the network damage server should direct the packet to the subsequent damage function in the damage function service graph without replication, or replicate the packet and send the copy to the combined damage function. Using a centralized virtual switch as a forwarder may incur performance overhead. A controller is configured within the network damage device to allocate packet forwarding tasks, enabling each damage function to independently forward packets in parallel to the subsequent damage function. To make this process transparent to damage function developers and without modifying the damage functions, a DFRuntime is designed for each damage function to perform traffic steering. After the packet processing is complete, the damage function can delegate the packet to the DFRuntime, and the DFRuntime will copy the packet reference to the circular buffer of the next damage function to achieve packet forwarding. The packet delivery process can be processed in parallel through the distributed DFRuntime to alleviate the forwarding hotspot problem.
[0124] Packet Merging Module: When packets are finally merged, many backup packets may be generated, which may cause a performance bottleneck. In the present invention, multiple merging modules are deployed in a network damage server, and a merger agent is designed to balance the load among instances. The merging instances maintain a local DFDT and can merge packets from any damage function service graph. To simplify the instantiation and destruction of merging, the present invention implements merging as a damage function. The merging instances can be dynamically instantiated or destroyed by the coordinator, similar to other damage functions. The packets to be merged are first sent to the merging agent, and then the merging agent performs simple load balancing to share the load. It should be noted that multiple copies of the same packet should be ensured to be sent to the same merging instance. However, the packet copies may be modified by the damage function. Therefore, the merging agent performs a simple and fast hash processing on the immutable PID field of the packet and directs the packet to the merging instance. It should be noted that different packets in the traffic have different PIDs and can be assigned to different merging instances.
[0125] The DFC provides an interface for the impairment function to access and modify data packets, as well as a DFRuntime for discarding or delivering data packets after processing. To integrate a new impairment function into the system, the DFC requires the operations of the impairment function for parallelism identification and service graph construction. For this purpose, the DFC provides an inspection tool for operators to check the impairment function code to discover the usage of interfaces for operating on data packets, including reading, writing, discarding, and adding / removing bits. Operators can run the inspector according to their impairment function code to automatically generate an action profile, which can be registered into the DFC to integrate the new impairment function into the DFC. The present invention provides a DPDK-based interface for network impairment functions to access and modify data packets. The DPDK can parse the packet and provide a data structure for the network impairment function to read and write the packet header or payload. The inspection tool analyzes the calls of the packet data structure to determine the actions of the impairment function.
[0126] Embodiment 2
[0127] This embodiment provides a network impairment combined simulation implementation system, including:
[0128] An acquisition module, which is configured to: acquire network flows and query the network impairment requirements of the network flows;
[0129] A policy generation module, which is configured to: split the network impairment requirements into several impairment functions, analyze the feasibility of serial combination and parallel combination of the impairment functions, and generate a combined policy;
[0130] An optimization module, which is configured to: check whether there is an optimizable parallel combination in the combined policy, optimize the optimizable parallel combination, and obtain an optimized combined policy;
[0131] An impairment simulation module, which is configured to: construct a network impairment combined parallel graph according to the optimized combined policy; perform network impairment simulation according to the network impairment combined parallel graph.
[0132] It should be noted here that the above acquisition module, policy generation module, optimization module, and impairment simulation module correspond to steps S101 to S104 in Embodiment 1. The examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1 above. It should be noted that the above modules, as part of the system, can be executed in a computer system such as a set of computer-executable instructions.
[0133] In the above embodiments, the descriptions of each embodiment have their own emphases. For parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0134] The proposed system can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of the above modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed.
[0135] Embodiment III
[0136] This embodiment also provides an electronic device, including: one or more processors, one or more memories, and one or more computer programs; wherein, the processor is connected to the memory, and the one or more computer programs are stored in the memory. When the electronic device runs, the processor executes the one or more computer programs stored in the memory, so that the electronic device executes the method described in Embodiment I above.
[0137] It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0138] The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A part of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0139] In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor or the instructions in the form of software.
[0140] The method in Embodiment I can be directly embodied as being executed by the hardware processor, or executed by the combination of the hardware and software modules in the processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method. To avoid repetition, it will not be described in detail here.
[0141] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with this embodiment can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0142] Embodiment IV
[0143] This embodiment also provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the method described in Embodiment I is completed.
[0144] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for realizing combined simulation of network impairments, characterized by comprising: Obtain a network flow and query the network impairment requirements of the network flow; Split the network impairment requirements into several impairment functions, analyze the feasibility of serial combination and parallel combination of the impairment functions, and generate a combined strategy; Check whether there are optimizable parallel combinations in the combined strategy, optimize the optimizable parallel combinations, and obtain an optimized combined strategy; Construct a network impairment combined parallel graph according to the optimized combined strategy; perform network impairment simulation according to the network impairment combined parallel graph; The step of splitting the network impairment requirements into several impairment functions, analyzing the feasibility of serial combination and parallel combination of the impairment functions, and generating a combined strategy specifically includes: Decompose the network impairment requirements into several impairment functions; store the operation domain and operation information of each impairment function into an impairment function operation mapping table; Set corresponding rules for each impairment function; the corresponding rules include: sequence rule, priority rule, and position rule; directly output the impairment functions with priority rules and position rules to the strategy set; For any two impairment functions corresponding to the sequence rule, judge whether the result of parallel execution of the two impairment functions is the same as the result of serial execution. If they are the same, it means that the two impairment functions are allowed to work in parallel; if they are different, it means that the two impairment functions are not allowed to work in parallel; After all the impairment functions corresponding to the sequence rule are analyzed, check whether there are optimizable parallel combinations in the combined strategy for the impairment functions allowed to work in parallel; for the sequence rules not allowed to work in parallel, construct a network impairment combined parallel graph according to the optimized combined strategy.
2. The network impairment combined simulation implementation method according to claim 1, wherein The step of obtaining a network flow and querying the network impairment requirements of the network flow specifically includes: Obtain a network flow; Query and store the network impairment requirements of the network flow; If the target network flow does not contain network impairment requirements, directly forward the network flow; if the network flow contains network impairment requirements, proceed to the next step; The step of querying and storing the network impairment requirements of the target network flow specifically includes: Create an impairment function operation mapping table; the impairment function operation mapping table includes: impairment function and operation domain, and the operation domain and operation information of the message corresponding to the impairment function; store the operation domain and operation information of the impairment function into the impairment function operation mapping table; wherein, the impairment function includes: packet loss impairment, message tampering, out-of-order impairment, delay impairment, or shaping impairment; the operation domain refers to the set field in the message, and the operation information refers to read operation or write operation.
3. The network impairment combined simulation implementation method according to claim 1, characterized in that, The step of checking whether there are optimizable parallel combinations in the combined strategy, optimizing the optimizable parallel combinations, and obtaining an optimized combined strategy specifically includes: Check whether there is an optimizable parallel combination in the combination strategy. The checking rule is determined according to the damage function action dependency table. When two damage functions perform read operations and write operations respectively on the same field of the same data packet, it means that there is no optimizable parallel combination; when two damage functions perform read operations and read operations respectively on the same field of the same data packet, it means that there is an optimizable parallel combination; If there is an optimizable parallel combination, optimize the parallel combination by means of memory multiplexing or only copying the packet header to obtain an optimized combination strategy; if there is no optimizable parallel combination, enter the construction of the network damage combination parallel graph according to the optimized combination strategy.
4. The method for realizing combined simulation of network impairments according to claim 1, wherein The method of checking whether there is an optimizable parallel combination in the combination strategy and optimizing the optimizable parallel combination to obtain an optimized combination strategy specifically includes: Obtain the order rule Order(DF1, DF2) that allows the combination to work, and analyze the value of the combinable parameter in the order rule. If the value of the combinable parameter is false, directly add the current order rule to the output policy set. If the value of the combinable parameter is true, execute S103-2; For the order rule that allows the combination to work, execute the damage function combination optimization algorithm. The input value of the damage function combination optimization algorithm is the order rule Order(DF1, DF2), and the output value is two states: copying the data packet or not copying the data packet; Configure the output result into the order rule in the form of a parameter; add the optimized order rule to the output policy set.
5. The network impairment combined simulation implementation method according to claim 4, characterized in that The execution of the damage function combination optimization algorithm for the order rule that allows the combination to work is implemented based on memory multiplexing, and specifically includes: First, update the damage function action dependency table DFDT, that is, extract two operation pairs and store them in the damage function action dependency table DFDT; if both damage functions are read operations, do not copy the data packet; if two damage functions, one is a read operation and the other is a write operation, if their operation domains are different, do not copy the data packet, otherwise copy the data packet; if both damage functions are write operations and their write operation domains are different, do not copy the data packet, otherwise copy the data packet; Obtain all the operations of the two damage functions from the damage function operation mapping table DFAM, and then obtain all the action pairs in the two damage functions. Based on the damage function action dependency table DFDT, judge whether the combination of the two damage functions is optimizable: when two damage functions perform read operations and write operations respectively on the same field of the same data packet, the combination is not optimizable; when two damage functions perform read operations and read operations respectively on the same field of the same data packet, the combination is optimizable; Configure the output result into the order rule Order(DF1, DF2).
6. The network impairment combined simulation implementation method according to claim 1, characterized in that The construction of the network damage combination parallel graph according to the optimized combination strategy specifically includes: Obtain the output policy set, where the output policy set includes order rules, priority rules, and position rules; Convert the output policy into an intermediate language representation, including two different types: for the location rule, maintain the damage function type and record the location of a single damage function; for the sequence rule and the priority rule, assign priorities to damage functions that can be serially combined or parallelly combined; Convert the intermediate language representation into a micro damage function graph: First, sequentially link multiple non-combinable damage functions; then, use multiple damage functions with the same starting action as connection points to connect the intermediate language representations of damage functions with the same starting action into the micro damage function graph; among them, the micro damage function graph has three types of structures, including: the micro damage function graph of a single damage function, the tree structure micro damage function graph, and the combined planar structure micro damage function graph; finally, generate a micro damage function graph without overlapping damage functions; Merge the micro damage function graphs into the final network damage combination parallel graph: Place the damage functions assigned by the location rule at the head or tail of the finally generated network damage combination parallel graph; then merge each remaining micro damage function graph into one damage function, and check the dependence between every two micro damage function graphs to determine their combinability. If two damage functions have a sequential dependence, they cannot be executed in parallel; if two damage functions do not have a location dependence, a sequential dependence, or a priority dependence, they can be executed in parallel; finally, connect the independent micro damage function graphs according to the location, sequence, or priority to obtain the final network damage combination parallel graph.
7. A system for realizing combined simulation of network impairments, characterized in that Including: An acquisition module, which is configured to: acquire a network flow and query the network damage requirements of the network flow; A policy generation module, which is configured to: split the network damage requirements into several damage functions, analyze the feasibility of serial combination and parallel combination of the damage functions, and generate a combined policy; An optimization module, which is configured to: check whether there is an optimizable parallel combination in the combined policy, optimize the optimizable parallel combination, and obtain an optimized combined policy; A damage simulation module, which is configured to: construct a network damage combination parallel graph according to the optimized combined policy; perform network damage simulation according to the network damage combination parallel graph; The splitting of the network damage requirements into several damage functions, analyzing the feasibility of serial combination and parallel combination of the damage functions, and generating a combined policy specifically includes: Decompose the network damage requirements into several damage functions; store the operation domain and operation information of each damage function into the damage function operation mapping table; Set corresponding rules for each damage function; the corresponding rules include: sequence rule, priority rule, and location rule; directly output the damage functions with the priority rule and the damage functions with the location rule to the policy set; For any two damage functions corresponding to the sequence rule, judge whether the result of parallel execution of the two damage functions is the same as the result of serial execution. If they are the same, it means that the two damage functions are allowed to work in parallel; if they are different, it means that the two damage functions are not allowed to work in parallel; After analyzing all the damage functions corresponding to the sequential rules, check whether there are optimizable parallel combinations in the combinatorial strategy of the sequential rules that allow parallel operation; for the sequential rules that do not allow parallel operation, construct a parallel graph of network damage combinations according to the optimized combinatorial strategy.
8. An electronic device, characterized in that it comprises: a memory for non-temporarily storing computer-readable instructions; and a processor for running the computer-readable instructions, wherein, when the computer-readable instructions are run by the processor, the method according to any one of claims 1-6 above is executed.
9. A storage medium, characterized in that it is non-transitory Store computer-readable instructions, wherein when the non-temporary computer-readable instructions are executed by a computer, the instructions for executing the method according to any one of claims 1-6 are executed.