A method and device for network element inverse calculation data splitting

By finely splitting the tree structure of the network element inverse calculation configuration file and generating a key subtree based on preset keyword tags for node types, the problems of large memory consumption and low processing efficiency in existing technologies are solved, achieving more efficient data splitting and searching.

CN115168296BActive Publication Date: 2026-02-24WUHAN FIBERHOME TECHNICAL SERVICES CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210894777.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-28
Publication Date
2026-02-24
Estimated Expiration
2042-07-28

AI Technical Summary

Technical Problem

Existing network element inverse calculation methods suffer from high memory consumption and low processing efficiency due to their coarse-grained decomposition.

Method used

A fine-grained method for splitting network element inverse calculation data is adopted. By traversing the tree structure of the network element inverse calculation configuration file, the tree structure is split into key subtrees according to the preset keyword tag node type, and corresponding data entries are generated, preserving the hierarchical relationship and reducing redundant data.

Benefits of technology

It achieves lower memory usage and higher search or statistical efficiency, and provides fine-grained, customizable data splitting to adapt to different network management needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115168296B_ABST
    Figure CN115168296B_ABST
Patent Text Reader

Abstract

The present application relates to the field of communication network management, in particular to a method and device for splitting network element reverse calculation data. Mainly comprising: traversing the tree structure corresponding to the network element reverse calculation configuration file, each node of the tree structure corresponding to a data item in the configuration file; marking the node type of each node according to the preset keyword; according to the node type and the relationship between each node and the keyword node, the tree structure is split into at least one keyword subtree, there is only one keyword node in each keyword subtree, each keyword subtree contains all ancestors and descendants of the keyword node in the tree structure corresponding to the configuration file, and keyword sibling nodes meeting the preset characteristics; generating the data entry of the corresponding preset keyword according to the nodes contained in the keyword subtree. The present application can make the redundant data after splitting less under the premise of ensuring that each data entry information is complete, the dependency relationship is complete and the content is not lost.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] This invention relates to the field of communication network management, and in particular to a method and apparatus for back-calculating data splitting of network elements. [Background Technology]

[0002] In the process of network management of devices, in addition to configuring the devices, the network management system also needs to read the device configuration for analysis and management. The process of obtaining device configuration is achieved through network element back-calculation. To maintain consistency between the network management system and the device configuration data, it is necessary to read the full configuration on the device for comparison with the network management configuration. For devices using the YANG model, the full configuration of the device is encrypted and compressed into a single configuration file before being reported to the network management system. The network management system needs to extract the configuration data to be compared from the full configuration of the device, compare the device configuration data with the network management configuration data, and then synchronize the selected device configuration data to the network management system.

[0003] The existing method for extracting configuration data involves splitting a single configuration file into different configuration files based on configuration block types, and then converting each configuration block into a Protocol Buffers (PB) data model for network management. For example, all interface-related data in the configuration file is split into an interface configuration block and then converted into a large PB data structure. This approach has a coarse-grained splitting granularity, and in many scenarios, the split interface configuration block still contains data from hundreds of interfaces. Generating a PB data structure from this data results in a large data volume, which consumes significant memory because the entire PB data structure needs to be generated in memory. Furthermore, the large PB data structure makes data searching and statistics inconvenient; searching for specific interface data or counting the number of a certain type of interface requires traversing the entire PB data structure, leading to low efficiency.

[0004] Therefore, how to overcome the shortcomings of existing technologies and solve the processing inconvenience caused by existing network element inverse calculation methods is a problem to be solved in this technical field. [Summary of the Invention]

[0005] In view of the above-mentioned defects or improvement needs of the existing technology, the present invention solves the problems of large memory consumption and low processing efficiency caused by the coarse splitting granularity of the existing network element inverse calculation method.

[0006] The embodiments of the present invention adopt the following technical solutions:

[0007] Firstly, the present invention provides a method for splitting network element reverse calculation data, specifically comprising: traversing the tree structure corresponding to the network element reverse calculation configuration file, wherein each node of the tree structure corresponds to a data item in the configuration file; marking the node type of each node according to a preset keyword, wherein each preset keyword is unique in the business logic, and the node type includes keyword nodes, keyword ancestor nodes, keyword descendant nodes, and keyword sibling nodes; splitting the tree structure into at least one keyword subtree according to the node type and the relationship between each node and the keyword node, wherein each keyword subtree contains one and only one keyword node, and each keyword subtree contains all ancestors and descendants of the keyword node in the tree structure corresponding to the configuration file, as well as keyword sibling nodes that conform to preset characteristics; and generating data entries for the corresponding preset keywords according to the nodes contained in the keyword subtree.

[0008] Preferably, the node type of each node is marked according to a preset keyword, specifically including: when the name of the traversed node matches the preset keyword, the node is marked as a keyword node; for each keyword node, all its ancestor nodes are traversed, and the traversed ancestor nodes are marked as keyword ancestor nodes.

[0009] Preferably, marking the traversed ancestor node as a keyword ancestor node further includes: when the traversed ancestor node corresponds to a preset keyword that is different from the keyword node, the preset keyword corresponding to the keyword ancestor node is no longer used as a preset keyword.

[0010] Preferably, the tree structure is split into at least one key subtree, specifically including: retaining the key node in the corresponding key subtree, with each key node corresponding to a unique key subtree; adding the descendant nodes of the key node to the corresponding key subtree according to the hierarchical relationship of the tree structure in the configuration file; adding the ancestor node of the key node to the corresponding key subtree according to the hierarchical relationship of the tree structure in the configuration file; and adding the sibling node of the key node to the key subtree containing the key node that satisfies the condition of the lowest common ancestor at the lowest level according to the hierarchical relationship of the tree structure in the configuration file.

[0011] Preferably, the keyword ancestor node is added to the corresponding keyword subtree according to the hierarchical relationship of the tree structure in the configuration file, and the keyword sibling node is added to the keyword subtree containing the keyword node that satisfies the condition of the lowest common ancestor at the lowest level according to the hierarchical relationship of the tree structure in the configuration file. It also includes: when the keyword ancestor node corresponds to more than 1 keyword node, the keyword ancestor node is added to the keyword subtree containing each of the corresponding keyword nodes; when the keyword sibling node that meets the preset characteristics corresponds to more than 1 keyword node, the keyword sibling node is added to the keyword subtree containing each of the corresponding keyword nodes.

[0012] Preferably, generating data entries for corresponding preset keywords specifically includes: searching for the data item corresponding to each node in the configuration file according to the hierarchy of the keyword subtree, starting from the root node, and adding the data items corresponding to all nodes in the keyword subtree to the corresponding keyword node entries. The keyword node entries retain the hierarchy of the original tree structure.

[0013] Preferably, the tree structure is split into at least one key subtree, which specifically includes: starting from the root node, performing a depth-first traversal of the tree structure of the configuration file; recording the current node of the tree structure of the configuration file and the current node for generating the key subtree; recursively adding the corresponding node to the key subtree; and generating a new key subtree after each traversal.

[0014] Preferably, recursively adding the corresponding nodes to the key subtree further includes: when traversing to each node, determining whether a key node has been processed in this traversal; if the key node has not been processed in this traversal, if the current node is a key node, setting the node as the current key node, marking the key node as processed, and adding it to the key subtree corresponding to the current key; if the current node is an unoccupied key ancestor node, adding the key ancestor node to the key subtree corresponding to the current key; if the current node is a regular node, adding the regular node to the key subtree corresponding to the current key; if the key node has been processed in this traversal, if the current node is a key ancestor node or another key node, no processing is done; if the current node is a regular node, adding the current node to the key subtree corresponding to the current key.

[0015] Preferably, adding an unoccupied keyword ancestor node to the keyword subtree corresponding to the current keyword further includes: comparing the number of keyword nodes corresponding to the keyword ancestor node with the number of keyword subtrees to which the keyword ancestor node has been added; if the number of keyword subtrees to which the keyword ancestor node has been added is not less than the number of corresponding keyword nodes, the keyword ancestor node has been occupied.

[0016] On the other hand, the present invention provides an apparatus for splitting network element inverse calculation data, specifically comprising at least one processor and a memory, wherein the at least one processor and the memory are connected via a data bus, the memory stores instructions that can be executed by at least one processor, and the instructions, after being executed by the processor, are used to complete the method for splitting network element inverse calculation data in the first aspect.

[0017] Compared with existing technologies, the beneficial effects of this invention are as follows: A tree structure is established based on the hierarchy of the configuration file, and the tree structure is further refined and split according to fine-grained, customizable preset keywords. While ensuring the integrity of each data entry, the integrity of dependencies, and no content loss, each split data model contains fewer data entries and less redundant data, thus requiring less memory and achieving higher efficiency in searching or statistics. Furthermore, in a preferred embodiment, a specific implementation method based on a recursive method using tags and counting is provided to complete the splitting, further improving the efficiency of network element inverse calculation data splitting. [Attached Image Description]

[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments of the present invention will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0019] Figure 1 A flowchart of a method for back-calculating data splitting of network elements provided in an embodiment of the present invention;

[0020] Figure 2 This is a schematic diagram of the tree structure corresponding to the configuration file used in a certain actual scenario of an embodiment of the present invention;

[0021] Figure 3 This is a schematic diagram of the keyword subtrees after the configuration file tree structure is split in a real-world scenario according to an embodiment of the present invention;

[0022] Figure 4 A flowchart of another method for inverse calculation of network element data splitting provided in an embodiment of the present invention;

[0023] Figure 5 This is a schematic diagram of a preset keyword name path in a real-world scenario according to an embodiment of the present invention;

[0024] Figure 6 A flowchart of another method for inverse calculation of network element data splitting provided in an embodiment of the present invention;

[0025] Figure 7 This is a schematic diagram of a device structure for back-calculating data splitting of network elements provided in an embodiment of the present invention;

[0026] The accompanying figure is labeled as follows:

[0027] 11: Processor; 12: Memory.

Detailed Implementation Methods

[0028] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0029] This invention is an architecture of a specific functional system. Therefore, the specific embodiments mainly describe the functional logic relationship of each structural module, and do not limit the specific software and hardware implementation methods.

[0030] Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0031] Example 1:

[0032] A network element inverse calculation configuration file is a complete configuration set on a device, containing all configuration information for that device. The relationships between each configuration item in the configuration information can be represented by a tree structure. Leaf nodes store specific configuration data, while non-leaf nodes generally do not store specific configuration data but only express the hierarchical relationship between configuration items. Each node has a name to identify different configuration items. However, in actual use, node names may be duplicated. Each configuration item corresponds to a data entry used by the configuration, and multiple configuration items can also be merged into a single data entry. Each data entry can be stored and processed using the configuration item's data model. Configuration files are generally described using Extensible Markup Language (XML) file format, but other file formats that can represent tree hierarchical structures can also be used. In practical use, network management may only use a certain type of data in the configuration file, thus requiring the data in the configuration file to be split. Existing technical solutions generally can only split according to the hierarchical structure of the tree itself, such as splitting all descendant nodes of each non-leaf node. However, in actual use, it may only be necessary to use a certain leaf node or a portion of the descendants of a certain non-leaf node. To address the problems existing in the above-mentioned background technology, this invention provides a method for splitting network element inverse calculation data, which can achieve fine-grained, customizable, and efficient splitting.

[0033] like Figure 1 As shown, the specific steps of the network element inverse calculation data splitting method provided in this embodiment of the invention are as follows:

[0034] Step 101: Traverse the tree structure corresponding to the configuration file of the network element. Each node of the tree structure corresponds to a data item in the configuration file.

[0035] The network element inverse calculation data has hierarchical dependencies in the configuration file, and these dependencies need to be preserved after splitting. In the method provided in this embodiment, based on the characteristics of the configuration file, when splitting the data, the original hierarchical relationships in the configuration file are first preserved one-to-one using a tree structure, and then the corresponding hierarchical relationships are retained during splitting, ensuring that the information of each data entry after splitting is complete and that no dependent content is lost.

[0036] In a specific use case, the tree structure corresponding to the configuration file is as follows: Figure 2 As shown in the diagram, each circle represents a configuration item, and the text above the circle represents the node name. The names of all nodes along the path from the root node to the leaf node in the tree structure, in hierarchical order, represent the complete name path of a configuration item, such as data / interfaces / interface / name.

[0037] Step 102: Mark the node type of each node according to the preset keywords, where each preset keyword is unique in the business logic.

[0038] When splitting, suitable preset keywords can be set according to the configuration data characteristics required by the network administrator. These preset keywords serve as the basis for splitting, and can be considered as keywords that identify the data entries corresponding to a configuration item. Since each configuration item has a corresponding node name, the name of the configuration item to be split can be used as the preset keyword for convenient matching and searching.

[0039] Furthermore, in real-world scenarios, configuration items may have the same name, resulting in multiple nodes with the same name in the tree structure, and multiple nodes corresponding to the same keyword. Since the network element reverse calculation configuration file is represented by a tree structure, preset keywords can be specified by specifying a name path. The name path refers to the path in the tree structure starting from the root node, consisting of the names of child nodes at different levels, including the complete path from the root node to the corresponding keyword node. In specific implementations, the selection of preset keywords is related to the specific business logic and is usually an identifier with unique values ​​within the business logic. For example, in a specific business scenario, the network forwarding interface names used are all different; the interface name can be used as the preset keyword to separate the configuration items related to each interface for network management. Preset keywords can also be adjusted according to changing needs during use, allowing for customizable splitting. When specifying preset keywords, multiple preset keywords can be specified simultaneously as needed, splitting into multiple corresponding data entries. Furthermore, if the network element reverse calculation configuration file does not specify any keywords, the entire configuration file is treated as a single data entry.

[0040] When specifying preset keywords, one or more preset keywords can be targeted to the data entries required by the network management system, and the configuration related to that keyword can be split out. When the preset keyword corresponds to a leaf node in the tree structure, the split data entries are the configuration items of that node and the configuration items of associated nodes; when the preset keyword corresponds to a non-leaf node in the tree structure, the split data entries correspond to all configuration items of the descendants of that non-leaf node and the configuration items of associated nodes. In specific implementation scenarios, the splitting granularity can be controlled by changing the specified preset keyword, and when the preset keyword is a non-leaf node, it is compatible with existing technologies that split according to configuration block type. For example, in a specific scenario, to generate a corresponding number of data entries based on the number of Ethernet port configurations, one can specify the name of the Ethernet port as the preset keyword to generate a separate data entry for each Ethernet port configuration; or one can specify the name of the ancestor node of the Ethernet port configuration node as the preset keyword to generate a data entry containing all Ethernet port configurations.

[0041] Because the tree structure of the configuration file contains nodes corresponding to preset keywords and nodes that do not, these two types of nodes require different processing during splitting to improve splitting efficiency. Before splitting, node types can be distinguished and marked. Node types include keyword nodes, keyword ancestor nodes, and ordinary nodes. Ordinary nodes include keyword descendant nodes and keyword sibling nodes, where keyword sibling nodes specifically refer to nodes whose ancestors and descendants are both non-keyword nodes.

[0042] In a tree structure, the node representing the name path of a preset keyword is called a keyword node. A node that is not a keyword but has descendants of a keyword is called a keyword ancestor node. All keyword ancestor nodes and keyword nodes of a keyword, arranged hierarchically, constitute a complete name path. The complete data consisting of this name path determined by each keyword node and its corresponding ordinary nodes is called a keyword node entry. The remaining nodes in the tree structure are called ordinary nodes. In the tree structure corresponding to a configuration file, ordinary nodes, keyword nodes, and keyword ancestor nodes constitute the set of all nodes. A node whose name matches a preset keyword is a keyword node; a non-keyword node that is an ancestor of any keyword node is a keyword ancestor node. Ordinary nodes include keyword descendant nodes and keyword sibling nodes. A non-keyword node that is a descendant of any keyword node is a keyword descendant node; a non-keyword node that is neither an ancestor nor a descendant of any keyword node is a keyword sibling node. Each node has only one unique type, and the union of the four types of nodes is all the nodes in the configuration file tree. Therefore, data integrity is guaranteed, and the inability to determine which keyword subtree a node belongs to during splitting is avoided due to a node belonging to multiple types.

[0043] In the specific implementation process, a node can be determined as a keyword node by checking if its name path matches a preset keyword. When the name path of a traversed node matches a preset keyword, the node is marked as a keyword node. The keyword node's ancestor nodes are then searched to determine if it is a keyword ancestor node. For each keyword node, all its ancestor nodes are traversed, and the traversed ancestor nodes are marked as keyword ancestor nodes. The remaining nodes are ordinary nodes. After marking the keyword nodes and keyword ancestor nodes, the remaining keyword descendant nodes and keyword sibling nodes are collectively referred to as ordinary nodes in this embodiment and undergo the same processing without additional marking.

[0044] Step 103: Based on the node type and the relationship between each node and the key node, split the tree structure into at least one key subtree, with each key subtree containing exactly one key node.

[0045] Each preset keyword can correspond to multiple keyword nodes, while each data entry contains only one keyword node. Therefore, each preset keyword may correspond to multiple data entries. Each keyword node also needs to contain complete ancestor, descendant, and sibling node data, as well as corresponding hierarchical information. During splitting, it's not enough to simply extract the keyword node; the smallest subtree containing the keyword node must be extracted. This smallest subtree contains all ancestors upwards to the root node and all descendants downwards to the leaf nodes. Each subtree containing a keyword node is called a keyword subtree. In the tree structure, there may also exist nodes whose ancestors and descendants are both non-keyword nodes; these are called keyword sibling nodes. Since the distance between nodes in the tree structure reflects the tightness of the relationship between nodes, to preserve the complete information of the tree structure, all keyword sibling nodes need to be placed in the keyword subtree containing the keyword node that satisfies the condition of the lowest common ancestor (LCA).

[0046] Based on the definition of a key subtree and using the key node as the basis for splitting, the splitting principle of the key subtree can be determined as follows.

[0047] (1) Keep the keyword nodes in their corresponding keyword subtrees, with each keyword node corresponding to a unique keyword subtree. This ensures that the name path corresponding to each keyword node after splitting exists independently.

[0048] (2) Add the descendant nodes of the keyword to the corresponding keyword subtree according to the hierarchical relationship of the tree structure of the configuration file. When the keyword node is a non-leaf node, it is equivalent to splitting a certain type of configuration item. All its subsequent nodes need to be retained in order to obtain all the information of that type of configuration item.

[0049] (3) Add the ancestor node of the keyword to the corresponding keyword subtree according to the hierarchical relationship of the tree structure in the configuration file, so as to retain the complete path name information corresponding to the keyword node.

[0050] (4) Add the keyword sibling nodes to the keyword subtree containing the keyword nodes that satisfy the condition of the lowest common ancestor (LCA) according to the tree structure of the configuration file. After placing the keyword nodes, keyword descendant nodes, and keyword ancestor nodes into the corresponding keyword subtrees, there are still keyword sibling nodes whose ancestors and descendants are all non-keyword nodes. Based on the proximity relationship of the tree structure, we can find the keyword nodes that have the lowest common ancestor (LCA) with these nodes. The lowest common ancestor (LCA) represents the lowest common ancestor between two nodes, and the lowest LCA represents the node at the lowest level among all the LCAs between a node and all keyword nodes. For example: if there are keyword sibling nodes N1 and keyword nodes K1-Kn, then N1 and each Kk (1<=k<=n) have a lowest common ancestor Lk, forming the LCA set L1-Ln, where the lowest LCA is Lm (1<=m<=n). In this embodiment, Lm is called the lowest LCA. After finding the lowest LCA, the keyword sibling nodes can be added to the keyword subtree containing the keyword node Km corresponding to the lowest LCA. Since the root node is the common ancestor of all nodes in the tree structure, all key sibling nodes can find the key subtree to which they should be added.

[0051] Based on the above configuration splitting principles, the tree structure of the configuration file can be split into keyword subtrees according to preset keywords. All nodes in each keyword subtree correspond to a keyword node entry. An intuitive algorithm for splitting is to first traverse the configuration file tree structure to obtain all keyword nodes. Since each keyword node uniquely identifies a keyword node entry, for each keyword node in the tree structure, we only need to find its ancestor and descendant nodes, as well as its sibling nodes with the lowest common ancestor, and place them into a keyword subtree according to their original hierarchical relationship. After establishing keyword subtrees for all keyword nodes in the tree structure, the splitting of the tree structure is complete.

[0052] Step 104: Generate data entries for the corresponding preset keywords based on the nodes contained in the keyword subtree.

[0053] Once all key subtrees are established according to the principles in step 103, all nodes in each key subtree correspond to the key node entries of the key nodes they contain. Specifically, according to the hierarchy of the key subtrees, starting from the root node, the data item corresponding to each node is searched in the configuration file, and the data items corresponding to all nodes in the key subtree are added to the corresponding key node entries.

[0054] After steps 101-104 provided in this embodiment, preset keywords with the required granularity are set according to the network management needs. The tree structure of the configuration file is split according to the preset keywords, and the entry of each keyword node is obtained, realizing the fine-grained and specifyable splitting of network element back-calculation data. Figure 3 As shown, this is a specific scenario, such as... Figure 1 The diagram shows the keyword subtrees after the configuration file tree structure has been split. In this scenario, the default keyword names are specified as data / interfaces / interface / name and data / mpls-te / interface / ifname according to business logic, corresponding to 4 keyword nodes, which are represented by black circles in the diagram and numbered from left to right as node 1 to node 4.

[0055] Furthermore, to avoid node type conflicts that could prevent uniquely determining the splitting method for a node when splitting the key subtree, the name paths of the preset keywords cannot be nested when specifying preset keywords in step 101; that is, two keyword nodes cannot be in an ancestor-descendant relationship. If nesting exists within the preset keywords, the ancestor node is ignored, and the name path corresponding to the ancestor node is deleted from the name path list. Figure 1 In the example, if two name paths, data / interfaces / interface / name and data / mpls-te / interface / ifname, are specified, and data / interfaces / interface is also specified as a name path, resulting in a total of three name paths being specified, this path will form a nested relationship with data / interfaces / interface / name. It will be automatically ignored, and data / interfaces / interface will be removed from the name path list, leaving only two name paths.

[0056] To avoid nesting, potential nesting scenarios need to be handled. In specific implementation scenarios, an appropriate handling method can be chosen based on the actual situation. In one scenario, preset keywords can be modified. The name path of the preset keyword is used as a string, and each preset keyword's corresponding string is checked to see if it is a substring of another preset keyword's corresponding string. If so, it indicates that the preset keyword and another preset keyword have a nested relationship, and the preset keyword used as a substring is deleted. In another implementation scenario, preset keywords cannot be directly modified. When traversing and searching for the keyword ancestor nodes of a keyword node, if the ancestor node corresponds to a preset keyword different from that keyword node, the preset keyword corresponding to the keyword ancestor node is no longer used as a preset keyword. After the above operations, it can be ensured that there are no mutually nested name paths among all preset keywords.

[0057] In the specific implementation scenario of this embodiment, some special cases may occur in the configuration file, requiring further processing when splitting the key subtree in step 103. Common cases are as follows; other cases can be handled accordingly by referring to the splitting principles described in step 103 and the processing methods below.

[0058] (1) Since there may be multiple configuration items with the same name in the configuration file, each name path may correspond to multiple keyword nodes, forming multiple data entries. For example, for Figure 1 In the tree structure, for the preset keywords data / interfaces / interface / name and data / mpls-te / interface / ifname, each preset keyword corresponds to 2 keyword nodes, for a total of 4 keyword nodes, forming 4 data entries. Each data entry has exactly one keyword node. The splitting method provided in this embodiment can split the original complete tree structure of the configuration file into multiple subtrees containing keyword nodes, regardless of whether it contains one keyword or multiple keywords. Each subtree has exactly one keyword node, without requiring multiple traversals of the tree structure.

[0059] (2) In the configuration file, multiple configuration items may belong to the same category, which manifests as multiple nodes sharing a common ancestor node in the tree structure of the configuration file. In this scenario, during the splitting process in step 103, multiple keyword nodes may share a single keyword ancestor node. In this case, to preserve the complete hierarchical relationship and information of the path name, when the keyword ancestor node corresponds to more than one keyword node, the shared keyword ancestor node needs to be copied a corresponding number of times according to the number of descendant keyword nodes. The keyword ancestor node is then added to the keyword subtree containing all its descendant keyword nodes, shared by multiple preset keyword data entries. For example... Figure 1 The `interfaces` node represents the set of Ethernet ports. It is the shared key ancestor node of the two key nodes `data / interfaces / interface / name` and needs to be preserved in the key subtrees corresponding to the two key nodes.

[0060] (3) In the configuration file, there may be common data shared by multiple data entries. In the tree structure, this common data corresponds to a certain key sibling node, and this node corresponds to multiple key nodes that satisfy the condition of the lowest common ancestor. For example, Figure 1 The `router-id` node in the MPLS configuration represents the router ID. With the default keywords `data / interfaces / interface / name` and `data / mpls-te / interface / ifname`, the nearest common ancestor (LCA) of this node with the first two keyword nodes is the `data` node, and with the next two keyword nodes is the `mpls-te` node. Of these two LCAs, `mpls-te` is closer to the `router-id` node; therefore, `mpls-te` is the lowest-level LCA of `router-id`. Since `mpls-te` has two corresponding keyword nodes, `router-id` is considered common data. To ensure that both keyword nodes' entries contain this necessary common data, `router-id` needs to be added to the respective keyword subtrees of both keyword nodes.

[0061] By using the above-mentioned special case handling methods, configuration files with different hierarchical relationship characteristics can be effectively and accurately split, providing network administrators with fine-grained, accurate, and complete configuration data entries.

[0062] like Figure 4 As shown, node labeling and key subtree splitting in the above case can be completed through the following steps.

[0063] Step 201: Traverse the tree structure of the configuration file. If the name path of the current node matches the preset keyword, mark the node as a keyword node and record it in the keyword list.

[0064] Step 202: Determine whether all keyword nodes in the keyword list have been processed. If yes, end the processing; otherwise, select a keyword node from the keyword list and set it as N1, then proceed to step 203.

[0065] Step 203: For key node N1, traverse the configuration file tree structure and determine whether the traversal is complete. If yes, the key subtree of key node N1 has been established, and proceed to step 202 to traverse the next key node; if no, obtain the next traversed node in the configuration file tree structure as the current traversed node, set the current traversed node as N2, and proceed to step 204.

[0066] Step 204: Determine whether N2 and N1 are the same key node. If yes, add N2 to the key subtree of N1 and go to step 203; otherwise, go to step 205.

[0067] Step 205: Determine if N2 is another key node. If yes, since each data item has only one key node, N2 does not belong to the key subtree of the current key node N1, and proceed to step 203; if no, proceed to step 206.

[0068] Step 206: Calculate the lowest common ancestor of N1 and N2, denoted as L1.

[0069] Step 207: Determine if L1 is the same as N1 or N2. If yes, that is, N1 is an ancestor of N2 or N2 is an ancestor of N1, then N2 is a key ancestor or descendant node of N1 and belongs to the key node entry. Add N2 to the key subtree of N1 and go to step 203; if no, it means that N2 is a key sibling node and go to step 208.

[0070] Step 208: Calculate the lowest common ancestor (LCA) of N2 and all other key nodes, and determine whether L1 is at the lowest level of the tree structure among these LCAs, or is at the lowest level of the tree structure along with other nodes. If yes, it means that L1 is closest to N2 among the LCAs formed by N2 and all key nodes, so N2 belongs to the key node entry, and N2 is added to the key subtree of N1. Proceed to step 203. If no, it means that N2 does not belong to the key node entry, and N2 is not added to the key subtree of N1. Proceed to step 203.

[0071] After steps 201-208, for each keyword node corresponding to each preset keyword, the attribution of the keyword node, keyword ancestor node, keyword descendant node and keyword sibling node in the configuration file tree structure was determined, and corresponding processing was performed based on the determination results.

[0072] Furthermore, in steps 201-208, each keyword node marked in step 201 needs to be processed in step 202, and each processing step requires traversing the entire tree structure of the configuration file in step 203 to determine whether each node belongs to the keyword node entry. Assuming the configuration file tree structure has n nodes, of which m are keyword nodes, a total of m*n node traversals are required. The determination process also requires calculating the lowest common ancestor (LCA) between each node and all keyword nodes in step 208. Even if the calculation results are saved and only calculated once between each pair of nodes, m*n LCA calculations are still required.

[0073] To reduce the number of traversals and the number of nearest common ancestor calculations during the splitting process, and improve splitting efficiency, the above splitting method can be optimized. Starting from the root node, a depth-first traversal of the configuration file's tree structure is performed. By recording the current node of the configuration file's tree structure and the current node for generating the key subtree, corresponding nodes are recursively added to the key subtree. The input parameters for the recursive method of generating the key subtree include the current node of the configuration file's tree structure and the current node for generating the key subtree. During recursive execution, nodes are continuously added to the key subtree based on the current node for generating the key subtree, eventually forming a complete key subtree.

[0074] In the method provided in this embodiment, a new key subtree is generated for each traversal. Each node is marked and counted. The number of nodes that need to be traversed or processed is reduced by adding judgments, thereby achieving efficient splitting.

[0075] When traversing each node, determine if a keyword node has been processed. If no keyword node has been processed in this traversal, and the current node is a keyword node, set it as the current keyword node, mark it as processed, and add it to the keyword subtree corresponding to the current keyword. If the current node is an unused keyword ancestor node, add it to the keyword subtree corresponding to the current keyword. If the current node is a regular node, add it to the keyword subtree corresponding to the current keyword. If a keyword node has been processed in this traversal, and the current node is a keyword ancestor node or another keyword node, do nothing. If the current node is a regular node, add it to the keyword subtree corresponding to the current keyword. In specific implementations, a global variable can be set as a keyword node encounter flag. When setting the initial value, set the current node parameter of the configuration file tree structure to the root node of the configuration file tree structure, set the current node parameter of the subtree structure to null, and set the global variable for the keyword node encounter flag to false.

[0076] Compare the number of keyword nodes corresponding to the keyword ancestor node with the number of keyword subtrees that the keyword ancestor node has been added to. If the number of added keyword subtrees is not less than the number of corresponding keyword nodes, the keyword ancestor node has been occupied. The node count of each node represents the number of keyword nodes in the node or its descendant nodes. The node type of each node needs to be marked and the node counted by traversing the configuration file tree structure. The specific method is as follows: The default node count of each node in the configuration file tree structure is 0. Traverse the configuration file tree structure. The traversal method is not limited. 1) If the name path of the current node matches the default keyword, mark the node type as a keyword node and increment the node count by 1. Then, sequentially search upwards for all ancestor nodes of the keyword node, mark them all as keyword ancestor nodes, and increment their node counts by 1. After processing, continue traversing the next node. 2) If the name path of the current node does not match the default keyword, do not process it and continue traversing the next node. After traversing the tree structure, mark the nodes whose node count is still 0 (i.e., unmarked nodes) as ordinary nodes and set their node counts to 0. The counts of key nodes and key ancestor nodes represent the number of key subtrees that the node should exist in. Each time a key node or key ancestor node is split into a key subtree, the node count is decremented by 1. When the node count is 0, it means that the node has been split into all possible key subtrees and no further processing is needed. Since a key node will only appear in one key node entry, the key node count can only be 0 or 1. When the root node's node count is 0, it means that all nodes in the tree structure have been processed and all key subtrees have been generated. The node count of ordinary nodes is not used in the calculation and remains at the default value of 0. Figure 5 As shown, the default keyword name paths are specified as data / interfaces / interface / name and data / mpls-te / interface / ifname according to the business logic, corresponding to 4 keyword nodes, which are represented by black circles in the figure. The number inside the circle of each node represents the node count value.

[0077] In a specific implementation scenario, the above optimization methods are combined, and the decomposition method provided in steps 201-208 is optimized as follows: Figure 6 The steps are shown below. Before executing the following steps, the configuration file tree structure needs to be traversed using the method described above to mark the node type for each node and count the nodes. The following steps are the algorithm for one recursive step, which can generate a key subtree. A depth-first traversal is used to complete the traversal of all nodes in the configuration file tree structure. The input parameters for the recursion include the current node of the configuration file tree structure, the current node of the current key subtree, and a global variable as an identifier for encountered key nodes.

[0078] Step 301: Determine if the keyword node has been encountered flag is true. If yes, it means the keyword node corresponding to the current keyword subtree has been found, proceed to step 302; if no, it means the keyword node corresponding to the current keyword subtree has not yet been found, proceed to step 303.

[0079] Step 302: Determine whether the current node is a normal node. If yes, proceed to step 308; if no, it indicates that the current node is another key node and does not correspond to the current key subtree, or it indicates that the current node is a key ancestor node and is more closely related to other key nodes. No processing is required, and proceed to step 309.

[0080] Step 303: Obtain the node type of the current node. If the current node is a key ancestor node, proceed to step 304; if the current node is a key node, proceed to step 305; if the current node is a normal node, proceed to step 308.

[0081] Step 304: Determine if the node count of the current node is 0. If the node count is greater than 0, it means that the node still needs to be added to the key subtree, go to step 307; if the node count is equal to 0, it means that the node has been added to all corresponding key subtrees, go to step 309.

[0082] Step 305: Determine if the node count of the current node is 0. If the node count is greater than 0, it means that the node still needs to be added to the key subtree, go to step 306; if the node count is equal to 0, it means that the node has been added to all corresponding key subtrees, go to step 309.

[0083] Step 306: Set the keyword node encountered flag to true, meaning that an unoccupied keyword node has been encountered. Decrement the current node count by 1 to count the node occupancy status, and proceed to step 308.

[0084] Step 307: Decrement the current node count by 1 to check the node occupancy status, then proceed to step 308.

[0085] Step 308: Copy the current node to the current key subtree and record the position of the current node in the current key subtree. After copying the current node to the current key subtree, record the position of the newly copied node in the current key subtree as an input parameter for the next recursive call.

[0086] Step 309: Determine if all nodes have been traversed. If yes, it means the current key subtree has been generated; if no, take each child node of the current node and the current node position of the current key subtree recorded in step 308 as recursion parameters, and go back to step 301 to recursively perform the recursion again.

[0087] Steps 301-309 utilize recursion, labeling, and counting to efficiently and quickly complete the splitting operation, generating smaller data entries that are easily converted into a PB data structure. As seen in the steps above, in a scenario with m key nodes, only m traversals are needed to generate m corresponding key subtrees. If nodes that don't need processing are ignored, each traversal only requires approximately 1 / m of a node on average. Assuming the configuration file tree structure has n nodes, approximately n nodes need to be traversed to generate m key subtrees. Furthermore, during the traversal, there's no need to calculate the lowest common ancestor of each node and all key nodes, significantly improving efficiency.

[0088] The network element inverse calculation data splitting method provided in this embodiment can achieve fine-grained splitting by reasonably specifying preset keywords, such as generating a separate data entry for each Ethernet port configuration. Customizable splitting can also be achieved through different preset keyword specification strategies. For example, the router ID in the MPLS configuration can be specified as a preset keyword to generate a separate data entry; otherwise, it will be used as common data shared by multiple MPLS interface data entries. Furthermore, this embodiment also provides an optimized splitting method where the number of traversals of the configuration file tree structure during splitting is equal to the number of keyword nodes, ensuring that a new keyword subtree is generated each time, i.e., a keyword node entry is generated. Furthermore, by marking and counting, most nodes that do not require processing are skipped, achieving better processing efficiency.

[0089] Example 2:

[0090] Based on the network element inverse calculation data splitting method provided in Embodiment 1 above, the present invention also provides an apparatus for implementing the network element inverse calculation data splitting method described above, such as... Figure 7 The diagram shown is a schematic representation of the device architecture according to an embodiment of the present invention. The device for network element reverse calculation and data splitting in this embodiment includes one or more processors 11 and a memory 12. Figure 7 Take processor 11 as an example.

[0091] Processor 11 and memory 12 can be connected via a bus or other means. Figure 7 Take a bus connection as an example.

[0092] The memory 12 serves as a non-volatile computer-readable storage medium for the network element inverse calculation data splitting method. It can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the network element inverse calculation data splitting method in Embodiment 1. The processor 11 executes various functional applications and data processing of the network element inverse calculation data splitting device by running the non-volatile software programs, instructions, and modules stored in the memory 12, thereby implementing the network element inverse calculation data splitting method of Embodiment 1.

[0093] Memory 12 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 12 may optionally include memory remotely located relative to processor 11, which can be connected to processor 11 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0094] The program instructions / modules are stored in memory 12. When executed by one or more processors 11, they perform the network element inverse calculation data splitting method described in Embodiment 1 above, for example, performing the above-described method. Figure 1 , Figure 4 , Figure 6 The steps are shown.

[0095] Those skilled in the art will understand that all or part of the steps in the various methods of the embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0096] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for reverse calculation of data splitting in network elements, characterized in that: Traverse the tree structure corresponding to the configuration file of the network element, where each node of the tree structure corresponds to a data item in the configuration file; Each node is labeled with a preset keyword to indicate its node type. Each preset keyword is unique in the business logic. The node types include keyword nodes, keyword ancestor nodes, keyword descendant nodes, and keyword sibling nodes. Based on the node type and the relationship between each node and the keyword node, the tree structure is split into at least one keyword subtree. Each keyword subtree contains one and only one keyword node. Each keyword subtree contains all the ancestors and descendants of the keyword node in the tree structure corresponding to the configuration file, as well as the keyword sibling nodes that meet the preset characteristics. Generate data entries for the corresponding preset keywords based on the nodes contained in the keyword subtree.

2. The method for inverse calculation of network element data splitting according to claim 1, characterized in that, The step of marking the node type of each node according to preset keywords specifically includes: When the name of a traversed node matches a preset keyword, the node is marked as a keyword node; For each key node, iterate through all its ancestor nodes and mark the ancestor nodes encountered as key ancestor nodes.

3. The method for inverse calculation of network element data splitting according to claim 2, characterized in that, The step of marking the traversed ancestor nodes as key ancestor nodes also includes: When the ancestor node encountered during traversal corresponds to a different preset keyword than the keyword node, the preset keyword corresponding to the keyword ancestor node is no longer used as the preset keyword.

4. The method for inverse calculation of network element data splitting according to claim 1, characterized in that, The step of splitting the tree structure into at least one key subtree specifically includes: Keyword nodes are retained in their corresponding keyword subtrees, with each keyword node corresponding to a unique keyword subtree; Add the descendant nodes of the key node to the corresponding key subtree according to the hierarchical relationship of the tree structure in the configuration file; Add the ancestor node of the keyword to the corresponding keyword subtree according to the hierarchical relationship of the tree structure in the configuration file; Add the keyword sibling nodes to the keyword subtree containing the keyword node that satisfies the condition of the lowest common ancestor, according to the tree structure of the configuration file.

5. The method for inverse calculation of network element data splitting according to claim 4, characterized in that, The keyword ancestor node is added to the corresponding keyword subtree according to the hierarchical relationship of the tree structure in the configuration file, and the keyword sibling node is added to the keyword subtree containing the keyword node that satisfies the condition of the lowest common ancestor, according to the hierarchical relationship of the tree structure in the configuration file. This also includes: When a keyword ancestor node corresponds to more than one keyword node, add the keyword ancestor node to the keyword subtree containing each corresponding keyword node; When a keyword sibling node that meets the preset characteristics corresponds to more than one keyword node, the keyword sibling node is added to the keyword subtree of each corresponding keyword node.

6. The method for inverse calculation of network element data splitting according to claim 1, characterized in that, The generation of data entries with corresponding preset keywords specifically includes: Based on the hierarchy of the key subtree, starting from the root node, the system searches for the data item corresponding to each node in the configuration file. All data items corresponding to nodes in the key subtree are then added to the corresponding key node entries, which retain the hierarchy of the original tree structure.

7. The method for inverse calculation of network element data splitting according to claim 1, characterized in that, The step of splitting the tree structure into at least one key subtree specifically includes: Starting from the root node, the tree structure of the configuration file is traversed depthwise. By recording the current node of the configuration file's tree structure and the current node for generating the key subtree, the corresponding nodes are recursively added to the key subtree. A new key subtree is generated after each traversal.

8. The method for inverse calculation of network element data splitting according to claim 7, characterized in that, The node type also includes: ordinary nodes, which include key descendant nodes and key sibling nodes, wherein key sibling nodes specifically refer to nodes whose ancestors and descendants are both non-key nodes. The recursive addition of corresponding nodes to the key subtree also includes: When traversing each node, check if any key nodes have already been processed in this traversal; If no keyword node is processed in this traversal, and if the current node is a keyword node, set the node as the current keyword node, mark the keyword node as processed, and add it to the keyword subtree corresponding to the current keyword; if the current node is an unoccupied keyword ancestor node, add the keyword ancestor node to the keyword subtree corresponding to the current keyword; if the current node is a regular node, add the regular node to the keyword subtree corresponding to the current keyword. If the current node has already been processed during this traversal, and if the current node is a keyword ancestor node or another keyword node, no processing is performed. If the current node is a regular node, the current node is added to the keyword subtree corresponding to the current keyword.

9. The method for inverse calculation of network element data splitting according to claim 8, characterized in that, The step of adding unoccupied keyword ancestor nodes to the keyword subtree corresponding to the current keyword also includes: Compare the number of keyword nodes corresponding to the keyword ancestor node with the number of keyword subtrees to which the keyword ancestor node has been added; If the number of added key subtrees is not less than the number of corresponding key nodes, then the key ancestor node has been occupied.

10. A device for reverse calculation of data splitting of network elements, characterized in that: It includes at least one processor and a memory, which are connected via a data bus. The memory stores instructions that can be executed by the at least one processor. After being executed by the processor, the instructions are used to complete the method for splitting network element inverse calculations according to any one of claims 1-9.

Citation Information

Patent Citations

  • XML keyword query method based on CUDA parallel and LCA

    CN109977288A

  • Database index management method and device and electronic equipment

    CN111488341A