Network test package selection method, device and electronic equipment

By building network exponential tables and selecting network test packages, the problem of insufficient fault diagnosis capabilities of ping tools in complex networks is solved, and more accurate and efficient network fault location is achieved.

CN115022160BActive Publication Date: 2024-11-08CHINA MOBILE COMM LTD RES INST +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110235780.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-03
Publication Date
2024-11-08
Estimated Expiration
2041-03-03

AI Technical Summary

Technical Problem

Existing ping tools have poor fault diagnosis capabilities when diagnosing faults in complex network structures and cannot effectively locate faults in network rules.

Method used

By building a network relay table, selecting and dividing network test packages, using a set of rules in the network relay table for fault location, using a division algorithm and maximum heap operation to select the appropriate test package until each subset includes only one rule.

Benefits of technology

It improves the accuracy and efficiency of network fault diagnosis, can better locate faults in network rules, and enhances the fault location capabilities of complex networks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115022160B_ABST
    Figure CN115022160B_ABST
Patent Text Reader

Abstract

The present invention provides a network test packet selection method, device and electronic device, which relate to the field of test technology, wherein the network test packet selection method comprises: determining a network reachable table of a network to be tested, wherein the network reachable table comprises a plurality of table items, wherein each of the plurality of table items comprises a network packet header space, an input port, an output port and at least one network rule; selecting a plurality of network test packets from a network packet set based on the network reachable table; wherein the network packet set is a set of network packets corresponding to each of the table items, wherein the plurality of network test packets are divided into a plurality of test packet sets, wherein the plurality of test packet sets correspond one-to-one to a plurality of network rules in the network reachable table, and each of the test packet sets is used to locate a fault of the network rule corresponding to the test packet set. The embodiments of the present invention can improve the network fault diagnosis capability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of testing technology, and in particular to a network test packet selection method, device and electronic equipment. Background Art

[0002] Fault diagnosis of the network data plane is to analyze the reasons why theoretical network forwarding behavior is inconsistent with actual network forwarding behavior by testing network forwarding devices. Abnormal behavior of network forwarding devices includes failure of reachability. Network administrators usually use the ping tool to generate network test packets for network fault diagnosis. However, the network test packets generated by the ping tool are relatively random. For networks with complex network structures, the fault diagnosis capability of the ping tool is relatively poor. Summary of the invention

[0003] The embodiment of the present invention provides a network test packet selection method, device and electronic device to solve the problem that the fault diagnosis capability of the existing ping tool is poor.

[0004] To solve the above technical problems, the present invention is achieved as follows:

[0005] In a first aspect, an embodiment of the present invention provides a network test packet selection method, the method comprising:

[0006] Determine a network reachable table of the network to be tested, wherein the network reachable table includes a plurality of table entries, each of the plurality of table entries includes a network packet header space, an ingress port, an egress port, and at least one network rule, wherein a network packet with a network packet header in the network packet header space enters the network to be tested from the ingress port and leaves the network to be tested from the corresponding egress port via the corresponding network rule;

[0007] Selecting a plurality of network test packets from a network packet set based on the network reachability table;

[0008] Among them, the network packet set is a set of network packets corresponding to each table entry, the multiple network test packets are divided into multiple test packet sets, the multiple test packet sets correspond one-to-one to the multiple network rules in the network reachable table, and each of the test packet sets is used to locate faults in the network rules corresponding to the test packet set.

[0009] Optionally, the selecting a plurality of network test packets from a network packet set based on the network reachability table includes:

[0010] Determine a network rule set, where the network rule set is a union of network rules in the network reachability table;

[0011] Calculate the filter value corresponding to the division of the network rule set based on each network packet in the network packet set respectively;

[0012] According to the filtering value corresponding to each network packet in the network packet set, a network test packet is selected from the network packet set, and the selected network test packet is deleted from the network packet set, the network rule set is updated to be a network rule subset obtained based on the selected network test packet, and the step of calculating the filtering value corresponding to the division of the network rule set based on each network packet in the network packet set is returned to execute, until each subset of the network rule subsets obtained based on the selected network test packet includes only one network rule.

[0013] Optionally, respectively calculating the screening values ​​corresponding to the division of the network rule set based on each network packet in the network packet set includes:

[0014] Calculate, based on the first partitioning algorithm, the screening values ​​corresponding to the partitioning of the network rule set based on each network packet in the network packet set;

[0015] Wherein, the first partitioning algorithm is:

[0016]

[0017] H is the first index value, S is the network rule subset obtained by dividing the network packet, n i is the number of network rules included in the i-th subset in S, n represents the total number of network rules in S, i is a positive integer, and the screening value corresponding to each network packet is determined based on the first indicator value corresponding to each network packet.

[0018] Optionally, respectively calculating the screening values ​​corresponding to the division of the network rule set based on each network packet in the network packet set includes:

[0019] Calculate, based on the second partitioning algorithm, the screening values ​​corresponding to the partitioning of the network rule set based on each network packet in the network packet set;

[0020] The second partitioning algorithm is:

[0021]

[0022] Among them, G is the second index value, Q is the network rule set for network packet division, and m j is the number of network rules included in the jth subset of Q, m represents the total number of network rules in Q, j is a positive integer, and m jl and m jr are respectively the numbers of network rules included in the two subsets obtained by dividing the j-th subset, and the screening value corresponding to each network packet is determined based on the second indicator value corresponding to each network packet.

[0023] Optionally, the screening value corresponding to each network packet is determined based on the product of the second index value corresponding to each network packet and a first coefficient, and the first coefficient is determined based on the number of subsets into which each network packet can be divided.

[0024] Optionally, after determining the network rule set, the method further includes:

[0025] Create a maximum heap;

[0026] The selecting a network test packet from the network packet set according to a screening value corresponding to each network packet in the network packet set comprises:

[0027] Determine an element value of a node in the maximum heap according to a screening value corresponding to each network packet in the network packet set, each of the nodes representing a network packet;

[0028] A heap operation is performed on the maximum heap, and a network test packet is selected from the network packet set based on the heap operation result.

[0029] Optionally, determining the element value of the node in the maximum heap according to the screening value corresponding to each network packet in the network packet set includes:

[0030] Calculating the sum of a screening value and a disturbance amount corresponding to each network packet in the network packet set, wherein the disturbance amount is greater than 0 and less than or equal to the screening value;

[0031] The element value of the node in the maximum heap is determined based on the sum of the screening value corresponding to each network packet and the disturbance amount.

[0032] In a second aspect, an embodiment of the present invention provides a network test packet selection device, the device comprising:

[0033] A determination module, configured to determine a network reachable table of the network to be tested, wherein the network reachable table includes a plurality of table entries, each of the plurality of table entries includes a network packet header space, an ingress port, an egress port, and at least one network rule, wherein a network packet whose network packet header is within the network packet header space enters the network to be tested from the ingress port and leaves the network to be tested from the corresponding egress port via the corresponding network rule;

[0034] A selection module, configured to select a plurality of network test packets from a network packet set based on the network reachability table;

[0035] Among them, the network packet set is a set of network packets corresponding to each table entry, the multiple network test packets are divided into multiple test packet sets, the multiple test packet sets correspond one-to-one to the multiple network rules in the network reachable table, and each of the test packet sets is used to locate faults in the network rules corresponding to the test packet set.

[0036] Optionally, the selection module includes:

[0037] A determination unit, configured to determine a network rule set, wherein the network rule set is a union of network rules in the network reachability table;

[0038] A calculation unit, used to respectively calculate the screening value corresponding to the division of the network rule set based on each network packet in the network packet set;

[0039] A selection unit is used to select a network test packet from the network packet set according to a filtering value corresponding to each network packet in the network packet set, delete the selected network test packet from the network packet set, update the network rule set to a network rule subset obtained by dividing based on the selected network test packet, and return to execute the step of respectively calculating the filtering value corresponding to the division of the network rule set based on each network packet in the network packet set, until each subset of the network rule subsets obtained by dividing based on the selected network test packet includes only one network rule.

[0040] Optionally, the computing unit is specifically used for:

[0041] Calculate, based on the first partitioning algorithm, the screening values ​​corresponding to the partitioning of the network rule set based on each network packet in the network packet set;

[0042] Wherein, the first partitioning algorithm is:

[0043]

[0044] H is the first index value, S is the network rule subset obtained by dividing the network packet, n i is the number of network rules included in the i-th subset in S, n represents the total number of network rules in S, i is a positive integer, and the screening value corresponding to each network packet is determined based on the first indicator value corresponding to each network packet.

[0045] Optionally, the computing unit is specifically used for:

[0046] Calculate, based on the second partitioning algorithm, the screening values ​​corresponding to the partitioning of the network rule set based on each network packet in the network packet set;

[0047] The second partitioning algorithm is:

[0048]

[0049] Among them, G is the second index value, Q is the network rule set for network packet division, and m j is the number of network rules included in the jth subset of Q, m represents the total number of network rules in Q, j is a positive integer, and m jl and m jr are respectively the numbers of network rules included in the two subsets obtained by dividing the j-th subset, and the screening value corresponding to each network packet is determined based on the second indicator value corresponding to each network packet.

[0050] Optionally, the screening value corresponding to each network packet is determined based on the product of the second index value corresponding to each network packet and a first coefficient, and the first coefficient is determined based on the number of subsets into which each network packet can be divided.

[0051] Optionally, the selection module further includes:

[0052] Establish a unit for establishing a maximum heap;

[0053] The selection unit comprises:

[0054] A determination subunit, configured to determine an element value of a node in the maximum heap according to a screening value corresponding to each network packet in the network packet set, each of the nodes representing a network packet;

[0055] A subunit is selected, which performs a heap operation on the maximum heap, selects a network test packet from the network packet set based on the heap operation result, deletes the selected network test packet from the network packet set, updates the network rule set to a network rule subset obtained by dividing based on the selected network test packet, and returns to execute the step of respectively calculating the filter value corresponding to the division of the network rule set based on each network packet in the network packet set, until each subset of the network rule subsets obtained by dividing based on the selected network test packet includes only one network rule.

[0056] Optionally, the determining subunit is specifically used for:

[0057] Calculating the sum of a screening value and a disturbance amount corresponding to each network packet in the network packet set, wherein the disturbance amount is greater than 0 and less than or equal to the screening value;

[0058] The element value of the node in the maximum heap is determined based on the sum of the screening value corresponding to each network packet and the disturbance amount.

[0059] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the network test packet selection method described in the first aspect.

[0060] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the network test packet selection method described in the first aspect are implemented.

[0061] In an embodiment of the present invention, a network reachable table of a network to be tested is determined, the network reachable table includes a plurality of table entries, each of the plurality of table entries includes a network packet header space, an ingress port, an egress port, and at least one network rule, wherein a network packet whose network packet header is in the network packet header space enters the network to be tested from the ingress port, and leaves the network to be tested from the corresponding egress port via the corresponding network rule; multiple network test packets are selected from a network packet set based on the network reachable table; wherein the network packet set is a set of network packets corresponding to each of the table entries, the multiple network test packets are divided into multiple test packet sets, the multiple test packet sets correspond one-to-one to the multiple network rules in the network reachable table, and each of the test packet sets is used to locate faults of the network rules corresponding to the test packet set. In this way, compared with randomly generating network test packets, selecting network test packets based on the network reachable table, the selected network test packets can better locate faults of network rules in the network to be tested, thereby improving the network fault diagnosis capability. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0063] Figure 1 is a flow chart of a network test packet selection method provided by an embodiment of the present invention;

[0064] Figure 2 is a schematic diagram of an example of a network data plane provided by an embodiment of the present invention;

[0065] Figure 3 It is a schematic diagram of dividing a network rule set provided by an embodiment of the present invention;

[0066] Figure 4 is a schematic diagram of another network rule set division provided by an embodiment of the present invention;

[0067] Figure 5 This is a schematic diagram of the structure of a maximum heap provided by an embodiment of the present invention;

[0068] Figure 6 is a flow chart of another network test packet selection method provided by an embodiment of the present invention;

[0069] Figure 7 It is a structural schematic diagram of a network test packet selection device provided by an embodiment of the present invention;

[0070] Figure 8 It is a structural schematic diagram of another network test packet selection device provided by an embodiment of the present invention;

[0071] Fig. 9 It is a structural schematic diagram of another network test packet selection device provided by an embodiment of the present invention;

[0072] Fig.10 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0073] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0074] In the embodiment of the present invention, a network test packet selection method, device and electronic device are proposed to solve the problem that the fault diagnosis capability of the existing ping tool is poor.

[0075] See also Figure 1 , Figure 1 is a flow chart of a network test packet selection method provided by an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0076] Step 101, determine a network reachable table of the network to be tested, wherein the network reachable table includes multiple table entries, each of the multiple table entries includes a network packet header space, an input port, an output port, and at least one network rule, wherein a network packet with a network packet header in the network packet header space enters the network to be tested from the input port and leaves the network to be tested from the corresponding output port via the corresponding network rule.

[0077] Among them, a network data plane verification tool can be used to determine the network reachability table of the network to be tested. The network reachability table can be an end-to-end full-pair reachability table generated by the network data plane verification tool. For example, the network data plane verification tool can be a Header Space Analysis (HSA) tool. The HSA tool is a mainstream and open source verification tool that provides a complete source code structure, rich functions, and is easy to use. Taking the use of the HAS tool to generate a network reachability table as an example, the key files of the network data plane can be obtained. The key files may include a forwarding information base (FIB) table, an access control list (ACL), a configuration file, and a network topology; using HSA to parse the key files can generate an abstract model for network data plane forwarding; running the reachability analysis function provided by HSA on the abstract model can generate an end-to-end full-pair reachability table.

[0078] For example, the network reachability table may be as shown in Table 1:

[0079] Table 1

[0080]

[0081] In Table 1, Header refers to the network header space, which can be a header space about {0,1,x}; Ingress Port represents the ingress port; Egress Port represents the egress port; Rule History represents a sequence of at least one network rule. i , p i1 , p i2 ,[r i1 , r i2 , ...]> can be used to characterize the network header space h i From the edge port p i1 After entering the network to be tested, it will be connected from the edge port p i2 Leave the network to be tested, and the historical sequence of network rules passed in this process is [r i1 ,r i2 ,...]. That is, h i From p i1 After being injected into the network under test, [r i1 ,r i2 ,...] after forwarding, it can be i2 Flow out of the network under test. i is a positive integer.

[0082] It should be noted that the method of generating a network reachability table using HSA can be to inject a wildcard packet header h into each of the selected ports for testing on the abstract model of HSA, where the header space of packet header h is all-x. Assume that packet header h enters the test port e in , h will be e in The corresponding network topology transfer function is processed. After being processed by the network topology transfer function, h is converted into an area in the network packet header space and finally from the test port e out In this process, every time a network topology transfer function is reached, h will be processed by the corresponding network rules in the network topology transfer function. Therefore, along with the processing of h, a corresponding historical sequence of network rules [r1, r2, ...] can be generated. Then, the packet header backtracking method provided by HSA can be used to trace h from e out After the inverse conversion, return to e in , the packet header h after inverse conversion ′ It can be used as the result required by the Header table column in the network reachability table.

[0083] As a specific implementation method, Figure 2 As shown in the figure, a simple network data plane example is used for explanation. Each switching device in the network has a corresponding simplified FIB table, and two test terminals T are connected to the edge of device A. A and T B ; Device C is connected to the test terminal T C ; D device is connected to the test terminal T D The edge port connected to the test terminal can be used as the ingress port or egress port when calculating the end-to-end full-pair reachability table. The end-to-end full-pair reachability table under the network data plane can be calculated using the general method of HSA to calculate the end-to-end full-pair reachability table. For example, according to the configuration of the FIB table, from T A to T B A table entry will be generated, the entry's input port is T A , the output port is T B , through rule R1, and the network header space of the table entry is: 00001010, 00000001, xxxxxxxx, xxxxxxxx. The end-to-end full-pair reachability table under the network data plane is shown in Table 2:

[0084] Table 2

[0085]

[0086] There are four entries in the end-to-end full-pair reachability table shown in Table 2. The process of using the network packet in the end-to-end full-pair reachability table to test the network under test can be as follows. Taking the third entry in the end-to-end full-pair reachability table as an example, a network packet header can be sampled from the header of the entry. For example, a valid network packet header is ip_dst=10.2.0.1, and the test terminal T B Send the test data packet corresponding to the network packet header to the test terminal T C , T C Can capture all network packets under ip_dst=10. / 8. If the test terminal T C If the test data packet can be received within a given time, it can be considered that the test data packet is received from T B The HSA is used to generate the end-to-end full reachability table, and the entire process of sampling and sending and receiving network test packets is automated, thus enabling automated testing.

[0087] Step 102: Select multiple network test packets from the network packet set based on the network reachability table;

[0088] Among them, the network packet set is a set of network packets corresponding to each table entry, the multiple network test packets are divided into multiple test packet sets, the multiple test packet sets correspond one-to-one to the multiple network rules in the network reachable table, and each of the test packet sets is used to locate faults in the network rules corresponding to the test packet set.

[0089] It should be noted that the network reachability table provides all possible test packet prototypes in the network to be tested, and each table entry corresponds to a test packet prototype. A certain number of table entries can be selected based on the network reachability table as the final network test packets for testing the network data plane of the network to be tested. For ease of explanation, the table entries can be directly regarded as network packets, and one table entry corresponds to one network packet. A 1-identification selection algorithm can be used to select multiple network test packets from a network packet set, and the selected test packets can achieve 1-identification level fault location for the reachable rules in the network to be tested. For a network rule, if there is a problem with only this one network rule in the network, and its problem can be located, then the fault of this network rule can be 1-identified.

[0090] In addition, after selecting the network test packet, the selected network test packet can be sampled before being sent to the network to be tested. Since the network packet header in the Header column of the network reachability table is saved as an expression about {0, 1, x}, taking the generation of the network reachability table using HSA as an example, according to the operation characteristics of HSA, the network packet header is ∪{A i}-∪{Bj} exists in the form of ∪{A i}-∪{B j} represents a certain range in the network packet header space. In order to send a network test packet, it is necessary to i}-∪{B j}. There are two sampling methods: i}-∪{B j} can be fully expanded by performing set operations on HSA. The second method can be solved by solving SAT (Boolean satisfiability problem) directly from ∪{A i}-∪{B j}, because in practical applications, ∪{A i} usually has only one item, so we only need to consider A-∪{B j}. For SAT expressions, the conjunctive normal form is used, A-∪{B j} can be expressed as a conjunctive SAT expression by first translating the expression in A into a1∧a2∧a3∧…, a i are all bits in A that are not x, i is a positive integer; for ∪{B j}, since it comes after the set reduction operation, first replace -∪{B j} as ∧{-B j}, so for -B k Belongs to {-B j}, which has an expression that can be translated as -b k1 ∨-b k2 ∨-b k3 ∨…, is a disjunctive form, where b kq All are B k For the bits that are not x, q is a positive integer. So A-∪{B j}The final form of the translation is a1∧a2∧a3∧...∧(-b 11 ∨-b 12 ∨-b 13 ∨...)∧.... By using the mainstream open source SAT Solver, a usable network packet header can be obtained in a short time, thereby obtaining a network test packet.

[0091] In an embodiment of the present invention, a network reachable table of a network to be tested is determined, the network reachable table includes a plurality of table entries, each of the plurality of table entries includes a network packet header space, an ingress port, an egress port, and at least one network rule, wherein a network packet whose network packet header is in the network packet header space enters the network to be tested from the ingress port, and leaves the network to be tested from the corresponding egress port via the corresponding network rule; multiple network test packets are selected from a network packet set based on the network reachable table; wherein the network packet set is a set of network packets corresponding to each of the table entries, the multiple network test packets are divided into multiple test packet sets, the multiple test packet sets correspond one-to-one to the multiple network rules in the network reachable table, and each of the test packet sets is used to locate faults of the network rules corresponding to the test packet set. In this way, compared with randomly generating network test packets, selecting network test packets based on the network reachable table, the selected network test packets can better locate faults of network rules in the network to be tested, thereby improving the network fault diagnosis capability.

[0092] Optionally, the selecting a plurality of network test packets from a network packet set based on the network reachability table includes:

[0093] Determine a network rule set, where the network rule set is a union of network rules in the network reachability table;

[0094] Calculate the screening value corresponding to the division of the network rule set based on each network packet in the network packet set respectively;

[0095] According to the filtering value corresponding to each network packet in the network packet set, a network test packet is selected from the network packet set, and the selected network test packet is deleted from the network packet set, the network rule set is updated to be a network rule subset obtained based on the selected network test packet, and the step of calculating the filtering value corresponding to the division of the network rule set based on each network packet in the network packet set is returned to execute, until each subset of the network rule subsets obtained based on the selected network test packet includes only one network rule.

[0096] The method for selecting a network test packet that implements 1-identification of network rules can be as follows: perform a set and operation on the historical sequences in the Rule History in the network reachability table to obtain a network rule set R0, which includes all reachable rules in the network to be tested; select a network packet p from the network packet set i , whose historical sequence rh i is a proper subset of the set R0, so p i R0 can be divided so that iThe network rules in the test package set are divided into a new set R1, and the division process is repeated until there are no new network packets that can further divide the current rule set. Finally, the network rule set obtained after iterative division includes multiple target subsets, each of which includes a network rule, and each of the target subsets corresponds to each of the test package sets. Therefore, the selected network test package realizes 1-identification of the network rule set.

[0097] As a specific implementation, taking a simplified network reachability table as an example, network test packets p1, p2 and p3 have been selected, as shown in Table 3. The network reachability table only shows the relationship between the three network packets and the network rules.

[0098] Table 3

[0099] R1 R2 R3 R4 p1 1 1 p2 1 1 p3 1

[0100] In Table 3, the vertical lines indicate that the network rules are elements in the historical sequence of network rules corresponding to the network packets. For example, the historical sequence of network rules for network packet p1 includes R1 and R2. There are three network packets and four network rules in Table 3. The process of dividing the network rule set (R1, R2, R3, R4) can be as follows: Figure 3As shown, firstly, the network rule set (R1, R2, R3, R4) is divided by network packet p1 to obtain the network rule set ((R1, R2), (R3, R4)). Then, the network rule set obtained by the division by p1 is further divided by network packet p2 to obtain the network rule set ((R1), (R2), (R3), (R4)). R2 corresponds to the test packet set (p1, p2), indicating that when only R2 fails, the fault can be located by the test packet set (p1, p2); R1 corresponds to the test packet set (p1), indicating that when only R1 fails, the fault can be located by the test packet set (p1); R3 corresponds to the test packet set (p2), indicating that when only R3 fails, the fault can be located by the test packet set (p2). Finally, the network rule set obtained by dividing by p2 is further divided by network packet p3 to obtain the network rule set ((R1), (R2), (R3), (R4)), R4 corresponds to the test packet set (p3), indicating that when only R4 fails, the fault can be located by the test packet set (p3). Taking p1, p2 and p3 as network test packets for testing the network to be tested, when network packets p1, p2 and p3 are put into the network to be tested, if only p3 cannot be captured at the corresponding output port, it indicates that R4 has a fault; if only p2 cannot be captured at the corresponding output port, it indicates that R3 has a fault; if only p1 cannot be captured at the corresponding output port, it indicates that R1 has a fault; if only p1 and p2 cannot be captured at the corresponding output ports, it indicates that R2 has a fault.

[0101] After iteratively partitioning the network rule set based on Table 3, there are four target subsets, each of which contains one network rule, and all three network packets are selected. It can be seen that the coverage modes under the target subsets are different, and each target subset contains only one network rule, so each network rule will be 1-identified.

[0102] It should be noted that the network packets used for each division will determine the number of network test packets finally selected. While selecting network test packets with 1-identification, the fewer the number of network test packets selected, the better, so as to reduce the interference with normal traffic in the network to be tested. The network test packets can be selected by the division algorithm, so that the number of network test packets finally selected from the network packet set can be minimized.

[0103] In this implementation, a network rule set is determined, and the network rule set is the union of the network rules in the network reachable table; the filtering values ​​corresponding to the division of the network rule set based on each network packet in the network packet set are calculated respectively; according to the filtering value corresponding to each network packet in the network packet set, a network test packet is selected from the network packet set, and the selected network test packet is deleted from the network packet set, the network rule set is updated to be a network rule subset obtained by the division based on the selected network test packet, and the step of calculating the filtering values ​​corresponding to the division of the network rule set based on each network packet in the network packet set is returned to execute respectively, until each subset of the network rule subset obtained by the division based on the selected network test packet includes only one network rule, so that the selected network test packet has fault 1-identification with respect to the network rule and has a strong fault location capability.

[0104] Optionally, respectively calculating the screening values ​​corresponding to the division of the network rule set based on each network packet in the network packet set includes:

[0105] Calculate, based on the first partitioning algorithm, the screening values ​​corresponding to the partitioning of the network rule set based on each network packet in the network packet set;

[0106] Wherein, the first partitioning algorithm is:

[0107]

[0108] H is the first index value, S is the network rule subset obtained by dividing the network packet, n i is the number of network rules included in the i-th subset in S, n represents the total number of network rules in S, i is a positive integer, and the screening value corresponding to each network packet is determined based on the first indicator value corresponding to each network packet.

[0109] The screening value corresponding to each network packet can be equal to the first indicator value corresponding to each network packet, and the network packet with the smallest screening value can be determined as the network test packet. The meaning of H(S) on S is the expected number of network test packets that need to be selected next. For the i-th subset in S, log(n i ) can represent the minimum number of network packets that are theoretically required to divide all the rules in the i-th subset, and n i / n is used as the weight, and the minimum number of network packets in all subsets is weighted to obtain the expectation. For example, packet|G1 can be used to characterize the network rule subset obtained after the network packet packet divides the network rule set G1. In the iterative division process, if the network packet packet is selected to divide the network rule set G1 obtained by the previous division, the H(packet|G1) value of the network rule subset packet|G1 obtained after the division of G1 can be theoretically calculated as the first indicator value V(packet) of the network packet packet. For example, when S is the network rule set packet|G1:

[0110]

[0111] Among them, V(packet) can be used to represent how many network packets are theoretically expected to be needed to complete the next division work after selecting the network packet packet and obtaining the network rule set packet|G1 after division. In each selection in the iterative division process, the V(packet) value can be calculated using each network packet in the network packet set, and the network packet with the smallest V(packet) can be selected as the network test packet.

[0112] In this implementation, the screening values ​​corresponding to the division of the network rule set based on each network packet in the network packet set are calculated respectively based on the first division algorithm, so that fewer network test packets can be selected to achieve stronger fault location capability.

[0113] Optionally, respectively calculating the screening values ​​corresponding to the division of the network rule set based on each network packet in the network packet set includes:

[0114] Calculate, based on the second partitioning algorithm, the screening values ​​corresponding to the partitioning of the network rule set based on each network packet in the network packet set;

[0115] Wherein, the second partitioning algorithm is:

[0116]

[0117] Among them, G is the second index value, Q is the network rule set for network packet division, and m j is the number of network rules included in the jth subset of Q, m represents the total number of network rules in Q, j is a positive integer, and m jl and m jr are respectively the numbers of network rules included in the two subsets obtained by dividing the j-th subset, and the screening value corresponding to each network packet is determined based on the second indicator value corresponding to each network packet.

[0118] The screening value corresponding to each network packet may be equal to the second indicator value corresponding to each network packet, and the network packet with the largest screening value may be determined as the network test packet. The second partitioning algorithm may be a variation of the first partitioning algorithm. For example, when Q=G1:

[0119]

[0120] It should be noted that the time complexity of the first partitioning algorithm is O(pn 2 ), p is the total number of entries in the network reachable table, that is, the total number of optional network packets, n is the total number of network rules in the network reachable table, the first partitioning algorithm has a higher algorithm time complexity, and the second partitioning algorithm can further improve the calculation speed based on the first partitioning algorithm. In the process of iterative partitioning, a selected network packet actually only constitutes an effective partition for part of the rule subsets, and G(G1) and H(packet|G1) are essentially equivalent. The maximum value of G(G1) means the minimum value of H(packet|G1). The maximum number of rule subsets that the network packet packet can effectively partition is a. For G(G1), the algorithm time complexity of the second partitioning algorithm is O(pna). Generally speaking, the value of a will be much smaller than n, because a is actually determined by the maximum length of the rule history sequence, and the length of the rule history sequence is related to the diameter of the network topology, that is, the maximum number of hops the network has. The diameter of the network topology is much smaller than the total number of network rules. Therefore, the calculation time will be effectively shortened. W(packet) can be used to represent the G(G1) value calculated for the network packet packet using the second partitioning algorithm. In each selection of the iterative partitioning process, the W(packet) value can be calculated for each network packet in the network packet set, and the network packet with the largest W(packet) value can be selected as the network test packet.

[0121] For example, Figure 4 As shown, in the network rule set G1, the rule subset divided by the network packet packet is divided into two left and right subsets. The number of network rules included in the left and right subsets is m in G(G1) and m in G(G1). jl and m jr .

[0122] In this implementation, the screening values ​​corresponding to the division of the network rule set based on each network packet in the network packet set are respectively calculated based on the second division algorithm, which can reduce the time complexity of the algorithm and improve the calculation speed.

[0123] Optionally, the screening value corresponding to each network packet is determined based on the product of the second index value corresponding to each network packet and a first coefficient, and the first coefficient is determined based on the number of subsets into which each network packet can be divided.

[0124] The screening value corresponding to each network packet may be equal to the product of the second index value corresponding to each network packet and the first coefficient, and the network packet with the largest screening value may be determined as the network test packet. For the network packet packet, W(packet) is used to represent the second index value calculated for the network packet packet using the second partitioning algorithm, and the product of the second index value corresponding to each network packet and the first coefficient may be expressed as:

[0125] gain(packet)=W(packet)*ω(R)

[0126] Wherein, ω(R) is a function of the number R of subsets that can be divided by the network packet packet. The first coefficient can be obtained by calculating ω(R). ω(R) can be designed according to actual needs. For example, ω(R) can be designed as A network packet with a larger gain(packet) value means that it has a larger W(packet) value or that it can be segmented into a larger number of rule subsets, thereby reducing the total number of network test packets finally selected. In each selection of the iterative partitioning process, the gain(packet) value can be calculated for each network packet in the network packet set, and the network packet with the largest gain(packet) value can be selected as the network test packet.

[0127] In this implementation, the screening value corresponding to each network packet is determined based on the product of the second indicator value corresponding to each network packet and the first coefficient, and the first coefficient is determined based on the number of subsets into which each network packet can be divided, which can further reduce the total number of network test packets finally selected.

[0128] Optionally, after determining the network rule set, the method further includes:

[0129] Create a maximum heap;

[0130] The selecting a network test packet from the network packet set according to a screening value corresponding to each network packet in the network packet set comprises:

[0131] Determine an element value of a node in the maximum heap according to a screening value corresponding to each network packet in the network packet set, each of the nodes representing a network packet;

[0132] A heap operation is performed on the maximum heap, and a network test packet is selected from the network packet set based on the heap operation result.

[0133] Among them, the filtering value corresponding to each network packet can be gain(packet). The filtering value gain(packet) corresponding to each network packet can be used as the element value in the maximum heap (Max-Heap). Taking the maximum heap maintaining the filtering value gain(packet) corresponding to each network packet as an example, in each selection of the iterative division process, a network test packet is selected if, if a network packet is at the top of the heap, and after being popped out, the gain value is updated, and then pushed into the heap, the top of the heap is still the network packet, then the network packet can be selected as the network test packet, and the network packet can be popped out of the heap again. For example, if Figure 5 As shown, each node in the maximum heap can store a tuple, the element value of the tuple includes a filtering value gain(packet) corresponding to a network packet and the identifier packet of the network packet. The adjustment of the heap is based on the gain(packet) value of the tuple.

[0134] As a specific implementation method, Figure 6 As shown, a maximum heap can be initialized, the initial gain values ​​of all network packets in the network reachable table can be calculated, and the gain values ​​can be pushed into the maximum heap as the root; it can be determined whether the maximum heap is empty, and if the maximum heap is not empty, the network packet at the top of the maximum heap is popped out; it is determined whether the popped-out network packet can be divided into rule subsets; if the popped-out network packet can be divided into rule subsets, it is determined whether the popped-out network packet is the same network packet as the last popped-out network packet; if the popped-out network packet is not the same network packet as the last popped-out network packet, the gain value of the popped-out network packet under the current network rule set is updated and pushed into the maximum heap again; if the popped-out network packet is the same network packet as the last popped-out network packet, the network packet is selected as the network test packet.

[0135] It should be noted that the condition for the end of iterative partitioning may be that there are no more network packets to choose from in the maximum heap or each rule subset can no longer be divided. The above strategy can be called Lazy Update (buffered update). The LazyUpdate strategy can speed up the selection of network test packets. The longer the rule history sequence of a network packet, the more likely it is to obtain the maximum gain value in each round of update. When initializing the maximum heap, the position of the network packet in the heap is basically determined by the length of the rule history sequence, that is, the longer the length, the higher the position of the network packet in the heap. Therefore, each time a selection is made, basically only a small amount of heap pop and push operations are required, and the time complexity of the heap pop and push operations is relatively low, which is Therefore, the Lazy Update strategy can effectively speed up the selection of network test packages.

[0136] In this implementation, the element value of the node in the maximum heap is determined according to the screening value corresponding to each network packet in the network packet set, and each node represents a network packet; a heap operation is performed on the maximum heap, and a network test packet is selected from the network packet set based on the heap operation result. In this way, the Lazy Update strategy can effectively speed up the selection of network test packets.

[0137] Optionally, determining the element value of the node in the maximum heap according to the screening value corresponding to each network packet in the network packet set includes:

[0138] Calculating the sum of a screening value and a disturbance amount corresponding to each network packet in the network packet set, wherein the disturbance amount is greater than 0 and less than or equal to the screening value;

[0139] The element value of the node in the maximum heap is determined based on the sum of the screening value corresponding to each network packet and the disturbance amount.

[0140] Among them, a disturbance ε can be introduced, 0<ε<<gain(packet), and the sum of the screening value and the disturbance corresponding to each network packet is calculated:

[0141] heap_gain(packet)=gain(packet)+ε

[0142] Among them, since the gain value of the network packet has the characteristic of clustering, that is, multiple network packets have the same gain value under a given set of rules. A disturbance can be introduced into the gain value, and the heap_gain(packet) value corresponding to each network packet can be used as the element value in the maximum heap. Each node in the maximum heap can store a tuple, and the element value of the tuple includes the heap_gain(packet) value corresponding to a network packet and the identifier packet of the network packet. In this embodiment, the heap_gain(packet) value corresponding to each network packet is maintained in the maximum heap. The disturbance can ensure that each network packet has a different heap_gain value while not destroying the relative size change of the gain value that should have been. The upper bound of ε can be determined by the minimum difference in gain. For example, according to the calculation formula of gain, we can calculate f(x)=log(n)-(nx) / nlog(nx)-x / nlog(x), where n represents the total number of network rules in the network reachability table. It can be deduced that the minimum difference of gain with respect to n is: It can be deduced that g(n) is monotonically decreasing (n≥4), so the minimum difference is determined by the specific network rule set. For the convenience of calculation, the upper bound of ε can be set to a value much smaller than the minimum difference, such as g(n) / 100. By introducing the perturbation ε, the heap will quickly encounter network test packets that meet the selection conditions during the pop and push process. This strategy can be called Gain Perturbation.

[0143] In this implementation, the sum of the screening value and the disturbance amount corresponding to each network packet in the network packet set is calculated, and the disturbance amount is greater than 0 and less than or equal to the screening value; the element value of the node in the maximum heap is determined based on the sum of the screening value and the disturbance amount corresponding to each network packet. In this way, the selection of network test packets can be further effectively accelerated through the gain disturbance strategy.

[0144] See also Figure 7 , Figure 7 is a schematic diagram of the structure of a network test packet selection device provided by an embodiment of the present invention, such as Figure 7 As shown, the network test packet selection device 200 includes:

[0145] A determination module 201 is used to determine a network reachability table of the network to be tested, wherein the network reachability table includes multiple table entries, each of the multiple table entries includes a network packet header space, an ingress port, an egress port, and at least one network rule, wherein a network packet with a network packet header in the network packet header space enters the network to be tested from the ingress port and leaves the network to be tested from the corresponding egress port via the corresponding network rule;

[0146] A selection module 202, configured to select a plurality of network test packets from a network packet set based on the network reachability table;

[0147] Among them, the network packet set is a set of network packets corresponding to each table entry, the multiple network test packets are divided into multiple test packet sets, the multiple test packet sets correspond one-to-one to the multiple network rules in the network reachable table, and each of the test packet sets is used to locate faults in the network rules corresponding to the test packet set.

[0148] Optional, such as Figure 8 As shown, the selection module 202 includes:

[0149] A determining unit 2021, configured to determine a network rule set, wherein the network rule set is a union of network rules in the network reachability table;

[0150] A calculation unit 2022, configured to respectively calculate a screening value corresponding to the division of the network rule set based on each network packet in the network packet set;

[0151] The selection unit 2023 is used to select a network test packet from the network packet set according to the filtering value corresponding to each network packet in the network packet set, delete the selected network test packet from the network packet set, update the network rule set to a network rule subset obtained based on the selected network test packet, and return to execute the step of respectively calculating the filtering value corresponding to the division of the network rule set based on each network packet in the network packet set, until each subset of the network rule subsets obtained based on the selected network test packet includes only one network rule.

[0152] Optionally, the calculation unit 2022 is specifically used for:

[0153] Calculate, based on the first partitioning algorithm, the screening values ​​corresponding to the partitioning of the network rule set based on each network packet in the network packet set;

[0154] Wherein, the first partitioning algorithm is:

[0155]

[0156] H is the first index value, S is the network rule subset obtained by dividing the network packet, n i is the number of network rules included in the i-th subset in S, n represents the total number of network rules in S, i is a positive integer, and the screening value corresponding to each network packet is determined based on the first indicator value corresponding to each network packet.

[0157] Optionally, the calculation unit 2022 is specifically used for:

[0158] Calculate, based on the second partitioning algorithm, the screening values ​​corresponding to the partitioning of the network rule set based on each network packet in the network packet set;

[0159] Wherein, the second partitioning algorithm is:

[0160]

[0161] Among them, G is the second index value, Q is the network rule set for network packet division, and m j is the number of network rules included in the jth subset of Q, m represents the total number of network rules in Q, j is a positive integer, and m jl and m jr are respectively the numbers of network rules included in the two subsets obtained by dividing the j-th subset, and the screening value corresponding to each network packet is determined based on the second indicator value corresponding to each network packet.

[0162] Optionally, the screening value corresponding to each network packet is determined based on the product of the second index value corresponding to each network packet and a first coefficient, and the first coefficient is determined based on the number of subsets into which each network packet can be divided.

[0163] Optional, such as Fig. 9 As shown, the selection module 202 also includes:

[0164] Establishing unit 2024, for establishing a maximum heap;

[0165] The selection unit 2023 includes:

[0166] A determination subunit 20231 is used to determine an element value of a node in the maximum heap according to a screening value corresponding to each network packet in the network packet set, each of the nodes representing a network packet;

[0167] The selection subunit 20232 performs a heap operation on the maximum heap, selects a network test packet from the network packet set based on the heap operation result, deletes the selected network test packet from the network packet set, updates the network rule set to a network rule subset obtained based on the selected network test packet, and returns to execute the step of respectively calculating the filter value corresponding to the division of the network rule set based on each network packet in the network packet set, until each subset of the network rule subsets obtained based on the selected network test packet includes only one network rule.

[0168] Optionally, the determining subunit 20231 is specifically used for:

[0169] Calculating the sum of a screening value and a disturbance amount corresponding to each network packet in the network packet set, wherein the disturbance amount is greater than 0 and less than or equal to the screening value;

[0170] The element value of the node in the maximum heap is determined based on the sum of the screening value corresponding to each network packet and the disturbance amount.

[0171] The network test package selection device can realize Figure 1 The various processes implemented in the method embodiment can achieve the same technical effect, and to avoid repetition, they will not be described here.

[0172] like Fig.10 As shown, an embodiment of the present invention further provides an electronic device 300, comprising: a processor 301, a memory 302, and a program stored in the memory 302 and executable on the processor 301. When the program is executed by the processor 301, each process of the above-mentioned network test packet selection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0173] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned network test packet selection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a ROM, RAM, a magnetic disk or an optical disk.

[0174] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0175] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0176] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.

Claims

1. A network test packet selection method, characterized in that: The method comprises: Determine a network reachable table of the network to be tested, wherein the network reachable table includes a plurality of table entries, each of the plurality of table entries includes a network packet header space, an ingress port, an egress port, and at least one network rule, wherein a network packet with a network packet header in the network packet header space enters the network to be tested from the ingress port and leaves the network to be tested from the corresponding egress port via the corresponding network rule; Selecting a plurality of network test packets from a network packet set based on the network reachability table; The network packet set is a set of network packets corresponding to each table entry, the multiple network test packets are divided into multiple test packet sets, the multiple test packet sets correspond one-to-one to the multiple network rules in the network reachability table, and each of the test packet sets is used to locate the fault of the network rule corresponding to the test packet set; The selecting a plurality of network test packets from a network packet set based on the network reachability table comprises: Determine a network rule set, where the network rule set is a union of network rules in the network reachability table; Calculate the filter value corresponding to the division of the network rule set based on each network packet in the network packet set respectively; According to the filtering value corresponding to each network packet in the network packet set, a network test packet is selected from the network packet set, and the selected network test packet is deleted from the network packet set, the network rule set is updated to be a network rule subset obtained based on the selected network test packet, and the step of calculating the filtering value corresponding to the division of the network rule set based on each network packet in the network packet set is returned to execute, until each subset of the network rule subsets obtained based on the selected network test packet includes only one network rule.

2. The method according to claim 1, characterized in that The respectively calculating the screening values ​​corresponding to the division of the network rule set based on each network packet in the network packet set includes: Calculate, based on the first partitioning algorithm, the screening values ​​corresponding to the partitioning of the network rule set based on each network packet in the network packet set; Wherein, the first partitioning algorithm is: H is the first index value, S is the network rule subset obtained by dividing the network packet, n i is the number of network rules included in the i-th subset in S, n represents the total number of network rules in S, i is a positive integer, and the screening value corresponding to each network packet is determined based on the first indicator value corresponding to each network packet.

3. The method according to claim 1, characterized in that The respectively calculating the screening values ​​corresponding to the division of the network rule set based on each network packet in the network packet set includes: Calculate, based on the second partitioning algorithm, the screening values ​​corresponding to the partitioning of the network rule set based on each network packet in the network packet set; The second partitioning algorithm is: Among them, G is the second index value, Q is the network rule set for network packet division, and m j is the number of network rules included in the jth subset of Q, m represents the total number of network rules in Q, j is a positive integer, and m jl and m jr are respectively the numbers of network rules included in the two subsets obtained by dividing the j-th subset, and the screening value corresponding to each network packet is determined based on the second indicator value corresponding to each network packet.

4. The method according to claim 3, characterized in that The screening value corresponding to each network packet is determined based on the product of the second index value corresponding to each network packet and a first coefficient, and the first coefficient is determined based on the number of subsets into which each network packet can be divided.

5. The method according to claim 1, characterized in that After determining the network rule set, the method further includes: Create a maximum heap; The selecting a network test packet from the network packet set according to a screening value corresponding to each network packet in the network packet set comprises: Determine an element value of a node in the maximum heap according to a screening value corresponding to each network packet in the network packet set, each of the nodes representing a network packet; A heap operation is performed on the maximum heap, and a network test packet is selected from the network packet set based on the heap operation result.

6. The method according to claim 5, characterized in that The step of determining the element value of the node in the maximum heap according to the screening value corresponding to each network packet in the network packet set includes: Calculating the sum of a screening value and a disturbance amount corresponding to each network packet in the network packet set, wherein the disturbance amount is greater than 0 and less than or equal to the screening value; The element value of the node in the maximum heap is determined based on the sum of the screening value corresponding to each network packet and the disturbance amount.

7. A network test packet selection device, characterized in that: The device comprises: A determination module, configured to determine a network reachable table of the network to be tested, wherein the network reachable table includes a plurality of table entries, each of the plurality of table entries includes a network packet header space, an ingress port, an egress port, and at least one network rule, wherein a network packet whose network packet header is within the network packet header space enters the network to be tested from the ingress port and leaves the network to be tested from the corresponding egress port via the corresponding network rule; A selection module, configured to select a plurality of network test packets from a network packet set based on the network reachability table; The network packet set is a set of network packets corresponding to each table entry, the multiple network test packets are divided into multiple test packet sets, the multiple test packet sets correspond one-to-one to the multiple network rules in the network reachability table, and each of the test packet sets is used to locate the fault of the network rule corresponding to the test packet set; The selection module comprises: A determination unit, configured to determine a network rule set, wherein the network rule set is a union of network rules in the network reachability table; A calculation unit, used to respectively calculate the screening value corresponding to the division of the network rule set based on each network packet in the network packet set; A selection unit is used to select a network test packet from the network packet set according to a filtering value corresponding to each network packet in the network packet set, delete the selected network test packet from the network packet set, update the network rule set to a network rule subset obtained by dividing based on the selected network test packet, and return to execute the step of respectively calculating the filtering value corresponding to the division of the network rule set based on each network packet in the network packet set, until each subset of the network rule subsets obtained by dividing based on the selected network test packet includes only one network rule.

8. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the network test packet selection method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the network test packet selection method according to any one of claims 1 to 6 are implemented.