Flow table rule merging method and device

By analyzing and merging the matching field information in the flow table rules, the network performance degradation caused by the huge number of flow table rules on the OVS device is solved, and the traffic forwarding efficiency and memory load are improved.

CN120583022APending Publication Date: 2025-09-02XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510719633.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-29
Publication Date
2025-09-02

AI Technical Summary

Technical Problem

In the case of large-scale deployment, the number of flow table rules on OVS devices is huge, resulting in inefficient traffic matching process and affecting network performance.

Method used

By analyzing each rule in the flow table rule set, obtaining matching field information, processing multiple rules based on the merge rules, reducing the number of flow table rules, realizing fast and efficient merging, and reducing the memory load of network switching devices and matching time of flow table rules.

Benefits of technology

Improve traffic forwarding efficiency and reduce the memory load and flow table rules matching time of network switching devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120583022A_ABST
    Figure CN120583022A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and particularly provides a flow table rule merging method and device, and the method comprises the steps: obtaining a flow table rule set; each flow table rule in the flow table rule set is analyzed, an analysis result of each flow table rule is obtained, the analysis result comprises a matching field information set composed of multiple pieces of original matching field information in the flow table rules, and the original matching field information comprises type identification character strings and field values of matching fields; processing the matched field information set of the plurality of flow table rules based on a flow table merging rule to obtain an updated flow table rule set; the flow table rule merging difficulty can be reduced, the flow table rule storage load of the network switching equipment is reduced, and the data forwarding efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for merging flow table rules. Background Art

[0002] With the development of cloud computing and virtualization technology, Software-Defined Networking (SDN) has become a key component of data center network architecture. Among them, Open vSwitch (OVS) is a network switching device widely used in SDN environments. It interacts with other devices in the SDN network through flow table rules to achieve flexible control of network traffic.

[0003] However, in large-scale deployments, the number of flow table rules on OVS devices is usually very large, resulting in inefficient traffic matching, affecting traffic processing efficiency and causing overall network performance degradation. Summary of the Invention

[0004] The embodiments of the present application provide a flow table rule merging method and device, which reduces the flow table rule storage load of a network switching device.

[0005] In a first aspect, a flow table rule merging method is provided, comprising:

[0006] Get the flow table rule set;

[0007] Parsing each flow table rule in the flow table rule set to obtain a parsing result of each flow table rule, wherein the parsing result includes a matching field information set consisting of multiple original matching field information in the flow table rule;

[0008] Matching field information sets of multiple flow table rules are processed based on the flow table merging rule to obtain an updated flow table rule set, wherein the number of flow table rules in the updated flow table rule set is less than the number of flow table rules in the flow table rule set.

[0009] By adopting the above technical solution, each flow table rule in the flow table rule set is parsed to obtain a solution result, and the original matching field information of the matching field in the parsing result of each flow table rule is directly processed based on the flow table merging rule, thereby realizing fast and efficient merging of flow table rules, reducing the difficulty of merging flow table rules, and at the same time, reducing the data volume of flow table rules in network switching equipment, thereby reducing the memory load of network switching equipment, and reducing the flow table rule matching time in the process of data packet forwarding, thereby improving traffic forwarding efficiency.

[0010] Optionally, the original matching field information includes a type identification string and a field value of the matching field, and the processing of the matching field information set of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set includes:

[0011] Traversing the matching field information sets of the plurality of flow table rules, if matching fields with the same field values ​​exist in at least two flow table rules, determining the at least two flow table rules as at least two first flow table rules to be merged;

[0012] Determining a first merged flow table rule based on original matching field information of a first type of matching field in any of the first flow table rules to be merged, and original matching field information of a second type of matching field in at least two of the first flow table rules to be merged, wherein in the at least two first flow table rules to be merged, the field values ​​of the first type of matching field are the same, and the field values ​​of the second type of matching field are different;

[0013] The first merged flow table rule and the non-first flow table rules to be merged among the multiple flow table rules are combined into an updated flow table rule set.

[0014] Optionally, determining the first merged flow table rule based on the original matching field information of the first type of matching field in any of the first flow table rules to be merged, and the original matching field information of the second type of matching field in the first flow table rules to be merged of at least two flows, includes:

[0015] If the field value in the original matching field information of the second-type matching field in the first to-be-merged flow table rules of at least two flows meets the field value merging condition associated with the second-type matching field, then the second-type matching field is determined as the first mergeable matching field;

[0016] Processing at least two field values ​​of the first mergeable matching field based on a field value merge rule associated with the first mergeable matching field to obtain a first merged field value of the first mergeable matching field;

[0017] Based on the character arrangement format of the flow table rules, original matching field information of the first type of matching field and first merged matching field information of the first mergeable matching field in any of the first flow table rules to be merged are combined to obtain a first merged flow table rule, wherein the field value in the first merged matching field information is the first merged field value.

[0018] Optionally, determining the first merged flow table rule based on the original matching field information of the first type of matching field in any of the first flow table rules to be merged, and the original matching field information of the second type of matching field in the first flow table rules to be merged of at least two flows, includes:

[0019] If the first-category matching field is a first target matching field, and the second-category matching field is a second target matching field, determining that the original matching field information of the second-category matching field is filterable original matching field information;

[0020] Based on the character arrangement format of the flow table rules, original matching field information of the first type of matching fields in any of the first flow table rules to be merged is combined to obtain a first merged flow table rule.

[0021] Optionally, the process of processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set includes:

[0022] Traversing the matching field information sets of the plurality of flow table rules, if at least two field values ​​of the same type of matching fields in at least two flow table rules meet the field value merging condition associated with the same type of matching fields, determining the same type of matching fields as second mergeable matching fields, and determining the at least two flow table rules as at least two second flow table rules to be merged;

[0023] Based on the field value merging rule associated with the second mergeable matching field, processing at least two field values ​​of the second mergeable matching field in the at least two second flow table rules to be merged, to obtain a second merged field value of the second mergeable matching field;

[0024] Based on the character arrangement format of the flow table rule, combining the second merged matching field information of the second mergeable matching field, the at least two second flow table rules to be merged, and the original matching field information of the non-second mergeable matching field, to obtain a second merged flow table rule, wherein the field value in the second merged matching field information is the second merged field value;

[0025] The second merged flow table rule and the non-second flow table rules to be merged among the multiple flow table rules are combined into an updated flow table rule set.

[0026] Optionally, the process of processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set includes:

[0027] Collecting the matching field information of each flow table rule, sorting the type identification string and field value of each matching field according to a preset matching field sorting rule to obtain multiple matching field information sequences;

[0028] Traversing multiple matching field information sequences, if a common prefix exists in at least two matching field information sequences, determining the at least two matching field information sequences having the common prefix as at least two matching field information sequences to be merged, wherein the common prefix includes a type identification string and a field value of at least one matching field;

[0029] Determining a third merge flow table rule based on the original matching field information of the third type of matching field in the common prefix of any of the matching field information sequences to be merged, and the original matching field information of the fourth type of matching field in the non-common prefixes of the at least two matching field information sequences to be merged;

[0030] The third merged flow table rule and the flow table rules associated with the non-to-be-merged matching field information sequence are combined into an updated flow table rule set.

[0031] Optionally, the process of processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set includes:

[0032] Determine the hash value of the field value sequence consisting of the field values ​​of multiple matching fields in the matching field information set of each flow table rule;

[0033] If it is determined based on the hash value that there are at least two third flow table rules to be merged among the multiple flow table rules, then based on the original matching field information of the fifth type of matching field in any of the third flow table rules to be merged, and the original matching field information of the sixth type of matching field in at least two of the third flow table rules to be merged, determine the fourth merged flow table rule, wherein the difference between the hash values ​​respectively associated with the at least two third flow table rules to be merged is less than or equal to the hash difference threshold, and in at least two of the third flow table rules to be merged, the field values ​​of the fifth type of matching field are the same, and the field values ​​of the sixth type of matching field are different;

[0034] The fourth merged flow table rule and the non-third flow table rules to be merged among the multiple flow table rules are combined into an updated flow table rule set.

[0035] Optionally, the parsing result further includes a field value of an action field of each flow table rule. Before processing the matching field information set of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set, the method further includes:

[0036] Determine the multiple flow table rules having the same field value of the action field as multiple first flow table rules to be processed;

[0037] The process of processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set includes:

[0038] The updated flow table rule set is determined based on the matching field information sets of the plurality of first flow table rules to be processed.

[0039] Optionally, obtaining the flow table rule set includes:

[0040] Obtain the flow table rule set in the network switching device;

[0041] The method further comprises:

[0042] The updated flow table rule set is sent to the network switching device.

[0043] In a second aspect, an embodiment of the present application provides a flow table rule merging device, including:

[0044] A rule collection module is configured to obtain a flow table rule set;

[0045] a rule parsing module configured to parse each flow table rule in the flow table rule set to obtain a parsing result for each flow table rule, wherein the parsing result includes a matching field information set consisting of a plurality of original matching field information in the flow table rule;

[0046] The rule merging module processes the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set, wherein the number of flow table rules in the updated flow table rule set is less than the number of flow table rules in the flow table rule set.

[0047] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method described in the first aspect.

[0048] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the method described in the first aspect when executed by a processor.

[0049] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.

[0050] It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the technology as claimed. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The above and other purposes, features, and advantages of the present application will become more apparent through a more detailed description of the embodiments of the present application in conjunction with the accompanying drawings. The accompanying drawings are intended to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the drawings, the same reference numerals generally represent the same components or steps.

[0052] Figure 1 This is a schematic diagram of an implementation scenario of a flow table rule merging method in an embodiment of the present application.

[0053] Figure 2 This is a flowchart of a flow table rule merging method according to an embodiment of the present application.

[0054] Figure 3 This is a block diagram of a flow table rule merging device according to an embodiment of the present application.

[0055] Figure 4 is a schematic diagram illustrating a computer program product according to an embodiment of the present application.

[0056] Figure 5 FIG. 1 is a hardware block diagram illustrating an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0057] The following describes embodiments of the present application in more detail with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are for illustrative purposes only and are not intended to limit the scope of protection of the present application.

[0058] It should be understood that the various steps described in the method embodiments of the present application can be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.

[0059] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0060] It should be noted that the modifications of "one" and "multiple" mentioned in this application are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".

[0061] The names of the messages or information exchanged between multiple devices in the embodiments of the present application are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0062] In order to solve the above problems, the present invention provides a method for merging flow table rules. Figure 1 FIG. 1 shows a schematic diagram of an implementation scenario of a flow table rule merging method according to an exemplary embodiment of the present application; FIG. Figure 1 As shown, the implementation scenario 100 includes a network switching device 101, a first network device 102 and a second network device 103, wherein the first network device 102 and the second network device 103 are electronic devices in the SDN network that need to exchange data based on the network switching device 101, and the network switching device 101 is a traffic switching device in the SDN network, which is used to forward data packets from the first network device 102 to the second network device 103 based on the flow table rules, or to send data packets from the second network device 103 to the first network device 102 based on the flow table rules; by way of example, the first network device 102 can be a virtual machine, and the number of virtual machines can include multiple, and the second network device 103 can be a network interface card (NIC) device.

[0063] like Figure 1 As shown, a communication link can be established between the network switching device 101 and the first network device 102, and between the network switching device 101 and the second network device 103, so that the network switching device forwards data packets based on flow table rules.

[0064] Optionally, the flow table rule merging method provided in the embodiment of the present application can be executed in the network switching device 101, and the network switching device 101 can forward data packets based on the merged flow table rules.

[0065] Alternatively, the implementation scenario provided in the embodiment of the present application may also include a terminal device ( Figure 1(not shown), a communication link can be established between the terminal device and the network switching device 101, so that the terminal device can merge the flow table rules obtained from the second network device based on the flow table rule merging method provided in the embodiment of the present application, and return the merged flow table rules to the network switching device 101, so that the network switching device 101 can forward data packets based on the merged flow table rules; the terminal device can be an electronic device such as a computer, a notebook, a tablet computer or a server, and specifically, it can be determined based on actual needs, and the embodiment of the present application does not limit this.

[0066] Figure 2 A flow chart of a flow table rule merging method according to an exemplary embodiment of the present application is shown as follows: Figure 2 As shown, the method of the embodiment of the present application may include:

[0067] Step S201, obtaining a flow table rule set;

[0068] Step S202: parse each flow table rule in the flow table rule set to obtain a parsing result for each flow table rule;

[0069] The parsing result includes a matching field information set consisting of multiple original matching field information in the flow table rule;

[0070] Step S203: Processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set;

[0071] The number of flow table rules in the updated flow table rule set is smaller than the number of flow table rules in the flow table rule set.

[0072] To sum up, the flow table rule merging method provided in the embodiment of the present application parses each flow table rule in the flow table rule set to obtain a solution result, and directly processes the original matching field information of the matching field in the parsing result of each flow table rule based on the flow table merging rule, thereby realizing fast and efficient merging of flow table rules, reducing the difficulty of merging flow table rules, and at the same time, reducing the data volume of flow table rules in the network switching device, thereby reducing the memory load of the network switching device, and reducing the flow table rule matching time in the data packet forwarding process, thereby improving traffic forwarding efficiency.

[0073] The following Figure 2 The specific implementation of each step in the embodiment shown is described in detail:

[0074] In step S201, a flow table rule set is obtained.

[0075] In an embodiment of the present application, a flow table rule may generally include a match field and an action field, etc. The match field is used to identify the characteristics of a specific data flow, and the match field may include multiple different types, for example, a source physical address (Media Access Control Address, MAC) address, a source Internet Protocol address (Internet Protocol Address, IP) address, a destination MAC address, a destination IP address, a port number, a virtual local area network (Virtual Local Area Network, VLAN) tag, and a protocol type, etc., wherein the protocol type may be the Transmission Control Protocol (Transmission Control Protocol, TCP) protocol, the User Datagram Protocol (User Datagram Protocol, UDP), and the Internet Control Message Protocol (Internet Control Message Protocol, ICMP), etc.; the action field is used to identify the operation performed on the data packet, and the action field may be forwarding, discarding, modifying fields, or statistics, etc.

[0076] In an optional embodiment, in a scenario where the terminal device executes the flow table rule merging method, the process of obtaining the flow table rule set includes: the terminal device sends a flow table rule acquisition request to the network switching device, and receives the flow table rule set returned by the network switching device.

[0077] It should be noted that, in the embodiment of the present disclosure, the flow table rule set configured in the network switching device can be updated by the user. In order to ensure that the flow table rule set in the network switching device can be merged in a timely manner, the terminal device can send a flow table rule acquisition request to the network switching device in response to detecting a flow table rule update instruction to obtain the flow table rule set; or, the terminal device can periodically send a flow table rule acquisition request to the network switching device to obtain the flow table rule set, wherein the flow table rule update instruction detected by the terminal device can be input by the user, and the periodic interval at which the terminal device sends the flow table rule acquisition request to the network switching device can be determined based on actual needs, and the embodiment of the present disclosure does not limit this; wherein, the network switching device is pre-configured with multiple flow table rules. After the network switching device receives the flow table rule acquisition request sent by the terminal device, it sends the multiple flow table rules to the terminal device to facilitate the terminal device to merge the flow table rules.

[0078] Among them, the terminal device can obtain the flow table rule set based on the ovs-ofctl command line tool or the programming interface provided by OVS, and store the flow table rule set in a data structure such as a list or dictionary for easy merging.

[0079] In an optional implementation, in a scenario where a network switching device executes a flow table rule merging method, the process of obtaining a flow table rule set includes: the network switching device reading a flow table rule set stored in the network switching device to obtain the flow table rule set.

[0080] Among them, the flow table rule set configured in the network switching device can be updated by the user. In order to ensure that the flow table rule set in the network switching device can be merged in a timely manner, the network switching device can periodically read the flow table rule set stored in the network switching device to facilitate periodic updating of the flow table rule set.

[0081] In step S202, each flow table rule in the flow table rule set is parsed to obtain a parsing result of each flow table rule.

[0082] In an embodiment of the present disclosure, the parsing result includes a matching field information set consisting of multiple original matching field information in the flow table rule, and the original matching field information includes a type identification string and a field value of the matching field, wherein the type identification string is used to distinguish different matching fields, for example, the type identification string of the source IP address is: ip_src, the type identification string of the source IP address is: ip_dst, etc.; the field value in the original matching field information is the field value configured when the network switching device is configured with the flow table rule. The field value in the flow table rule configured in the network switching device is determined by the user based on the actual application scenario of the network switching device, and the embodiment of the present disclosure does not limit this.

[0083] In an optional embodiment, the process of parsing each flow table rule in the flow table rule set and obtaining the parsing result of each flow table rule may include: parsing each flow table rule in the flow table rule set based on the character arrangement format of the flow table rule and obtaining the parsing result of each flow table rule.

[0084] Among them, the character arrangement format of the flow table rule refers to the specific character arrangement specification followed by the flow table rule, which is usually composed of type identification strings and field values ​​of multiple matching fields. Specifically, it can be determined based on actual needs. The embodiment of the present disclosure does not limit this. For example, the character arrangement format can be: the type identification string and field value of the matching field are connected with an equal sign, and different matching fields are separated by commas.

[0085] In step S203, the matching field information sets of multiple flow table rules are processed based on the flow table merging rule to obtain an updated flow table rule set.

[0086] In the embodiment of the present disclosure, the number of flow table rules in the updated flow table rule set is smaller than the number of flow table rules in the flow table rule set.

[0087] In an optional embodiment, the terminal device processes the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set, which includes: traversing the matching field information sets of the multiple flow table rules, and if there are matching fields with the same field values ​​in at least two flow table rules, then the at least two flow table rules with the same matching fields with the same field values ​​are determined as at least two first flow table rules to be merged; then, based on the original matching field information of the first type of matching fields in any of the first flow table rules to be merged, and the original matching field information of the second type of matching fields in at least two of the first flow table rules to be merged, the first merged flow table rule is determined, wherein, in the at least two first flow table rules to be merged, the field values ​​of the first type of matching fields are the same, and the field values ​​of the second type of matching fields are different; further, the first merged flow table rule and the non-first flow table rules to be merged in the multiple flow table rules are combined into an updated flow table rule set. When the field values ​​of the matching fields of at least two flow table rules among multiple flow table rules are the same, it can be determined that there are flow table rules that can be merged among the multiple flow table rules, and based on the original matching field information of the first type of matching fields with the same field values ​​and the original matching field information of the second type of matching fields with different field values ​​in the at least two mergeable flow table rules, the new merged rule is determined to ensure that the merged flow table rule contains the rule elements in each flow table rule before the merge, thereby ensuring the reliability of the merged flow table rule.

[0088] In an optional embodiment, the terminal device determines a first merged flow table rule based on the original matching field information of the first type of matching field in any of the first flow table rules to be merged, and the original matching field information of the second type of matching field in at least two of the first flow table rules to be merged, including: if the field value in the original matching field information of the second type of matching field in at least two of the first flow table rules to be merged meets the field value merging condition associated with the second type of matching field, then the second type of matching field is determined as the first mergeable matching field; then, based on the field value merging rule associated with the first mergeable matching field, at least two field values ​​of the first mergeable matching field are processed to obtain the first merged field value of the first mergeable matching field; further, based on the character arrangement format of the flow table rule, the original matching field information of the first type of matching field in any of the first flow table rules to be merged and the first merged matching field information of the first mergeable matching field are combined to obtain the first merged flow table rule, wherein the field value in the first merged matching field information is the first merged field value. After determining at least two flow table rules to be merged, in the at least two flow table rules to be merged, if the field values ​​of the matching fields with different field values ​​meet the field value merging conditions, the matching fields with different field values ​​can be merged based on the field value merging rules associated with the matching fields, thereby further reducing the data volume of the merged flow table rules, so as to reduce the data storage pressure of the network switching equipment.

[0089] It should be noted that in the embodiment of the present disclosure, the field value merging conditions and field value merging rules associated with the matching field can be determined based on the type of the matching field, and the embodiment of the present disclosure does not limit this; usually, the field value merging conditions and field value merging rules associated with different matching fields are different, and the field value merging conditions and field value merging rules associated with different matching fields can be pre-configured in the terminal device.

[0090] For example, for the target IP address, the merging condition of the field values ​​associated with the target IP address is: determine whether at least two IP addresses belong to the same parent IP address; the merging rule of the field values ​​associated with the target IP address is: determine the field value of the target IP address as the parent IP address, and establish an association relationship between the field value of each target IP address before the merge and the destination port value before the merge.

[0091] For example, if the destination IP addresses 10.0.0.1 and 10.0.0.2 belong to the same parent address 10.0.0.0 / 8, then in at least two first flow table rules to be merged, when the field values ​​in the original matching field information of the destination IP address are 10.0.0.1 and 10.0.0.2, the first merged field value is determined to be 10.0.0.0 / 8, and the target IP address 10.0.0.1 is associated with the port value in the first flow table rule to which 10.0.0.1 belongs, and the target IP address 10.0.0.2 is associated with the port value in the first flow table rule to which 10.0.0.2 belongs.

[0092] In an optional embodiment, the terminal device determines the first merged flow table rule based on the original matching field information of the first type of matching field in any of the first flow table rules to be merged, and the original matching field information of the second type of matching field in at least two of the first flow table rules to be merged, including: if the first type of matching field is the first target matching field, and the second type of matching field is the second target matching field, then determining that the original matching field information of the second type of matching field is the filterable original matching field information; then, based on the character arrangement format of the flow table rule, combining the original matching field information of the first type of matching field in any of the first flow table rules to be merged to obtain the first merged flow table rule. After determining at least two flow table rules to be merged, if there is an ignorable matching field in the field values ​​of the matching fields with different field values ​​in the at least two flow table rules to be merged, the field values ​​of the ignorable matching fields with different field values ​​can be filtered to reduce the data volume of the merged flow table rules and further reduce the data storage pressure of the network switching device.

[0093] It should be noted that in the embodiment of the present disclosure, the first target matching field and the second target matching field can be determined based on actual needs, and the embodiment of the present disclosure does not limit this; for example, the first target matching field includes the source IP address and the destination port, and the second target matching field is: port number.

[0094] In an optional embodiment, the terminal device processes the matching field information sets of multiple flow table rules based on the flow table merging rule, and the process of obtaining the updated flow table rule set may include: traversing the matching field information sets of the multiple flow table rules, if at least two field values ​​of the same matching fields in at least two flow table rules meet the field value merging condition associated with the same matching fields, then determining the same matching fields as second mergeable matching fields, and determining at least two flow table rules as at least two second flow table rules to be merged; then, based on the field value merging rule associated with the second mergeable matching field, processing the at least two second flow table rules to be merged. In the rule, the second mergeable matching field has at least two field values, and a second merged field value of the second mergeable matching field is obtained; further, based on the character arrangement format of the flow table rule, the second merged matching field information of the second mergeable matching field and the original matching field information of the at least two second flow table rules to be merged and the non-second mergeable matching field are combined to obtain a second merged flow table rule, wherein the field value in the second merged matching field information is the second merged field value; finally, the second merged flow table rule and the non-second flow table rules to be merged in the multiple flow table rules are combined into an updated flow table rule set. When the field values ​​of various matching fields in multiple flow table rules are different, the field values ​​of the matching fields whose field values ​​can be merged can be merged according to the preset field value merging conditions and rules, so as to reduce the data volume of the flow table rules when the field values ​​of the same type of matching fields in the flow table rules are different.

[0095] In an optional embodiment, the process of the terminal device processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set may also include: sorting the type identification string and field value of each matching field in the matching field information set of each flow table rule according to a preset matching field sorting rule to obtain multiple matching field information sequences; then, traversing the multiple matching field information sequences, if there is a common prefix in at least two matching field information sequences, determining the at least two matching field information sequences with the common prefix as at least two matching field information sequences to be merged, wherein the common prefix includes the type identification string and field value of at least one matching field; further, based on the original matching field information of the third type of matching field in the common prefix of any matching field information sequence to be merged, and the original matching field information of the fourth type of matching field in the non-common prefix of the at least two matching field information sequences to be merged, determine a third merged flow table rule; finally, combine the third merged flow table rule and the flow table rules associated with the non-to-be-merged matching field information sequences into an updated flow table rule set. The type identification strings and field values ​​of multiple matching rules of each flow table rule can be sorted according to the preset matching field sorting rules to obtain multiple matching field information sequences, so that the terminal device can quickly identify at least two matching field information sequences with a common prefix, and based on the same field values ​​of similar matching fields in the common prefix, and the different field values ​​of similar matching fields in the non-common prefix, the flow table rules can be merged accurately and quickly.

[0096] It can be understood that in the embodiment of the present disclosure, in the common prefix of at least two matching field information sequences to be merged, the field values ​​in the original matching field information of the same type of third matching fields are the same, and in the non-common prefix of at least two matching field information sequences to be merged, the field values ​​in the original matching field information of the same type of fourth matching fields are different; then the terminal device determines the process of the third merged flow table rule based on the original matching field information of the third type of matching field in the common prefix of any matching field information sequence to be merged, and the original matching field information of the fourth type of matching field in the non-common prefix of the at least two matching field information sequences to be merged. The above-mentioned embodiment can refer to the process of the terminal device determining the first merged flow table rule based on the original matching field information of the first type of matching field in any of the first flow table rules to be merged, and the original matching field information of the second type of matching field in at least two flows of the first flow table rules to be merged. The embodiment of the present disclosure will not elaborate on this.

[0097] Among them, the matching field sorting rules can be determined based on actual needs, and the embodiments of the present disclosure do not limit this. For example, in the matching field information set of each flow table rule, the type identification string and field value of each matching field are sorted in the order of protocol type, source IP address, destination IP address, source port and destination port.

[0098] In an optional embodiment, the terminal device processes the matching field information sets of multiple flow table rules based on the flow table merging rule, and the process of obtaining the updated flow table rule set may also include: determining the hash value of the field value sequence composed of the field values ​​of multiple matching fields in the matching field information set of each flow table rule; then, if it is determined based on the hash value that there are at least two third flow table rules to be merged in the multiple flow table rules, then based on the original matching field information of the fifth type of matching field in any of the third flow table rules to be merged, and the original matching field information of the sixth type of matching field in at least two of the third flow table rules to be merged, determine the fourth merged flow table rule, wherein the difference between the hash values ​​associated with the at least two third flow table rules to be merged is less than or equal to the hash difference threshold, and in at least two of the third flow table rules to be merged, the field values ​​of the fifth type of matching field are the same, and the field values ​​of the sixth type of matching field are different; further, the fourth merged flow table rule and the non-third flow table rules to be merged in the multiple flow table rules are combined into an updated flow table rule set. Based on the hash value of the field value sequence of each flow table rule, at least two flow table rules whose hash value difference is less than the hash value difference threshold can be determined as flow table rules to be merged with the same field value. In combination with the similar matching fields with the same field values ​​in the flow table rules to be merged, and the similar matching fields with different field values, the flow table rules can be merged. Since the flow table rules to be merged can be quickly screened out based on the hash value, the flow table rules can be merged quickly and efficiently.

[0099] The hash difference threshold may be determined based on actual needs, and the embodiments of the present disclosure do not limit this.

[0100] It can be understood that in the embodiment of the present disclosure, the process of the terminal device determining the fourth merged flow table rule based on the original matching field information of the fifth type of matching field in any of the third flow table rules to be merged, and the original matching field information of the sixth type of matching field in at least two of the third flow table rules to be merged can refer to the above-mentioned embodiment, in which the terminal device determines the first merged flow table rule based on the original matching field information of the first type of matching field in any of the first flow table rules to be merged, and the original matching field information of the second type of matching field in at least two of the first flow table rules to be merged. The embodiment of the present disclosure does not elaborate on this.

[0101] It should be noted that, for multiple flow table rules, the terminal device can merge multiple flow table rules multiple times based on each merge rule processing scheme in the above embodiment to further reduce the number of flow table rules in the merged updated flow table rule set.

[0102] In an optional embodiment, the parsing result also includes the field value of the action field of each flow table rule. Before processing the matching field information set of multiple flow table rules based on the flow table merging rule to obtain the updated flow table rule set, the terminal device can also: determine the multiple flow table rules with the same field value of the action field as multiple first flow table rules to be processed; then the process of the terminal device processing the matching field information set of multiple flow table rules based on the flow table merging rule to obtain the updated flow table rule set includes: determining the updated flow table rule set based on the matching field information set of the multiple first flow table rules to be processed. Flow table rules with the same execution action for data packets can be merged to prevent the merging of flow table rules with different execution actions for data packets, thereby further improving the reliability of the merged flow table rules.

[0103] In an optional embodiment, the parsing result also includes the field value of the action field of each flow table rule. Before processing the matching field information set of multiple flow table rules based on the flow table merging rule to obtain the updated flow table rule set, the terminal device may also: determine multiple flow table rules with the same priority as multiple second flow table rules to be processed; then the process of the terminal device processing the matching field information set of multiple flow table rules based on the flow table merging rule to obtain the updated flow table rule set includes: determining the updated flow table rule set based on the matching field information set of the multiple second flow table rules to be processed. Flow table rules of the same priority can be merged to increase the diversity of applicable scenarios for the flow table rule merging solution.

[0104] It can be understood that the terminal device determines the updated flow table rule set based on the matching field information set of the multiple first flow table rules to be processed, or determines the updated flow table rule set based on the matching field information set of the multiple second flow table rules to be processed. The process can refer to the above embodiment, in which the terminal device processes the matching field information set of multiple flow table rules based on the flow table merging rule to obtain the updated flow table rule set. This embodiment of the present disclosure will not elaborate on this.

[0105] In an optional embodiment, in a scenario where the terminal device executes the flow table rule merging method, after the terminal device obtains the updated flow table rule set, it can also send the updated flow table rule set to the network switching device, so that the network switching device can obtain the merged flow table rules through the sending and receiving of the flow table rule set, without having to execute the flow table rule merging process itself, which can reduce the resource consumption of the network switching device.

[0106] For example, this application takes the scenario in which the flow table rule merging method is executed on a terminal device as an example to schematically illustrate the flow table rule merging method in this application. It is assumed that the flow table rule set obtained by the terminal device from the network switching device includes flow table rule A, flow table rule B, flow table rule C, flow table rule D, flow table rule E and flow table rule F.

[0107] Flow table rule A is interpreted as: match all packets with source IP address 192.168.1.0 / 24 and forward them to port 1;

[0108] Flow table rule B is interpreted as: match all packets with a destination IP address of 10.0.0.0 / 8 and forward them to port 2;

[0109] Flow table rule C is interpreted as: match all packets with a destination IP address of 10.0.0.1 and forward them to port 3;

[0110] Flow table rule D is interpreted as: match all packets with source IP address 192.168.1.0 / 24 and destination port 80, and forward them to port 1;

[0111] Flow table rule E is interpreted as: match all packets with source IP address 192.168.2.0 / 24 and forward them to port 4;

[0112] Flow table rule F is interpreted as: match all packets with a destination IP address of 10.0.0.2 and forward them to port 5.

[0113] For the above flow table rule set, the terminal device merges flow table rule A and flow table rule D with the same source IP address 192.168.1.0 / 24 and the same receiving port 1 to obtain a merged flow table rule G, where the merged flow table rule G is interpreted as: matching all data packets with a source IP address of 192.168.1.0 / 24 and a destination port number of any value, and forwarding them to port 1. The updated flow table rule set includes: flow table rule B, flow table rule C, merged flow table rule G, flow table rule E, and flow table rule F.

[0114] Furthermore, the terminal device can determine that the destination IP addresses in flow table rule C and flow table rule F are both single IP addresses within 10.0.0.0 / 8, then merge flow table rule C and flow table rule F to obtain merged flow table rule H, where merged flow table rule H is interpreted as: match all destination IP addresses with 10.0.0.0 / 8, and forward data packets with destination IP address 10.0.0.1 to port 3, or forward data packets with destination IP address 10.0.0.2 to port 5; then the updated flow table rule set after further update includes: flow table rule B, merged flow table rule H, merged flow table rule G, and flow table rule E.

[0115] Furthermore, the terminal device can merge the flow table rule B and the merged flow table rule H with the same destination IP address to obtain the merged flow table rule I. The new flow table rule I is interpreted as: matching all destination IP addresses of 10.0.0.0 / 8, and forwarding data packets with a destination IP address of 10.0.0.1 to port 3, or forwarding data packets with a destination IP address of 10.0.0.2 to port 5, or forwarding data packets other than 10.0.0.2 and 10.0.0.1 to port 2; then the updated flow table rule set includes: merged flow table rule I, merged flow table rule G and flow table rule E.

[0116] The exemplary embodiment of the present application provides a flow table rule merging device, which can be applied to a terminal device. Figure 3 FIG. 1 shows a schematic block diagram of the functional modules of a flow table rule merging device according to an exemplary embodiment of the present application. Figure 3 As shown, the flow table rule merging device 300 includes:

[0117] A rule collection module 301 is configured to obtain a flow table rule set;

[0118] a rule parsing module 302 configured to parse each flow table rule in the flow table rule set to obtain a parsing result for each flow table rule, wherein the parsing result includes a matching field information set consisting of a plurality of original matching field information in the flow table rule;

[0119] The rule merging module 303 processes the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set, wherein the number of flow table rules in the updated flow table rule set is less than the number of flow table rules in the flow table rule set.

[0120] Optionally, the original matching field information includes a type identification string and a field value of the matching field, and the rule merging module 303 is configured to:

[0121] Traversing the matching field information sets of the plurality of flow table rules, if matching fields with the same field values ​​exist in at least two flow table rules, determining the at least two flow table rules as at least two first flow table rules to be merged;

[0122] Determining a first merged flow table rule based on original matching field information of a first type of matching field in any of the first flow table rules to be merged, and original matching field information of a second type of matching field in at least two of the first flow table rules to be merged, wherein in the at least two first flow table rules to be merged, the field values ​​of the first type of matching field are the same, and the field values ​​of the second type of matching field are different;

[0123] The first merged flow table rule and the non-first flow table rules to be merged among the multiple flow table rules are combined into an updated flow table rule set.

[0124] Optionally, the rule merging module 303 is configured to:

[0125] If the field value in the original matching field information of the second-type matching field in the first to-be-merged flow table rules of at least two flows meets the field value merging condition associated with the second-type matching field, then the second-type matching field is determined as the first mergeable matching field;

[0126] Processing at least two field values ​​of the first mergeable matching field based on a field value merge rule associated with the first mergeable matching field to obtain a first merged field value of the first mergeable matching field;

[0127] Based on the character arrangement format of the flow table rules, original matching field information of the first type of matching field and first merged matching field information of the first mergeable matching field in any of the first flow table rules to be merged are combined to obtain a first merged flow table rule, wherein the field value in the first merged matching field information is the first merged field value.

[0128] Optionally, the rule merging module 303 is configured to:

[0129] If the first-category matching field is a first target matching field, and the second-category matching field is a second target matching field, determining that the original matching field information of the second-category matching field is filterable original matching field information;

[0130] Based on the character arrangement format of the flow table rules, original matching field information of the first type of matching fields in any of the first flow table rules to be merged is combined to obtain a first merged flow table rule.

[0131] Optionally, the rule merging module 303 is configured to:

[0132] Traversing the matching field information sets of the plurality of flow table rules, if at least two field values ​​of the same type of matching fields in at least two flow table rules meet the field value merging condition associated with the same type of matching fields, determining the same type of matching fields as second mergeable matching fields, and determining the at least two flow table rules as at least two second flow table rules to be merged;

[0133] Based on the field value merging rule associated with the second mergeable matching field, processing at least two field values ​​of the second mergeable matching field in the at least two second flow table rules to be merged, to obtain a second merged field value of the second mergeable matching field;

[0134] Based on the character arrangement format of the flow table rule, combining the second merged matching field information of the second mergeable matching field, the at least two second flow table rules to be merged, and the original matching field information of the non-second mergeable matching field, to obtain a second merged flow table rule, wherein the field value in the second merged matching field information is the second merged field value;

[0135] The second merged flow table rule and the non-second flow table rules to be merged among the multiple flow table rules are combined into an updated flow table rule set.

[0136] Optionally, the rule merging module 303 is configured to:

[0137] Collecting the matching field information of each flow table rule, sorting the type identification string and field value of each matching field according to a preset matching field sorting rule to obtain multiple matching field information sequences;

[0138] Traversing multiple matching field information sequences, if a common prefix exists in at least two matching field information sequences, determining the at least two matching field information sequences having the common prefix as at least two matching field information sequences to be merged, wherein the common prefix includes a type identification string and a field value of at least one matching field;

[0139] Determining a third merge flow table rule based on the original matching field information of the third type of matching field in the common prefix of any of the matching field information sequences to be merged, and the original matching field information of the fourth type of matching field in the non-common prefixes of the at least two matching field information sequences to be merged;

[0140] The third merged flow table rule and the flow table rules associated with the non-to-be-merged matching field information sequence are combined into an updated flow table rule set.

[0141] Optionally, the rule merging module 303 is configured to:

[0142] Determine the hash value of the field value sequence consisting of the field values ​​of multiple matching fields in the matching field information set of each flow table rule;

[0143] If it is determined based on the hash value that there are at least two third flow table rules to be merged among the multiple flow table rules, then based on the original matching field information of the fifth type of matching field in any of the third flow table rules to be merged, and the original matching field information of the sixth type of matching field in at least two of the third flow table rules to be merged, determine the fourth merged flow table rule, wherein the difference between the hash values ​​respectively associated with the at least two third flow table rules to be merged is less than or equal to the hash difference threshold, and in at least two of the third flow table rules to be merged, the field values ​​of the fifth type of matching field are the same, and the field values ​​of the sixth type of matching field are different;

[0144] The fourth merged flow table rule and the non-third flow table rules to be merged among the multiple flow table rules are combined into an updated flow table rule set.

[0145] Optionally, the parsing result also includes the field value of the action field of each flow table rule, such as Figure 3 As shown, the apparatus further includes a screening module 304 configured to:

[0146] Determine the multiple flow table rules having the same field value of the action field as multiple first flow table rules to be processed;

[0147] The process of processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set includes:

[0148] The updated flow table rule set is determined based on the matching field information sets of the plurality of first flow table rules to be processed.

[0149] Optionally, the rule collection module 301 is configured to:

[0150] Obtain the flow table rule set in the network switching device;

[0151] like Figure 3 As shown, the apparatus further includes a sending module 305 configured to:

[0152] The updated flow table rule set is sent to the network switching device.

[0153] An exemplary embodiment of the present application further provides a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present application.

[0154] like Figure 4 As shown, the exemplary embodiment of the present application further provides a computer program product 400, including a computer program 401, wherein when the computer program is executed by a processor of a computer, it is used to enable the computer to perform the method according to the embodiment of the present application.

[0155] The exemplary embodiments of the present application further provide an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, wherein the computer program, when executed by the at least one processor, causes the electronic device to perform a method according to an embodiment of the present application.

[0156] refer to Figure 5 , a block diagram of an electronic device 500 that can serve as a terminal device or network switching device of the present application will now be described. This is an example of a hardware device that can be applied to various aspects of the present application. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.

[0157] like Figure 5 As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. Various programs and data required for the operation of the electronic device 500 can also be stored in the RAM 503. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0158] Multiple components within electronic device 500 are connected to I / O interface 505, including an input unit 506, an output unit 507, a storage unit 508, and a communication unit 509. Input unit 506 can be any type of device capable of inputting information into electronic device 500. Input unit 506 can receive input numeric or character information and generate key input signals related to user settings and / or function control of the electronic device. Output unit 507 can be any type of device capable of presenting information and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. Storage unit 508 may include, but is not limited to, a magnetic disk or an optical disk. Communication unit 509 allows electronic device 500 to exchange information / data with other devices via computer networks such as the Internet and / or various telecommunication networks and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver and / or chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0159] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units for running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above. For example, in some embodiments, the method of the exemplary embodiment of the present application may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via the ROM 502 and / or the communication unit 509. In some embodiments, the computing unit 501 may be configured to perform the method of the exemplary embodiment of the present application by any other appropriate means (e.g., by means of firmware).

[0160] The program code for implementing the methods of the present application can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the program code is executed by the processor or controller, the functions / operations specified in the flow charts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0161] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0162] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., magnetic disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0163] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0164] In the above embodiments, they can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, they can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is performed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a terminal, a user device or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer program or instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired or wireless means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, a hard disk, or a tape; it can also be an optical medium, such as a digital video disc (DVD); it can also be a semiconductor medium, such as a solid state drive (SSD).

[0165] Although the present application has been described with reference to specific features and embodiments thereof, it is apparent that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely illustrative of the present application as defined by the appended claims and are deemed to cover any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, the present application is intended to include such modifications and variations as fall within the scope of the claims of the present application and their equivalents.

Claims

1. A flow table rule merging method, characterized in that: include: Get the flow table rule set; Parsing each flow table rule in the flow table rule set to obtain a parsing result of each flow table rule, wherein the parsing result includes a matching field information set consisting of multiple original matching field information in the flow table rule; Matching field information sets of multiple flow table rules are processed based on the flow table merging rule to obtain an updated flow table rule set, wherein the number of flow table rules in the updated flow table rule set is less than the number of flow table rules in the flow table rule set.

2. The flow table rule merging method according to claim 1, characterized in that: The original matching field information includes a type identification string and a field value of the matching field. The matching field information set of multiple flow table rules is processed based on the flow table merging rule to obtain an updated flow table rule set, including: Traversing the matching field information sets of the plurality of flow table rules, if matching fields with the same field values ​​exist in at least two flow table rules, determining the at least two flow table rules as at least two first flow table rules to be merged; Determining a first merged flow table rule based on original matching field information of a first type of matching field in any of the first flow table rules to be merged, and original matching field information of a second type of matching field in at least two of the first flow table rules to be merged, wherein in the at least two first flow table rules to be merged, the field values ​​of the first type of matching field are the same, and the field values ​​of the second type of matching field are different; The first merged flow table rule and the non-first flow table rules to be merged among the multiple flow table rules are combined into an updated flow table rule set.

3. The flow table rule merging method according to claim 2, characterized in that: The determining the first merged flow table rule based on the original matching field information of the first type of matching field in any of the first flow table rules to be merged, and the original matching field information of the second type of matching field in the first flow table rules to be merged of at least two flows, includes: If the field value in the original matching field information of the second-type matching field in the first to-be-merged flow table rules of at least two flows meets the field value merging condition associated with the second-type matching field, then the second-type matching field is determined as the first mergeable matching field; Processing at least two field values ​​of the first mergeable matching field based on a field value merge rule associated with the first mergeable matching field to obtain a first merged field value of the first mergeable matching field; Based on the character arrangement format of the flow table rules, original matching field information of the first type of matching field and first merged matching field information of the first mergeable matching field in any of the first flow table rules to be merged are combined to obtain a first merged flow table rule, wherein the field value in the first merged matching field information is the first merged field value.

4. The flow table rule merging method according to claim 2, characterized in that: The determining the first merged flow table rule based on the original matching field information of the first type of matching field in any of the first flow table rules to be merged, and the original matching field information of the second type of matching field in the first flow table rules to be merged of at least two flows, includes: If the first-category matching field is a first target matching field, and the second-category matching field is a second target matching field, determining that the original matching field information of the second-category matching field is filterable original matching field information; Based on the character arrangement format of the flow table rules, original matching field information of the first type of matching fields in any of the first flow table rules to be merged is combined to obtain a first merged flow table rule.

5. The flow table rule merging method according to claim 2, characterized in that: The process of processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set includes: Traversing the matching field information sets of the plurality of flow table rules, if at least two field values ​​of the same type of matching fields in at least two flow table rules meet the field value merging condition associated with the same type of matching fields, determining the same type of matching fields as second mergeable matching fields, and determining the at least two flow table rules as at least two second flow table rules to be merged; Based on the field value merging rule associated with the second mergeable matching field, processing at least two field values ​​of the second mergeable matching field in the at least two second flow table rules to be merged, to obtain a second merged field value of the second mergeable matching field; Based on the character arrangement format of the flow table rule, combining the second merged matching field information of the second mergeable matching field, the at least two second flow table rules to be merged, and the original matching field information of the non-second mergeable matching field, to obtain a second merged flow table rule, wherein the field value in the second merged matching field information is the second merged field value; The second merged flow table rule and the non-second flow table rules to be merged among the multiple flow table rules are combined into an updated flow table rule set.

6. The flow table rule merging method according to claim 1, characterized in that: The process of processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set includes: Collecting the matching field information of each flow table rule, sorting the type identification string and field value of each matching field according to a preset matching field sorting rule to obtain multiple matching field information sequences; Traversing multiple matching field information sequences, if a common prefix exists in at least two matching field information sequences, determining the at least two matching field information sequences having the common prefix as at least two matching field information sequences to be merged, wherein the common prefix includes a type identification string and a field value of at least one matching field; Determining a third merge flow table rule based on the original matching field information of the third type of matching field in the common prefix of any of the matching field information sequences to be merged, and the original matching field information of the fourth type of matching field in the non-common prefixes of the at least two matching field information sequences to be merged; The third merged flow table rule and the flow table rules associated with the non-to-be-merged matching field information sequence are combined into an updated flow table rule set.

7. The flow table rule merging method according to claim 1, characterized in that: The process of processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set includes: Determine the hash value of the field value sequence consisting of the field values ​​of multiple matching fields in the matching field information set of each flow table rule; If it is determined based on the hash value that there are at least two third flow table rules to be merged among the multiple flow table rules, then based on the original matching field information of the fifth type of matching field in any of the third flow table rules to be merged, and the original matching field information of the sixth type of matching field in at least two of the third flow table rules to be merged, determine the fourth merged flow table rule, wherein the difference between the hash values ​​respectively associated with the at least two third flow table rules to be merged is less than or equal to the hash difference threshold, and in at least two of the third flow table rules to be merged, the field values ​​of the fifth type of matching field are the same, and the field values ​​of the sixth type of matching field are different; The fourth merged flow table rule and the non-third flow table rules to be merged among the multiple flow table rules are combined into an updated flow table rule set.

8. The flow table rule merging method according to claim 1, characterized in that: The parsing result also includes a field value of an action field of each flow table rule. Before processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set, the method further includes: Determine the multiple flow table rules having the same field value of the action field as multiple first flow table rules to be processed; The process of processing the matching field information sets of multiple flow table rules based on the flow table merging rule to obtain an updated flow table rule set includes: The updated flow table rule set is determined based on the matching field information sets of the plurality of first flow table rules to be processed.

9. The flow table rule merging method according to claim 1, characterized in that: The obtaining of the flow table rule set includes: Obtain the flow table rule set in the network switching device; The method further comprises: The updated flow table rule set is sent to the network switching device.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory, wherein: The processor executes the computer program to implement the method according to any one of claims 1 to 9.

Citation Information

Cited By

  • Dynamic self-adaptive flow table neural index optimization method, device and equipment

    CN121436133A