Routing configuration tree generation method and system
By extracting field cross-sparseness characteristics, using machine learning model scoring and differentiated path construction strategies, the path explosion problem in the routing configuration tree is solved, and the generation efficiency and matching performance is improved. It is suitable for large-scale data centers and high-performance network devices.
Patent Information
- Application Number
- CN202510815555.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-08-15
AI Technical Summary
In the prior art, when building a routing configuration tree based on field priority, due to the complex field cross-match relationship between rules, the tree structure grows exponentially, consumes memory resources, slow configuration generation, decreases matching efficiency, and complex update and maintenance, especially in large-scale data centers or high-performance network devices.
By extracting the cross-field and the sparseness characteristics of field value, the machine learning model is used to calculate the combination complexity score of rules, and the rule set is divided into two categories: high complexity and low complexity. The path aggregation strategy and field priority hierarchy strategy are used to build the routing configuration tree separately, and merge it into a rule table entry format that can be recognized by the device.
It significantly improves the generation efficiency and matching performance of routing configurations, alleviates the problem of path explosion, improves the scalability and maintainability of the system, and is suitable for large-scale data centers and high-performance network environments.
Smart Images

Figure CN120499089A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of routing configuration trees, and in particular to a routing configuration tree generation method and system. Background Art
[0002] Routing configuration tree generation involves constructing a logical structure tree within network devices (such as routers) based on predefined routing policies and configuration rules. This structure helps efficiently organize and manage the routing decision process, enabling devices to quickly match and select the optimal forwarding path based on the destination address, improving network routing efficiency and scalability.
[0003] The existing technology has the following shortcomings:
[0004] In existing technologies, when building routing configuration trees based on field priorities, complex cross-field matching relationships between rules require a single rule to be replicated to multiple child nodes within a multi-layered structure, resulting in exponential growth in the tree structure. This not only severely consumes memory resources but also leads to slow configuration generation, reduced matching efficiency, and complex updates and maintenance, especially in large-scale data centers or high-performance network equipment. Summary of the Invention
[0005] The purpose of the present invention is to provide a method and system for generating a routing configuration tree to solve the deficiencies in the background technology.
[0006] In order to achieve the above object, the present invention provides the following technical solution: a method for generating a routing configuration tree, comprising:
[0007] Acquire and pre-process an original rule set including a plurality of routing rules, wherein the rule set includes a plurality of fields, wherein the fields include a source address, a destination address, and port information;
[0008] Extracting features for measuring the complexity of field combinations from the rule set, including inter-field intersection features and field value sparsity features;
[0009] Based on the inter-field intersection feature and the field value sparsity feature, a combined complexity score of each rule is calculated, and the rule set is divided into a high-complexity rule set and a low-complexity rule set according to the complexity score;
[0010] For highly complex rule sets, a path aggregation construction strategy is used to construct a partial routing configuration tree;
[0011] For low-complexity rule sets, a hierarchical construction strategy based on field priority is adopted to generate a regular configuration tree path;
[0012] The optimized path constructed by high-complexity rules is merged with the regular path constructed by low-complexity rules to form a logical routing configuration tree, which is then output in a rule table format that can be recognized by the device.
[0013] Preferably, the IP address field is converted into CIDR format and into a 32-bit binary prefix representation; the port field is uniformly converted into a closed interval format; and the protocol field is converted into a corresponding standard protocol number.
[0014] Preferably, the method for obtaining the degree of intersection between fields is as follows: select two fields F1 and F2, traverse all rules, and construct a mapping relationship between field values: for each Count the corresponding differences Quantity, recorded as Calculate the average mapping degree The expression is: Similarly calculate the reverse direction The crossover degree SE between fields takes the maximum value: Where |F1| is the number of unique values of field F1.
[0015] Preferably, the method for obtaining the sparsity of field values is as follows: for field F, traverse the rule set and count each unique value f i Number of occurrences c i ; Get the frequency distribution set of field values: {f1: c1, f2: c2, ..., f n :c n}; n is the number of unique values of the field; calculate the total number of occurrences T of all field values, the expression is: Converted to probability: Calculate the sparsity of field values. The expression is: Where G is the sparsity of field values.
[0016] Preferably, based on the inter-field intersection feature and the field value sparsity feature, the combined complexity score of each rule is calculated, and the rule set is divided into a high-complexity rule set and a low-complexity rule set according to the complexity score, specifically including:
[0017] The field intersection and field value sparsity are converted into comprehensive feature vectors, which are used as inputs of the machine learning model. The machine learning model uses each set of comprehensive feature vectors to predict the combined complexity score label of each rule as the prediction target, and takes minimizing the sum of the prediction errors of the combined complexity score labels of all rules as the training target. The machine learning model is trained until the sum of the prediction errors reaches convergence, and the model training is stopped. The combined complexity score of each rule is determined based on the model output results. The machine learning model is a polynomial regression model.
[0018] Preferably, the obtained combined complexity score of each rule is compared with a preset threshold. If the combined complexity score of each rule is greater than or equal to the preset threshold, it means that the combined complexity of the rules is high, and the rule set is divided into a high-complexity rule set; if the combined complexity score of each rule is less than the preset threshold, it means that the combined complexity of the rules is low, and the rule set is divided into a low-complexity rule set.
[0019] Preferably, the path aggregation construction strategy includes: clustering or interval merging field values; constructing a shared intermediate node path; and inserting jump nodes at path branches to identify high-complexity path structures.
[0020] Preferably, the hierarchical construction strategy based on field priority adopts a multi-dimensional interval decision graph structure, specifically including: constructing a multi-layer node graph according to the preset field order; merging the paths of nodes of multiple rules on the same field interval; and generating child nodes using a path factorization strategy at the divergence point.
[0021] Preferably, the optimized path constructed by high-complexity rules is merged with the regular path constructed by low-complexity rules, including: for structurally incompatible path branches, path identifiers are inserted to distinguish high-complexity paths from low-complexity paths, and the matching action and priority information of each rule are retained during the merging process.
[0022] The present invention also provides a routing configuration tree generation system, which includes a rule acquisition and preprocessing module, a complexity feature extraction module, a combination complexity scoring and classification module, a path aggregation construction module, a hierarchical construction module, and a path merging and rule generation module;
[0023] Rule acquisition and preprocessing module: acquires and preprocesses an original rule set containing multiple routing rules, wherein the rule set includes multiple fields, including source address, destination address and port information;
[0024] Complexity feature extraction module: extracts features for measuring the complexity of field combinations from the rule set, including inter-field intersection features and field value sparsity features;
[0025] Combination complexity scoring and classification module: Based on the inter-field intersection feature and the field value sparsity feature, the combination complexity score of each rule is calculated, and the rule set is divided into a high-complexity rule set and a low-complexity rule set according to the complexity score;
[0026] Path aggregation construction module: For highly complex rule sets, it uses path aggregation construction strategies to build partial routing configuration trees;
[0027] Hierarchical construction module: For low-complexity rule sets, a hierarchical construction strategy based on field priority is adopted to generate a regular configuration tree path;
[0028] Path merging and rule generation module: Merges the optimized path constructed by high-complexity rules with the regular path constructed by low-complexity rules to form a logical routing configuration tree, and outputs it in a rule table format that can be recognized by the device.
[0029] In the above technical solution, the technical effects and advantages provided by the present invention are:
[0030] 1. This invention introduces two structural features: inter-field intersection and field value sparsity. Combined with a machine learning model, it accurately assesses the combinatorial complexity of rules and intelligently classifies rule sets accordingly, achieving a differentiated routing configuration tree construction strategy. High-complexity rules use a path aggregation strategy to reduce redundant nodes and path duplication, while low-complexity rules use a field priority hierarchical strategy to build a clear and efficient configuration structure, fundamentally alleviating the path explosion problem that traditional configuration trees encounter when fields intersect.
[0031] 2. By structurally integrating two types of rule paths and outputting them in a device-recognizable table format, this invention significantly improves routing configuration generation efficiency, matching performance, and maintainability, making it particularly suitable for large-scale data centers and high-performance network environments. The overall solution offers excellent engineering practicality, scalability, and deployment flexibility, making it suitable for widespread application in network management systems at the SDN controller, hardware switching chip, and operating system layers. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments described in the present invention. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0033] Figure 1 This is a mind map of the method of the present invention.
[0034] Figure 2 This is a mind map of the system modules of the present invention. DETAILED DESCRIPTION
[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0036] Example 1, please refer to Figure 1 As shown, the method for generating a routing configuration tree described in this embodiment includes:
[0037] Acquire and pre-process an original rule set including a plurality of routing rules, wherein the rule set includes a plurality of fields, wherein the fields include a source address, a destination address, and port information;
[0038] Extracting features for measuring the complexity of field combinations from the rule set, including inter-field intersection features and field value sparsity features;
[0039] Based on the inter-field intersection feature and the field value sparsity feature, a combined complexity score of each rule is calculated, and the rule set is divided into a high-complexity rule set and a low-complexity rule set according to the complexity score;
[0040] For highly complex rule sets, a path aggregation construction strategy is used to construct a partial routing configuration tree;
[0041] For low-complexity rule sets, a hierarchical construction strategy based on field priority is adopted to generate a regular configuration tree path;
[0042] The optimized path constructed by high-complexity rules is merged with the regular path constructed by low-complexity rules to form a logical routing configuration tree, which is then output in a rule table format that can be recognized by the device.
[0043] Dynamically extract routing rules through network policy control systems, centralized controllers (such as SDN controllers), configuration files, or network device interfaces (such as Netconf, RESTful API);
[0044] Each rule record contains at least the following fields:
[0045] Source IP address: expressed in CIDR format, for example, 192.168.0.0 / 16;
[0046] Destination IP address: also expressed in CIDR format.
[0047] Protocol type (Protocol): such as TCP, UDP, ICMP, usually represented by an 8-bit protocol number;
[0048] Source Port and Destination Port: integer or range, such as 80 or 1000–2000;
[0049] Action: such as forwarding to a certain interface, discarding, redirecting, etc.
[0050] Priority: used for decision making between conflicting rules.
[0051] Unified field representation: For example, the IP field is converted to a 32-bit binary prefix format; the port field is converted to a closed interval [start, end];
[0052] Handling wildcards and arbitrary matching items: For example, "any" or "*" are uniformly converted to full ranges (for example, 0.0.0.0 / 0 represents any IP address);
[0053] Protocol number conversion: convert protocol names to standard numbers (such as TCP → 6, UDP → 17);
[0054] Check the legitimacy of the IP address and eliminate format errors (such as invalid prefix length, illegal characters, etc.);
[0055] Filter out incomplete rules (missing required fields) or redundant rules (exact duplicates);
[0056] Normalize the port range (e.g., [80,80] is simplified to a single value 80);
[0057] Convert the processed rule set into a structured data table or JSON tree structure.
[0058] In this application, the preprocessing step not only ensures data quality and field standardization, but also provides structured input for subsequent complexity scoring, rule classification, and configuration tree construction, which helps to significantly improve the overall routing configuration performance and stability.
[0059] Features for measuring the complexity of field combinations are extracted from the rule set, including inter-field intersection features and field value sparsity features, specifically including:
[0060] Inter-field overlap measures the degree of overlap between two different field value combinations in a rule. It reflects whether there are numerous non-one-to-one relationships between field combinations—that is, whether the value of one field is associated with the values of multiple other fields.
[0061] The method for obtaining the cross-degree between fields is as follows: select two fields F1 and F2, such as source IP and destination IP, traverse all rules, and build a mapping relationship between field values: for each Count the corresponding differences Quantity, recorded as Calculate the average mapping degree
[0062] The expression is: Similarly calculate the reverse direction
[0063] The crossover degree SE between fields takes the maximum value: Where |F1| is the number of unique values of field F1. The higher the inter-field intersection, the more complex the inter-field mapping is and the greater the risk of path explosion.
[0064] A high degree of overlap between fields indicates a high degree of many-to-many relationship between the two fields. For example, one source IP address corresponds to multiple destination IP addresses, and one destination IP address corresponds to multiple source IP addresses. This high degree of overlap prevents rules from being simply layered and split within the configuration tree. Each rule may be copied across multiple branch paths, significantly increasing the width and depth of the tree structure. This increases the complexity of rule combinations, path redundancy, and resource consumption.
[0065] Conversely, when the degree of overlap between fields is smaller, the combination relationship between fields tends to be one-to-one or one-to-many. Rules can be more clearly organized hierarchically according to field priority, with fewer branches and lower duplication. In this case, the routing configuration tree is easier to compress, path merging is more efficient, and the overall structure is simpler, resulting in lower combination complexity and more efficient matching and updating.
[0066] The method for obtaining the sparsity of field values is as follows: for field F (such as destination port), traverse the rule set and count each unique value f i Number of occurrences c i ; Get the frequency distribution set of field values: {f1: c1, f2: c2, ..., f n :c n}; n is the number of unique values of the field; calculate the total number of occurrences T of all field values, the expression is: Converted to probability:
[0067] Calculate the sparsity of field values. The expression is: Where G is the sparsity of field values.
[0068] When field value sparsity increases, the field's values are more dispersed within its theoretical range, indicating a large number of infrequent or unique values. This reduces the chances of shared field values between rules, making it more difficult to merge paths when building the routing configuration tree. Each rule may occupy a single branch, easily leading to path explosion. Therefore, fields with high sparsity generally indicate higher rule combination complexity.
[0069] Conversely, when field value sparsity decreases, the field's value distribution becomes more concentrated, making it more likely that multiple rules will share the same field value or value range, thus forming merged paths or aggregated nodes in the configuration tree. This concentrated distribution reduces the likelihood of path splits, making the configuration tree more compact and efficient, resulting in relatively low combination complexity.
[0070] Based on the inter-field intersection feature and the field value sparsity feature, the combined complexity score of each rule is calculated, and the rule set is divided into a high-complexity rule set and a low-complexity rule set according to the complexity score, specifically including:
[0071] The field intersection and field value sparsity are converted into comprehensive feature vectors, which are used as inputs of the machine learning model. The machine learning model uses each set of comprehensive feature vectors to predict the combined complexity score label of each rule as the prediction target, and takes minimizing the sum of the prediction errors of the combined complexity score labels of all rules as the training target. The machine learning model is trained until the sum of the prediction errors reaches convergence, and the model training is stopped. The combined complexity score of each rule is determined based on the model output results. The machine learning model is a polynomial regression model.
[0072] The obtained combined complexity score of each rule is compared with the preset threshold. If the combined complexity score of each rule is greater than or equal to the preset threshold, it means that the combined complexity of the rules is high, and the rule set is divided into a high-complexity rule set; if the combined complexity score of each rule is less than the preset threshold, it means that the combined complexity of the rules is low, and the rule set is divided into a low-complexity rule set.
[0073] For highly complex rule sets, a path aggregation construction strategy is used to construct part of the routing configuration tree. To avoid exponential expansion of configuration tree nodes due to sparse field combinations and severe cross-over between rules, the tree structure is compressed to the greatest extent possible through path sharing and rule merging. By leveraging the structural similarity and aggregation between rule fields, mergeable node paths are identified during the construction process, generating a tree structure with shared intermediate nodes, rather than generating independent branches for each rule. Specifically, this includes:
[0074] Cluster or range aggregate the field values in the rules (such as IP prefixes and port ranges); merge continuous or similar field values.
[0075] Build aggregation nodes based on the aggregation field values, and each node can match multiple rules;
[0076] If multiple rules have the same matching fields in the first two levels and differ only in the last level field, they share the same prefix path and only split the last level node.
[0077] Introducing compressed indexes at the logic layer using methods such as jump tree structures or Bloom filters + path mapping tables;
[0078] Supports jumping to rule subsets through path identifiers, reducing the actual tree depth and width.
[0079] Attach multiple rule-action mapping tables to leaf nodes; introduce priority sorting or matching condition judgment to ensure that action conflicts in multi-rule aggregation nodes are controllable.
[0080] In the present invention, the path aggregation strategy is particularly suitable for rule sets with high combination complexity, sparse fields and severe cross-talk, and has high practical value in applications such as high-performance routers, ACL management, and SDN controllers.
[0081] For low-complexity rule sets, a hierarchical construction strategy based on field priority is adopted to generate a regular configuration tree path, specifically including:
[0082] Determine the order of fields used to build the tree structure, such as: source IP (Q1) → destination IP (Q2) → port (Q3) → protocol (Q4); this order will determine the arrangement of the decision layers in the graph structure.
[0083] Convert each rule into a standard interval representation:
[0084] IP prefix → binary interval (e.g. CIDR / 24 → [192.168.1.0, 192.168.1.255]);
[0085] Port range → closed interval (such as [1000,2000]);
[0086] All fields participate in subsequent composition in the form of intervals.
[0087] Starting from the highest priority field (Q1), we build the top-level node and then build a multi-layer graph structure field by field.
[0088] Each layer of nodes represents an interval segment of a field, and each node connects multiple sub-intervals of the next level of fields;
[0089] If multiple rules share a field interval, they share the same node to avoid redundancy.
[0090] Utilizing the non-tree characteristics of the graph structure, nodes on the same field path of different rules are merged;
[0091] For example, if two rules are exactly the same in Q1 and Q2 intervals and differ only in Q3, they share nodes in the first two paths; applying the path factorization strategy, new branches are created only at the divergence points.
[0092] Bind rule actions (such as forwarding, discarding, etc.) to the leaf nodes of the graph;
[0093] If multiple rules fall on the same leaf node, they are sorted by priority field for conflict resolution;
[0094] Supports node internal action mapping table and fast search mechanism.
[0095] The optimized path constructed by high-complexity rules is merged with the regular path constructed by low-complexity rules to form a logical routing configuration tree, which is then output in a rule table format that can be recognized by the device.
[0096] The two types of routing rule path structures constructed by different strategies: the optimized path corresponding to high-complexity rules (such as path aggregation structure) and the conventional path corresponding to low-complexity rules (such as multi-layer structure based on field priority) are unified and integrated to form a consistent logical routing configuration tree structure, and finally output into a rule table format that can be recognized by network devices, such as TCAM items, OpenFlow table items or ACL rule lines.
[0097] In the merged configuration tree: the upper structure is uniformly organized by field priority, for example, in the order of source IP → destination IP → port; intermediate nodes allow the insertion of path identifiers or index nodes for jumping to optimized sub-paths or aggregation nodes; leaf nodes store rule action information and priority control.
[0098] During the construction of high-complexity rule-optimized paths and low-complexity conventional paths, their respective path nodes are marked (e.g., HCR stands for High Complexity Route, LCR stands for Low Complexity Route) so that they can be processed differently when merging.
[0099] Align the field levels of the two types of paths to ensure that they follow a unified field matching order;
[0100] For the aggregation nodes in the optimized path, an intermediate index table is constructed to map their field ranges to ensure compatibility with the regular path;
[0101] If necessary, a jump node is inserted at the path interface as the entrance to the high-complexity path.
[0102] Merge layer by layer starting from the root node: If two paths have the same interval or prefix at a certain field level, directly merge their child nodes; if the paths conflict (such as structural incompatibility), retain the two path branches and distinguish them with identifiers; during the merging process, retain the action information and priority control of each path to prevent overlap.
[0103] A rule-action list is constructed at the merged leaf node, including the matching conditions (field combinations), corresponding actions (such as forward, drop, and redirect), and priority values. If multiple rules are aggregated to the same leaf node, they are sorted by priority, or conflict resolution mechanisms (such as matching order control) are used.
[0104] Supported output formats include: OpenFlow table entry structure (for SDN controllers); TCAM binary-encoded rule entries (for hardware switching chips); and ACL / firewall rule list format (for operating systems or software switches).
[0105] This embodiment provides a routing configuration tree generation method that proposes differentiated path construction strategies for routing rule sets of varying complexity. First, a comprehensive feature vector is constructed by extracting two types of features: inter-field intersection and field value sparsity. A polynomial regression model is then used to calculate the combined complexity score for each rule. Then, based on the scoring results, the rule set is divided into high-complexity and low-complexity categories. The corresponding sub-path structures are constructed using a path aggregation strategy and a field priority tiering strategy, respectively. Finally, the two types of path structures are unified and integrated to form a logical routing configuration tree, which is then output in a device-recognizable rule table format. This method can effectively alleviate the path explosion problem, improve routing configuration efficiency, and enhance system scalability.
[0106] Example 2, please refer to Figure 2 As shown, the routing configuration tree generation system described in this embodiment includes a rule acquisition and preprocessing module, a complexity feature extraction module, a combination complexity scoring and classification module, a path aggregation construction module, a hierarchical construction module, and a path merging and rule generation module;
[0107] Rule acquisition and preprocessing module: acquires and preprocesses an original rule set containing multiple routing rules, wherein the rule set includes multiple fields, including source address, destination address and port information;
[0108] Complexity feature extraction module: extracts features for measuring the complexity of field combinations from the rule set, including inter-field intersection features and field value sparsity features;
[0109] Combination complexity scoring and classification module: Based on the inter-field intersection feature and the field value sparsity feature, the combination complexity score of each rule is calculated, and the rule set is divided into a high-complexity rule set and a low-complexity rule set according to the complexity score;
[0110] Path aggregation construction module: For highly complex rule sets, it uses path aggregation construction strategies to build partial routing configuration trees;
[0111] Hierarchical construction module: For low-complexity rule sets, a hierarchical construction strategy based on field priority is adopted to generate a regular configuration tree path;
[0112] Path merging and rule generation module: Merges the optimized path constructed by high-complexity rules with the regular path constructed by low-complexity rules to form a logical routing configuration tree, and outputs it in a rule table format that can be recognized by the device.
[0113] The above formulas are all dimensionless and numerical calculations. The formulas are obtained by collecting a large amount of data and performing software simulation to obtain the most recent real situation. The preset parameters in the formulas are set by technicians in this field according to actual conditions.
[0114] It should be understood that the term "and / or" as used herein simply describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. A and B can be singular or plural. Furthermore, the character " / " as used herein generally indicates an "or" relationship between the associated objects, but it may also indicate an "and / or" relationship. For specific understanding, please refer to the context.
[0115] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0116] The above is only a specific implementation method of the present application, but the scope of protection of the present application is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered by the scope of protection of the present application.
Claims
1. A method for generating a routing configuration tree, characterized in that: include: Acquire and pre-process an original rule set including a plurality of routing rules, wherein the rule set includes a plurality of fields, wherein the fields include a source address, a destination address, and port information; Extracting features for measuring the complexity of field combinations from the rule set, including inter-field intersection features and field value sparsity features; Based on the inter-field intersection feature and the field value sparsity feature, a combined complexity score of each rule is calculated, and the rule set is divided into a high-complexity rule set and a low-complexity rule set according to the complexity score; For highly complex rule sets, a path aggregation construction strategy is used to construct a partial routing configuration tree; For low-complexity rule sets, a hierarchical construction strategy based on field priority is adopted to generate a regular configuration tree path; The optimized path constructed by high-complexity rules is merged with the regular path constructed by low-complexity rules to form a logical routing configuration tree, which is then output in a rule table format that can be recognized by the device.
2. A method for generating a routing configuration tree according to claim 1, characterized in that: Convert the IP address field into CIDR format and into a 32-bit binary prefix representation; convert the port field into a closed interval format; and convert the protocol field into the corresponding standard protocol number.
3. A method for generating a routing configuration tree according to claim 1, characterized in that: The method for obtaining the intersection degree between fields is as follows: select two fields and, traverse all rules, and build a mapping relationship between field values: for each, count the corresponding different numbers, recorded as; Calculate the average mapping degree, the expression is:; Similarly calculate the reverse direction; the cross degree SE between fields takes the maximum value:; Where is the number of unique values of the field.
4. A method for generating a routing configuration tree according to claim 3, characterized in that: The method for obtaining the sparsity of field values is as follows: for field F, traverse the rule set and count the number of times each unique value appears; Get the frequency distribution set of field values: ; n is the number of unique values of the field; Calculate the total number of occurrences of all field values. The expression is:; Convert to probability:; Calculate the field value sparsity using the expression: where G is the field value sparsity.
5. A method for generating a routing configuration tree according to claim 4, characterized in that: Based on the inter-field intersection feature and the field value sparsity feature, the combined complexity score of each rule is calculated, and the rule set is divided into a high-complexity rule set and a low-complexity rule set according to the complexity score, specifically including: The field intersection and field value sparsity are converted into comprehensive feature vectors, which are used as inputs of the machine learning model. The machine learning model uses each set of comprehensive feature vectors to predict the combined complexity score label of each rule as the prediction target, and takes minimizing the sum of the prediction errors of the combined complexity score labels of all rules as the training target. The machine learning model is trained until the sum of the prediction errors reaches convergence, and the model training is stopped. The combined complexity score of each rule is determined based on the model output results. The machine learning model is a polynomial regression model.
6. A method for generating a routing configuration tree according to claim 5, characterized in that: The obtained combined complexity score of each rule is compared with the preset threshold. If the combined complexity score of each rule is greater than or equal to the preset threshold, it means that the combined complexity of the rules is high, and the rule set is divided into a high-complexity rule set; if the combined complexity score of each rule is less than the preset threshold, it means that the combined complexity of the rules is low, and the rule set is divided into a low-complexity rule set.
7. A method for generating a routing configuration tree according to claim 6, characterized in that: The path aggregation construction strategy includes: clustering or interval merging field values; constructing a shared intermediate node path; and inserting jump nodes at path branches to identify high-complexity path structures.
8. A method for generating a routing configuration tree according to claim 7, characterized in that: The hierarchical construction strategy based on field priority adopts a multi-dimensional interval decision graph structure, which specifically includes: constructing a multi-layer node graph according to the preset field order; merging the paths of nodes on the same field interval of multiple rules; and generating child nodes using a path factorization strategy at the divergence point.
9. A method for generating a routing configuration tree according to claim 8, characterized in that: The optimized path constructed by high-complexity rules is merged with the regular path constructed by low-complexity rules, including: for structurally incompatible path branches, path identifiers are inserted to distinguish high-complexity paths from low-complexity paths, and the matching action and priority information of each rule are retained during the merging process.
10. A routing configuration tree generation system, configured to implement a routing configuration tree generation method according to any one of claims 1 to 9, characterized in that: It includes rule acquisition and preprocessing module, complexity feature extraction module, combination complexity scoring and classification module, path aggregation construction module, hierarchical construction module and path merging and rule generation module; Rule acquisition and preprocessing module: acquires and preprocesses an original rule set containing multiple routing rules, wherein the rule set includes multiple fields, including source address, destination address and port information; Complexity feature extraction module: extracts features for measuring the complexity of field combinations from the rule set, including inter-field intersection features and field value sparsity features; Combination complexity scoring and classification module: Based on the inter-field intersection feature and the field value sparsity feature, the combination complexity score of each rule is calculated, and the rule set is divided into a high-complexity rule set and a low-complexity rule set according to the complexity score; Path aggregation construction module: For highly complex rule sets, it uses path aggregation construction strategies to build partial routing configuration trees; Hierarchical construction module: For low-complexity rule sets, a hierarchical construction strategy based on field priority is adopted to generate a regular configuration tree path; Path merging and rule generation module: Merges the optimized path constructed by high-complexity rules with the regular path constructed by low-complexity rules to form a logical routing configuration tree, and outputs it in a rule table format that can be recognized by the device.