Configuration management method, server, storage medium and program product

By constructing an object tree for network devices and determining the node path sorting weights, configuration information in the correct order is generated, solving the problem of out-of-order network configuration and improving the efficiency and consistency of network management and operation.

CN121967220APending Publication Date: 2026-05-01ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ALIBABA CLOUD COMPUTING CO LTD
Filing Date
2024-10-29
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

The out-of-order network configuration information generated by existing technologies leads to some configurations not taking effect or behaving abnormally, affecting the efficiency, accuracy and consistency of network management and operation.

Method used

By acquiring data instances from the network device's preset data model, an object tree is constructed, and the path sorting weight of each node is determined. Configuration information is generated according to the command generation rules for different types of nodes to ensure the correct order of the configuration information.

Benefits of technology

It improves the efficiency, accuracy, and consistency of network management and operation, reduces maintenance costs, and ensures the stable and secure operation of network equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121967220A_ABST
    Figure CN121967220A_ABST
Patent Text Reader

Abstract

The invention provides a configuration management method, a server, a storage medium and a program product. According to the method, a data instance of a preset data model of the network equipment is obtained, and the data instance comprises configuration data of the network equipment; according to the configuration data in the data instance, constructing an object tree of a preset data model; determining the sorting weight of the path of each node in the preset data model; and traversing the nodes in the object tree according to the sorting weight of the path of each node in the preset data model, generating configuration information of the network equipment according to command generation rules of different types of nodes, and controlling the traversing sequence of the nodes in the object tree of the preset data model through the sorting weight of the path of each node. And the sequence of the generated configuration information of the network equipment is ensured to be correct, so that the efficiency, accuracy and consistency of network management and operation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to computer technology, and more particularly to a configuration management method, server, storage medium, and program product. Background Technology

[0002] Command-line interface (CLI) is a common tool used by network operators to configure the status and operation data of network devices. Configuration generation is one of the core requirements of vendor configuration management. Traditional configuration generation relies on manually writing scripts for different scenarios, and then running the scripts to generate configuration texts for those scenarios. However, different vendors have different configuration styles, parameters, and command names. Every time a new device model is added, the script must be rewritten manually. This approach is inefficient in today's environment where networks are becoming larger and device vendors are becoming more diverse, as configuration generation heavily relies on manual script writing.

[0003] With the popularization of standardized configuration management protocols, a solution has emerged that models CLI based on data models and generates configurations. However, the configurations generated by this solution are out of order, and the directly generated configurations cannot guarantee the order of CLIs between configuration views or within a view.

[0004] However, the importance of network configuration order is obvious. Some network configurations have strict sequential dependencies. If the configuration order is reversed, some configurations may not take effect or behave abnormally. Disordered network configurations will affect the efficiency, accuracy and consistency of network management and operation. Summary of the Invention

[0005] This application provides a configuration management method, server, storage medium, and program product to solve the problem that out-of-order configurations generated by existing solutions lead to some configurations not taking effect or behaving abnormally, affecting the efficiency, accuracy, and consistency of network management and operation.

[0006] Firstly, this application provides a configuration management method, including:

[0007] Obtain a data instance of a preset data model of a network device, wherein the data instance includes the configuration data of the network device;

[0008] Based on the configuration data in the data instance, construct the object tree of the preset data model;

[0009] Determine the sorting weight of the paths of each node in the preset data model;

[0010] Based on the sorting weight of the paths of each node in the preset data model, the nodes in the object tree are traversed, and the configuration information of the network device is generated according to the command generation rules of different types of nodes. The configuration information includes configuration commands and parameters.

[0011] Secondly, this application provides a configuration management method, including:

[0012] In response to a configuration request for a newly added network device, a data instance of a preset data model of the network device is obtained, the data instance including the configuration data of the network device;

[0013] Based on the configuration data in the data instance, construct the object tree of the preset data model;

[0014] Determine the sorting weight of the paths of each node in the preset data model;

[0015] Based on the sorting weight of the paths of each node in the preset data model, the nodes in the object tree are traversed, and the configuration information of the network device is generated according to the command generation rules of different types of nodes. The configuration information includes configuration commands and parameters.

[0016] Output the configuration information of the network device.

[0017] Thirdly, this application provides a server, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the server to perform the methods provided in any of the foregoing aspects.

[0018] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the method provided in any of the foregoing aspects.

[0019] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the methods provided in any of the foregoing aspects.

[0020] The configuration management method, server, storage medium, and program product provided in this application obtain data instances of a preset data model for network devices, including configuration data of the network devices; construct an object tree of the preset data model based on the configuration data in the data instances; determine the sorting weight of the paths of each node in the preset data model; traverse the nodes in the object tree according to the sorting weight of the paths of each node in the preset data model, and generate configuration information of the network devices according to the command generation rules of different types of nodes. By controlling the traversal order of nodes in the object tree of the preset data model through the sorting weight of the paths of each node, the order of the generated configuration information of the network devices is ensured to be correct, thereby improving the efficiency, accuracy, and consistency of network management and operation. Attached Figure Description

[0021] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0022] Figure 1 This is a schematic diagram of an example system architecture to which this application applies;

[0023] Figure 2 A flowchart of a configuration management method provided for an exemplary embodiment of this application;

[0024] Figure 3 A flowchart for determining the sorting weights of node paths, provided as an exemplary embodiment of this application;

[0025] Figure 4 A flowchart of a sequential directed graph for constructing views provided in an exemplary embodiment of this application;

[0026] Figure 5a An example diagram of a sequentially directed graph provided for an exemplary embodiment of this application;

[0027] Figure 5b Example diagram of another sequential directed graph provided for an exemplary embodiment of this application;

[0028] Figure 5c Example diagram of another sequential directed graph provided for an exemplary embodiment of this application;

[0029] Figure 6a Example diagram of a sequential directed graph in a topological sorting process provided in an exemplary embodiment of this application;

[0030] Figure 6b Example diagram of another sequential directed graph provided in a topological sorting process for an exemplary embodiment of this application;

[0031] Figure 7An example diagram of an interface configuration object tree based on an extended Yang model provided for an exemplary embodiment of this application;

[0032] Figure 8 A flowchart of a configuration management method provided as another exemplary embodiment of this application;

[0033] Figure 9 A framework diagram of a configuration management method provided for an exemplary embodiment of this application;

[0034] Figure 10 A flowchart of a configuration management method provided as another exemplary embodiment of this application;

[0035] Figure 11 This is a schematic diagram of the structure of a server provided in an embodiment of this application.

[0036] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0037] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0038] It should be noted that the user information (including but not limited to user device information, user attribute information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0039] First, let me explain the terms used in this application:

[0040] Python: A programming language widely used in web applications, software development, data science, and machine learning.

[0041] NETCONF: A network configuration protocol based on Extensible Markup Language (XML).

[0042] gRPC: An open-source, high-performance remote procedure call (RPC) framework that can run in any environment.

[0043] Yang model: A data model for modeling network device status and configuration data.

[0044] A command-line interface is a software mechanism used to interact with the operating system using a keyboard.

[0045] CLI (Configuration CLI) is a common tool used by network operators to configure status and operational data for network devices. Configuration generation is one of the core requirements of vendor configuration management. The importance of network configuration ordering is self-evident. First, some network configurations have strict sequential dependencies; if the configuration order is reversed, some configurations may not take effect or behave abnormally. Second, correct network configuration ordering can significantly improve the efficiency, accuracy, and consistency of network management and operation. For example, a more clearly structured configuration allows network administrators to understand the configuration content more quickly, efficiently locate configuration errors and faults, reduce confusion in configuration management, and avoid inconsistencies caused by different configuration habits of different personnel, thereby improving work efficiency.

[0046] Traditional configuration generation relies on manually writing Python scripts for different scenarios, and then running these scripts to generate the corresponding configuration text. In traditional template- or script-based configuration generation methods, the configuration order is hard-coded into the Python code, requiring manual adjustment and assurance of its correctness. However, with the increasing number of configuration templates and device manufacturers' models, this manual maintenance method becomes increasingly labor-intensive and error-prone.

[0047] The scheme of modeling CLI based on a data model and generating configurations relies on the traversal order of the data model's object tree. However, the generated configurations are out of order, and the directly generated configurations cannot guarantee the order of CLIs between or within configuration views. Directly distributing the generated configurations to devices may result in some configurations failing or malfunctioning due to incorrect ordering. Furthermore, the disordered sorting increases the workload for network administrators in reviewing and debugging configuration files, hindering the rapid identification and correction of configuration order issues. Therefore, out-of-order network configurations negatively impact the efficiency, accuracy, and consistency of network management and operations.

[0048] This application provides a configuration management method for automatic configuration generation, ensuring the correct order of generated configuration information to improve the efficiency, accuracy, and consistency of network management and operation. Specifically, during configuration generation, a data instance of a preset data model for the network device is obtained, including the network device's configuration data. Based on the configuration data in the data instance, an object tree of the preset data model is constructed. The sorting weight of the paths of each node in the preset data model is determined. Based on the sorting weight of the paths of each node in the preset data model, the nodes in the object tree are traversed, and the configuration information of the network device is generated according to the command generation rules for different types of nodes. The sorting weight of the paths of each node controls the traversal order of the nodes in the object tree of the preset data model, ensuring the correct order of the generated network device configuration information, thereby improving the efficiency, accuracy, and consistency of network management and operation.

[0049] Figure 1 This is a schematic diagram of an example system architecture to which this application applies. Figure 1 As shown, the system architecture includes a server and endpoint devices. The server and endpoint devices have a communication link, enabling communication between them.

[0050] The endpoint device can be an electronic device used to implement network configuration applications / software. Specifically, it can be a hardware device with network communication, computing, and information display functions, including but not limited to smartphones, tablets, desktop computers, local servers, and cloud servers. The network configuration application / software running on the endpoint device can be various network configuration management platforms or systems. It needs to obtain the configuration information of the network device, which includes configuration commands and parameters. The network device is configured by executing the configuration information.

[0051] A server is a computing device deployed in the cloud or locally, such as a cloud cluster. The server stores the ordering weights of the paths for each node in a pre-defined data model. This pre-defined data model is obtained by adding extended keywords to the original data model, which is a model of the network device's configuration information. The extended keywords are used to declare the node attributes of the pre-defined data model; these attributes must at least include view attributes to declare the view to which the node belongs. The server is responsible for determining the ordering weights of the paths for each node in the pre-defined data model based on the order of existing configuration information in the network device's configuration files, and for generating correctly ordered configuration information for the network devices based on these ordering weights.

[0052] In practical applications, when an end-side device needs to obtain configuration information for a network device, it obtains a data instance of a preset data model input by relevant technical personnel. This data instance includes the network device's configuration data. The end-side device sends the data instance of the preset data model to the server. The server constructs an object tree of the preset data model based on the configuration data in the data instance; determines the sorting weight of the paths of each node in the preset data model; and, based on the sorting weight of the paths of each node in the preset data model, traverses the nodes in the object tree and generates the network device's configuration information according to the command generation rules for different types of nodes. Further, the server returns the generated network device configuration information to the end-side device. The end-side device configures the network device based on the configuration information returned by the server.

[0053] In addition, the server can update the sorting weight of the paths of each node in the preset data model for newly added configuration files at regular intervals, so as to update the sorting weight of the paths of each node in the preset data model in real time and improve the effectiveness and accuracy of the sorting of generated configuration information.

[0054] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.

[0055] Figure 2 This is a flowchart illustrating a configuration management method provided in an exemplary embodiment of this application. The execution entity in this embodiment is the server in the aforementioned system architecture. Figure 2 As shown, the specific steps of this method are as follows:

[0056] Step S201: Obtain a data instance of the preset data model of the network device. The data instance includes the configuration data of the network device.

[0057] The preset data model is obtained by adding extended keywords to the original data model. These extended keywords declare the node attributes of the preset data model, and each node attribute must include at least a view attribute declaring the view to which the node belongs. The node attributes declared by the extended keywords indicate the conversion method between the object tree of the preset data model and the configuration text of the network device.

[0058] The raw data model is a model used to model the configuration information of network devices. Provided by the device manufacturer, it can be understood as a model that models the device's configuration information. The raw data model has a tree-like syntax structure, used to describe the overall status, configuration, and operation of the device, helping network operators better understand and manage it. For example, the raw data model can be the Yang model provided by the device manufacturer, which includes attribute definitions for multiple nodes. These attribute definitions describe the properties of each node. The node types involved in the Yang model mainly include: leaf nodes, list nodes, leaf-list nodes, and container nodes. A leaf node's attribute has a definite value, such as an integer or string. A container node's attribute is a collection of child nodes, without a value; the number and type of child nodes are not limited and can be container nodes, leaf nodes, leaf-list nodes, or list nodes. A leaf-list node is a collection of leaf nodes, each with a definite value. A list node defines a sequence of list entries. Each entry is uniquely identified by the value of its key leaf node. A list node can define multiple key leaf nodes and can also contain child nodes of any type (including leaf nodes, list nodes, container nodes, etc.).

[0059] In practical applications, different operating system versions, different configurations required on the device, and different contents of the original data model provided by the manufacturer are usually used. Therefore, for the same type of device, different operating system versions and different original data models provided by the manufacturer will result in different original data models.

[0060] By adding extension keywords to the original data model, the original data model can be expanded. In the data model, extension keywords are used to declare node attributes, which in turn indicate the conversion method between the object tree of the preset data model and the configuration text of the device. Therefore, extension keywords can supplement the node attribute definition to ensure conversion accuracy.

[0061] For example, extended keywords may include keywords for indicating node aliases (alias), keywords for indicating view attributes (view or default-view), keywords for indicating parameter output attributes (one-line), keywords for indicating parameter attributes (optional), keywords for indicating node name output attributes (nokeyword), and extended keywords for indicating command output (completed), etc.

[0062] In this embodiment, a data instance is an actual assigned instance written according to the definition of a preset data model, which contains specific configuration data of the network device. For example, the data model describes the BGP (Border Gateway Protocol) configuration of the network device, and the data instance includes specific BGP configuration data.

[0063] In this step, a data instance is obtained by displaying an instance object of a preset data model in a graphical user interface and receiving specific data input by the user for that instance object.

[0064] Step S202: Construct the object tree of the preset data model based on the configuration data in the data instance.

[0065] The object tree is the instantiation result after assigning values ​​to the preset data model using data instances. It also describes the structure and content of the configuration text in a tree structure.

[0066] In this step, a preset data model is instantiated using specific configuration data from a data instance, thus obtaining the object tree of the preset data model. The specific implementation of this step is similar to the principle of instantiating an original data model (such as the Yang model) based on specific configuration data from a data instance, and will not be elaborated upon here.

[0067] Step S203: Determine the sorting weight of the paths of each node in the preset data model.

[0068] In this embodiment, in order to sort the configuration information generated by the object tree based on the preset data model, it is necessary to obtain the sorting weight of the path of each node in the preset data model. The sorting weight of the path of the node can control the traversal order of each node in the object tree, thereby controlling the order of the configuration information corresponding to each node generated.

[0069] In practical applications, the CLI configurations of network devices are usually sorted according to a certain logical order for ease of management and operation, and most network devices provide sorted CLI configurations. In this embodiment, the configuration backups of existing network devices are used as known, correctly sorted configuration information to determine the sorting weight of the paths of each node in the preset data model, thereby assisting in the configuration generation and sorting of newly added network devices.

[0070] In this step, the ranking weights of the paths of each node in the preset data model are determined, including the ranking weights of the paths of nodes contained in the view. Specifically, referring to a large number of existing configuration files of live network devices, the order of configuration commands is obtained by parsing the configuration files. Based on the view to which the configuration command belongs and the correspondence between the configuration command and the nodes in the preset data model, the view to which the configuration command belongs is used as the view to which the node corresponding to the configuration command belongs, thus determining the view to which each node in the preset data model belongs. By analyzing the order of configuration commands, the nodes corresponding to the configuration commands, and the views to which the nodes belong in the existing configuration files, the order of the paths of the nodes contained in the same view can be determined. Further, based on the order of the paths of the nodes contained in the same view, the ranking weights of the nodes contained in the same view are determined according to the node weight generation rules. The node weight generation rules require that the ranking weight of a node path that appears earlier in the sequence is less than the ranking weight of a node path that appears later in the sequence; or, the node weight generation rules require that the ranking weight of a node path that appears earlier in the sequence is greater than the ranking weight of a node path that appears later in the sequence.

[0071] Optionally, the sorting weights of the paths of each node in the preset data model may also include the sorting weights of different views. By analyzing the order of configuration commands and their respective views in the existing configuration files, the arrangement order of different views can be determined. Based on the arrangement order of the nodes contained in the same view, the sorting weights of different views are determined according to the view weight generation rules. Specifically, the view weight generation rules require that the sorting weight of a view that appears earlier in the sequence is less than the sorting weight of a view that appears later in the sequence; or, the view weight generation rules require that the sorting weight of a view that appears earlier in the sequence is greater than the sorting weight of a view that appears later in the sequence.

[0072] Optionally, the sorting weights of different views can also be manually configured and adjusted by relevant operations and maintenance personnel.

[0073] Step S204: Based on the sorting weight of the paths of each node in the preset data model, traverse the nodes in the object tree and generate the configuration information of the network device according to the command generation rules of different types of nodes.

[0074] The configuration information for network devices includes configuration commands and parameters used to configure the network devices. In configuration management based on a preset data model, configuration generation is the process of traversing the nodes in the object tree of the preset data model, generating and outputting the configuration information corresponding to the nodes in the object data.

[0075] The command generation rules for different types of nodes define the transformation rules for converting nodes in the object tree of the preset data model into configuration information. Since the preset data model adds extended keywords to the integration of the original data model, the command generation rules for nodes containing extended keywords also include transformation rules for those extended keywords.

[0076] When the original data model uses the Yang model, the original Yang model cannot define the output format of the CLI configuration. For example, the leaf node of the Yang model is defined as follows:

[0077] leaf ntp-service-source{

[0078] The data type of the leaf node ntp-service-source is string.

[0079] }

[0080] In practical applications, the leaf node definition above is used to specify the source interface used by NTP (Network Time Protocol) client operations. If the above leaf node definition is directly output as a CLI command, we get: ntp-service-source XXX, where XXX refers to the specific command parameters. However, the actual CLI configuration should be ntp-service source XXX.

[0081] Therefore, it is necessary to predefine the command generation rules for different types of nodes in the extended Yang model and the command generation rules for extended keywords to ensure the accuracy and ease of use of the generated configuration information.

[0082] As mentioned earlier, the Yang model involves node types, and the specific command generation rules for different node types include the following:

[0083] (1) The value of the leaf node and the name of the leaf node are written on the same line of command, separated by a space. When the data type of the leaf node is empty, only the name of the leaf node is output. The key nodes of the list node, although they are of the leaf node type, are not output separately, but must be output on the same line as the list node command. The value of the leaf-list node and the name of the leaf-list node are written on the same line of command, separated by a space. Multiple values ​​of the leaf-list node are also separated by spaces. The names of the augmentation node, choice node and case node do not appear in the output of the command line.

[0084] The command generation rules for the extended keywords mentioned above are as follows:

[0085] (2) The node name of the list node is not output in the command line, but the node names of its child nodes are output. That is, the elements in the list node are traversed and output. If the key node of the list node does not have the expansion keyword nokeyword "false", then the node name of the key node will not appear in the command line.

[0086] (3) If the list or container node is marked with the extended keyword view "true", then when outputting the command line of the child node of the node, it is not necessary to include the information of the node, and the indentation of the command line should be increased; conversely, if the list or container node is not marked with the extended keyword view, then when outputting the command line of the child node of the node, the information of the node should be included, and the indentation of the command line should not be increased.

[0087] (4) When a node is marked with the extended keyword nokeyword "true", the node name of that node will not be displayed in the command line of that node.

[0088] (5) When a node is marked with one-line "fix-order|xxx xxx", the node specified in fix-order and this node must be output to the same command line. fix-order means that the output order must follow the order specified in fix-order. There is also a mark any-order|xxx xxx, which means that the output order can be arbitrary.

[0089] (6) When a node is marked with complete "false", it means that the node is not the end of a complete command line and therefore cannot be output. The extended keyword "complete" can be used in container and list nodes. When outputting the command line of a node, the default value for list nodes is completed "true" and for container nodes it is completed "false".

[0090] (7) When a node is marked with alias "xxx", the node name will be replaced with the value specified by alias when the command line is output.

[0091] (8) When a node is marked with optional "true", it means that the node is an optional parameter and can be omitted from the command line.

[0092] By instantiating a preset data model using specific configuration data, an object tree is obtained. The object tree can then generate corresponding configuration information, enabling automatic configuration generation without requiring network operations personnel to write configuration commands, thus further reducing operations and maintenance costs.

[0093] In this embodiment, the network device configuration information is generated by traversing the nodes in the object tree according to the sorting weight of the paths of each node in the preset data model and according to the command generation rules of different types of nodes.

[0094] The default data model includes the extended keyword "view". When the extended keyword "view" is marked as "true", it indicates that the current node is a view node, corresponding to a view, such as an interface configuration view or a BGP view. A view node can include nodes of the various types mentioned above.

[0095] When traversing nodes in an object tree, for view nodes at the same level, the traversal order of view nodes can be controlled according to the sorting weight of the view to which the node belongs; for descendant nodes under any view node, the traversal order of descendant nodes under the view node can be controlled according to the sorting weight of the paths of each node contained in the view.

[0096] In one example scenario, the view weight generation rule requires that the sort weight of a view that appears earlier in the sequence is less than the sort weight of a view that appears later in the sequence, and the sort weight of a node path that appears earlier in the sequence is less than the sort weight of a node path that appears later in the sequence. In this step, when traversing nodes in the object tree, for view nodes at the same level, the view nodes with lower sort weights are traversed first, based on the sort weight of the view to which the node belongs. For any descendant node under any view node, the nodes with lower sort weights are traversed first, based on the sort weight of the node's path, to generate the corresponding configuration information.

[0097] In another example scenario, the view weight generation rule requires that the ranking weight of views appearing earlier in the sequence be greater than that of views appearing later in the sequence, and that the ranking weight of the path of a node appearing earlier in the sequence be greater than that of the path of a node appearing later in the sequence. In this step, when traversing nodes in the object tree, for view nodes at the same level, the view nodes with higher ranking weights are traversed first, based on the ranking weight of the view to which the node belongs. For any descendant node under any view node, the nodes with higher ranking weights are traversed first, based on the ranking weight of the node's path, to generate the corresponding configuration information.

[0098] In this embodiment, during configuration generation, a data instance of a preset data model for the network device is obtained, including the network device's configuration data. Based on the configuration data in the data instance, an object tree of the preset data model is constructed. The sorting weight of the paths of each node in the preset data model is determined. Based on the sorting weight of the paths of each node in the preset data model, the nodes in the object tree are traversed, and the configuration information of the network device is generated according to the command generation rules for different types of nodes. By controlling the traversal order of nodes in the object tree of the preset data model through the sorting weight of the paths of each node, the correct order of the generated network device configuration information can be ensured, improving the efficiency, accuracy, and consistency of network management and operation, thereby improving operational efficiency and ensuring the stable and secure operation of the network device.

[0099] Figure 3 A flowchart for determining the sorting weights of node paths, provided as an exemplary embodiment of this application. For example... Figure 3 As shown, in step S203 above, the ranking weights of the paths of each node in the preset data model are determined. The specific steps are as follows:

[0100] Step S301: Obtain the configuration file of the existing network device.

[0101] In practical applications, network devices vary in architecture, model, and role, resulting in different configuration requirements. Therefore, it is necessary to analyze the configuration files of each device on a large number of existing network devices and compile a comprehensive list of the correct configuration order. The configuration files of these existing network devices contain multiple configuration lines, which can be obtained by acquiring the configuration output and command echoes from the devices.

[0102] In a large number of configuration files, the directly adjacent configurations before and after the same configuration may include multiple different configurations, that is, the order between configurations has a many-to-many mapping relationship. Therefore, in this embodiment, a directed graph is used to model the order relationship between configurations, which can effectively model the order relationship between configurations.

[0103] Furthermore, considering that network device configurations are organized in a view structure, a corresponding sequential directed graph is generated for each view by parsing the configuration files of a large number of existing network devices. The sequential directed graph of a view includes vertices and directed edges. Vertices represent nodes belonging to that view in the predefined data model, and their attributes include the node paths of the corresponding nodes. Directed edges represent the order of the node paths corresponding to the connected vertices.

[0104] Step S302: Based on the preset data model, parse the configuration file to determine the view to which the configuration commands in the configuration file belong, as well as the order of the configuration commands contained in each view and the path of the corresponding node.

[0105] The preset data model is obtained by adding extended keywords to the original data model. These extended keywords declare the node attributes of the preset data model, and each node attribute must include at least a view attribute declaring the view to which the node belongs. The node attributes declared by the extended keywords indicate the conversion method between the object tree of the preset data model and the configuration text of the network device.

[0106] The raw data model is a model used to model the configuration information of network devices. Provided by the device manufacturer, it can be understood as a model that models the device's configuration information. The raw data model has a tree-like syntax structure, used to describe the overall status, configuration, and operation of the device, helping network operators better understand and manage it. For example, the raw data model can be the Yang model provided by the device manufacturer, which includes attribute definitions for multiple nodes. These attribute definitions describe the properties of each node. The node types involved in the Yang model mainly include: leaf nodes, list nodes, leaf-list nodes, and container nodes. A leaf node's attribute has a definite value, such as an integer or string. A container node's attribute is a collection of child nodes, without a value; the number and type of child nodes are not limited and can be container nodes, leaf nodes, leaf-list nodes, or list nodes. A leaf-list node is a collection of leaf nodes, each with a definite value. A list node defines a sequence of list entries. Each entry is uniquely identified by the value of its key leaf node. A list node can define multiple key leaf nodes and can also contain child nodes of any type (including leaf nodes, list nodes, container nodes, etc.).

[0107] By adding extension keywords to the original data model, the data model can be expanded. In the data model, extension keywords are used to declare node attributes, which in turn indicate the conversion method between the object tree of the preset data model and the configuration text of the device. Therefore, extension keywords can supplement the node attribute definition to ensure conversion accuracy.

[0108] For example, extended keywords may include keywords for indicating node aliases (alias), keywords for indicating view attributes (view or default-view), keywords for indicating parameter output attributes (one-line), keywords for indicating parameter attributes (optional), keywords for indicating node name output attributes (nokeyword), and extended keywords for indicating command output (completed), etc.

[0109] For example, taking the original data model as the Yang model, the following is a Yang file configuration file for the interface based on the extended Yang model:

[0110]

[0111]

[0112] In the extended interface configuration Yang file, for Yang nodes whose names do not match the names of the corresponding configuration commands, the alias of the Yang node will be defined as the name of the corresponding configuration command to facilitate the generation of configuration information.

[0113] In the extended Yang model, nodes are represented using corresponding paths, which are strings concatenated from the root to the current node's name, separated by a delimiter (such as " / "). Each node's path is unique.

[0114] The names and paths of each Yang node in the interface configuration Yang file based on the extended Yang model are shown in Table 1. The root node in the interface configuration Yang file is named "interface" and its path is represented as " / interface". This root node is a view node. Under this root node, there are three leaf nodes named "ip-binding-vpn-instance", "ip-policy-based-route", and "ipv6-policy-based-route", as well as list nodes named "ipv4-address" and "ipv6-address", with their corresponding paths shown in Table 1.

[0115] Table 1

[0116] Yang node name Yang node path interface / interface ip-binding-vpn-instance / interface / ip-binding-vpn-instance ip-policy-based-route / interface / ip-policy-based-route ipv6-policy-based-route / interface / ipv6-policy-based-route IPv4 address / interface / ipv4-address ipv6-address / interface / ipv6-address

[0117] The configuration file is parsed according to the preset data model to obtain the view to which the configuration commands in the configuration file belong, as well as the order of the configuration commands contained in each view and the path of the corresponding node.

[0118] For example, the following is an example of interface configuration in a configuration file, denoted as Interface Configuration 1:

[0119] interface HGE0 / 0 / 1

[0120] IP address 10.68.248.185 255.255.255.252

[0121] ipv6 address fd00:0:1020:1ca::1 / 64

[0122] ipv6 policy-based-route pbr6-Access

[0123] Based on the aforementioned interface configuration Yang file (containing part of the interface configuration view in the extended Yang model) based on the extended Yang model, parsing interface configuration 1 reveals that these configurations all belong to the same interface configuration view, and yields the CLI configuration order and corresponding Yang node paths as shown in Table 2 below:

[0124] Table 2

[0125] order CLI Configuration Information Yang node path 1 interface HGE0 / 0 / 1 / interface 2 IP address 10.68.248.185 255.255.255.252 / interface / ipv4-address 3 ipv6 policy-based-route pbr6-Access / interface / ipv6-policy-based-route 4 ipv6 address fd00:0:1020:1ca::1 / 64 / interface / ipv6-address

[0126] For example, here is another example in the configuration file, denoted as Interface Configuration 2:

[0127] interface HGE0 / 0 / 2

[0128] ip binding vpn-instance PRIVATE_TC0

[0129] IP address 10.68.248.181 255.255.255.252

[0130] ip policy-based-route pbr4-Access

[0131] ipv6 policy-based-route pbr6-Access

[0132] ipv6 address fd00:0:1020:1c9::1 / 64

[0133] Based on the aforementioned interface configuration Yang file (containing part of the interface configuration view in the extended Yang model) based on the extended Yang model, parsing this interface configuration reveals that these configurations all belong to the same interface configuration view, and yields the CLI configuration order and corresponding Yang node paths as shown in Table 3 below:

[0134] Table 3

[0135] order CLI Configuration Information Yang node path 1 interface HGE0 / 0 / 2 / interface 2 ip binding vpn-instance PRIVATE_TC0 / interface / ip-binding-vpn-instance 3 IP address 10.68.248.181 255.255.255.25 / interface / ipv4-address 4 ip policy-based-route pbr4-Access / interface / ip-policy-based-route 5 ipv6 policy-based-route pbr6-Access / interface / ipv6-policy-based-route 6 ipv6 address fd00:0:1020:1c9::1 / 64 / interface / ipv6-address

[0136] As can be seen from Tables 2 and 3, the order of the Yang node paths can be used to represent the order of the corresponding CLI configurations.

[0137] Step S303: Construct a sequential directed graph of the view based on the arrangement order of the configuration commands contained in the view and the corresponding nodes. The sequential directed graph includes vertices and directed edges. Vertices represent nodes belonging to the view in the preset data model. The attributes of vertices include the node paths of the corresponding nodes. Directed edges represent the arrangement order between the node paths corresponding to the connected vertices.

[0138] In this embodiment, to construct a sequential directed graph corresponding to different views, the sequential directed graph is defined to include vertices and directed edges. A vertex corresponds to a node in a preset data model; one vertex represents one node in the preset data model. The attributes of a vertex include the node path to the corresponding node and the view it belongs to. To facilitate the calculation and storage of the ranking weights of each node, the attributes of a vertex may also include the vertex's in-degree and ranking weight. Additionally, vertices may include other attributes, which can be designed and adjusted according to actual application requirements; no specific limitations are made here.

[0139] In a sequential directed graph, a directed edge points from the starting node (referred to as the start point) to the ending node (referred to as the end point). This indicates that in at least one configuration file, the configuration command corresponding to the start point is adjacent to the configuration command corresponding to the end point, and the configuration command corresponding to the start point appears before the configuration command corresponding to the end point.

[0140] For example, the vertices in a sequentially directed graph can be defined as the following data structure:

[0141]

[0142] In this dataset, "simplePath" is a string representing the node's path. "pathIn" is an integer representing the node's in-degree, i.e., the number of nodes pointing to that node. "weight" is an integer representing the node's ranking weight. "inViewName" is a string representing the view it belongs to. It should be noted that the node's ranking weight can be either an integer or a floating-point number; this example uses an integer ranking weight for illustration, and the data type of the node's ranking weight is not specifically limited.

[0143] For example, a sequential directed graph can be defined as the following data structure:

[0144] class YangTopologyGraph{

[0145] private String inViewName;

[0146] private Set <yangtopologynode>vertexSet;

[0147] private Map<YangTopologyNode,Set <yangtopologynode>>outNodes;

[0148] }

[0149] Among them, the type of "inViewName" is String, representing the view corresponding to the sequential directed graph. "vertexSet" represents the vertex set of the sequential directed graph. "outNodes" is a mapping from vertices to vertex sets, storing the set of vertices pointed to by each vertex.

[0150] In this embodiment, as Figure 4 shown, the specific steps for constructing the sequential directed graph of the view include:

[0151] Step S3031: Generate corresponding vertices for each node in the preset data model and configure the attributes of the vertices. The attributes of the vertices include the node path and the belonging view of the corresponding node.

[0152] In this embodiment, first, according to the preset data model, generate vertices in a sequential directed graph for each node in the preset data model, and store the node paths and the belonging views corresponding to the vertices.

[0153] Optionally, the node paths corresponding to the vertices can be stored in the format of <node path, vertex> key-value pairs to facilitate quickly determining the correspondence between the node paths and the vertices in the sequential directed graph.

[0154] Step S3032: Construct the sequential directed graphs of each view according to the belonging views of the vertices corresponding to the nodes. The sequential directed graph of any view includes the vertices corresponding to the nodes included in the view.

[0155] In this step, create the sequential directed graph of each view according to the view. The newly created sequential directed graph of the view only includes the vertices corresponding to the nodes included in the view and does not include any edges for the time moment.

[0156] Exemplarily, taking the preset data model as the extended Yang model, generate a vertex YangTopologyNode in the sequential directed graph for each Yang node in the extended Yang model. The node paths corresponding to the vertices can be stored in the format of <Yang node path, YangTopologyNode> key-value pairs, and create the directed graph YangTopologyGraph under each view according to the view.

[0157] Step S3033: Determine the arrangement order of the paths of the nodes included in each view according to the arrangement order of the configuration commands included in each view and the corresponding nodes.

[0158] In this embodiment, by traversing the configuration files of existing network devices, the configuration files of the current device are parsed based on a preset data model to obtain the view to which the configuration commands in the configuration file belong, as well as the order of the configuration commands contained in each view and the path of the corresponding node.

[0159] Furthermore, based on the order of the configuration commands contained in the view and the path of the node corresponding to the configuration command, the order of the paths of the nodes contained in the view can be determined (as shown in Table 2).

[0160] Step S3034: According to the order of the paths of the nodes contained in each view, add directed edges corresponding to the paths of adjacent nodes to the sequential directed graph of the view.

[0161] In this embodiment, the directed edges in the sequential directed graph of the views represent the arrangement order of the node paths corresponding to the connected vertices. In this step, according to the arrangement order of the paths of the nodes contained in each view, directed edges are constructed in the sequential directed graph of the views, pointing from the vertex corresponding to the previous node path to the vertex corresponding to the next node path.

[0162] This step can be implemented as follows: Based on the order of the paths of the nodes contained in each view, for any two adjacent first node paths and second node paths, where the first node path precedes the second node path, if there is no directed edge in the directed sequence graph of the view pointing from the vertex corresponding to the first node path to the vertex corresponding to the second node path, and there is no path from the vertex corresponding to the second node path to the vertex corresponding to the first node path, then add a directed edge in the directed sequence graph of the view pointing from the vertex corresponding to the first node path to the vertex corresponding to the second node path.

[0163] Specifically, based on the order of the paths of the nodes contained in each view, for any two adjacent node paths, taking the two node paths with order i and i+1 as examples, the vertices corresponding to these two adjacent node paths are respectively denoted as Node. i and Node i+1 If there is no Node in the directed sequence graph of the view. i Pointing to Node i+1 Edge (represented as) <Node i Node i+1 >), and there is no node i+1 To Node i The path, then in the directed graph of the view order, corresponds to the vertices of the paths between two adjacent nodes. i and Node i+1 Add directed edges between nodes, with the starting point of the directed edge being the vertex corresponding to the path of the node that appears earlier in the sequence, and the ending point being the vertex corresponding to the path of the node that appears later in the sequence.

[0164] In this embodiment, the directed sequence graph of the view does not contain a vertex Node. i+1 To the vertex Node i Only when the path is defined do directed edges are added to the sequential directed graph of the views. <Node i Node i+1 This ensures that the ordered directed graph of the view is a directed acyclic graph, and allows for topological sorting of the ordered directed graph.

[0165] For example, for any sequential directed graph of views, based on the order of the paths of the nodes contained in the view, starting from the first node path (i.e., the node path with order 1, whose corresponding vertex is Node1), the vertices corresponding to each node path are traversed sequentially according to the order of arrangement. For any vertex corresponding to the currently traversed node path, the vertex corresponding to the node path with order i is Node1. i For example, determine whether the ordered directed graph of the view contains a node. i Pointing to Node i+1 directed edges <Node i Node i+1 > and by Node i+1 To Node i The path. If there is no directed edge. <Node i Node i+1 And there is no node i+1 To Node i If the path is such that a directed edge is added to the sequential directed graph of that view, then a directed edge is added. <Node i Node i+1 >, and soon Node i+1 Add to Node i In the set of vertices pointed to, Node i+1 Increment the in-degree by 1. If the order of the view is a missing vertex Node in the directed graph. i and / or vertex Node i+1 Then first add the missing Node. i and / or Node i+1 Add directed edges <Node i Node i+1 >

[0166] If the order of the views exists in the directed graph <Node i Node i+1 >, or there exists a Node i+1 To Node i If the path is correct, then there is no need to add it to the sequential directed graph of that view. <Node i Node i+1 > Continue traversing the path to the next node.

[0167] For example, taking the aforementioned interface configuration 1 and interface configuration 2 as examples, after constructing the vertices of the directed graph of the interface configuration view, there are currently no directed edges in this directed graph. Parsing interface configuration 1, the order of Yang node paths in this view is shown in Table 2. Adding any two adjacent Yang node paths to the directed graph of the interface configuration view, the directed edge pointing from the vertex corresponding to the first Yang node path to the vertex corresponding to the second Yang node path, yields the following... Figure 5a The diagram shows a directed graph in sequence.

[0168] Next, we parse interface configuration 2, and the resulting order of Yang node paths in the view is shown in Table 3. First, we traverse the Yang node paths / interfaces with order 1, corresponding to vertex Node1. It can be determined that the current ordered directed graph of this view (e.g., ...) Figure 5a As shown), it does not include Node2 (i.e., the vertex corresponding to the Yang node path / interface / ip-binding-vpn-instance with sequence number 2), therefore it does not exist.<Node1,Node2> And the path from Node2 to Node1, therefore, the current ordered directed graph to this view (e.g., Figure 5a Add (as shown)<Node1,Node2> This involves adding directed edges from the vertex corresponding to the Yang node path " / interface" to the vertex corresponding to the Yang node path " / interface / ip-binding-vpn-instance", resulting in the following: Figure 5b The diagram shows a directed graph in sequence. Following this pattern, the paths of subsequent Yang nodes are traversed sequentially, corresponding to vertices Node2, Node3, and Node4.<Node2,Node3> ,<Node3,Node4> and<Node4,Node5> Insert in sequence as follows Figure 5b In the directed graph shown in the sequence, we obtain the following: Figure 5c The diagram shows a directed graph in sequence.

[0169] Next, traverse the Yang node path / interface / ipv6-policy-based-route with the order 5, corresponding to vertex Node5. Clearly, this view is currently a directed graph (e.g., ...). Figure 5c As shown), there already exists a path from vertex Node6 to Node5 corresponding to the Yang node path with the sequence number 6 (i.e.,<Node6,Node5> This indicates that there exists a directed edge between the Yang node path " / interface / ipv6-address" (order 6) and the Yang node path " / interface / ipv6-policy-based-route" (order 5). Therefore, the two configuration commands do not have a strict order and do not need to be added.<Node5,Node6> To avoid creating cycles in a sequential directed graph. Figure 5c This is a directed graph of the interface views that are ultimately determined based on interface configuration 1 and interface configuration 2.

[0170] Step S304: Perform topological sorting on the directed graph of the views to determine the order of the node paths in the directed graph of the views.

[0171] After obtaining the ordered directed graphs of each view, a topological sort is performed on the ordered directed graphs of each view to determine the order of the paths of the nodes contained in the ordered directed graphs of each view.

[0172] Topological sorting is very useful for solving problems with dependencies. It sorts nodes in a directed acyclic graph (DAG) according to their dependencies to obtain a reasonable execution order. However, topological sorting restricts the graph to be a DAG. In this embodiment, the edges in the sequential directed graph of the constructed views are directed edges, satisfying the directed property and having a clear order relationship. Furthermore, each time a new directed edge is inserted into the sequential directed graph, it is guaranteed that there is no reverse path to the inserted edge before the new edge is inserted, thus ensuring that no cycles are generated in the sequential directed graph. Therefore, the sequential directed graph of each constructed view is itself a DAG, and topological sorting can be used to solve for the arrangement order of each vertex (corresponding node path) in the sequential directed graph of the view.

[0173] In this step, for any sequential directed graph of views, the following topological sort is performed cyclically:

[0174] Identify the target vertex in the directed graph that has no predecessor, add the node path of the target vertex to the end of the sorting result; remove the target vertex and the directed edges originating from the target vertex from the directed graph. Continue until the directed graph contains no arbitrary vertices. The resulting sorting result includes the order of the node paths in the directed graph of the view.

[0175] It should be noted that in any iteration of the cycle, if there are multiple vertices without predecessors in the sequential directed graph, any one of these vertices without a predecessor can be selected as the target vertex. The method of selecting the target vertex can be random or configured by the relevant operations and maintenance personnel; no specific restrictions are imposed here.

[0176] For example, with Figure 5c Taking the sequential directed graph of the interface configuration view shown as an example, the process of cyclically performing topological sorting includes:

[0177] Round 1:

[0178] S1-1. Select a target vertex from this directed graph that has no predecessor (i.e., has an in-degree of 0). Figure 5c The vertex corresponding to the node path " / interface" shown in the figure is output, and the node path corresponding to the target vertex is output: / interface;

[0179] S1-2, from Figure 5c The directed graph shown in the diagram is modified by deleting the target vertex and the directed edges originating from that target vertex, resulting in the following: Figure 6a The diagram shows a directed graph in sequence.

[0180] Round 2:

[0181] S1-1. Select a target vertex from this directed graph that has no predecessor (i.e., has an in-degree of 0). Figure 6a The vertex corresponding to the node path " / interface / ip-binding-vpn-instance" shown in the figure is output, and the node path corresponding to the target vertex is output: / interface / ip-binding-vpn-instance;

[0182] S1-2, from Figure 6a The directed graph shown in the diagram is modified by deleting the target vertex and the directed edges originating from that target vertex, resulting in the following: Figure 6b The diagram shows a directed graph in sequence.

[0183] Similarly, delete " / interface / ipv4-address", " / interface / ip-policy-based-route", " / interface / ipv6-address", and " / interface / ipv6-policy-based-route" in sequence until the directed graph is empty. The order of the output node paths is shown in Table 4 below:

[0184] Table 4

[0185] order Yang node path 1 / interface 2 / interface / ip-binding-vpn-instance 3 / interface / ipv4-address 4 / interface / ip-policy-based-route 5 / interface / ipv6-address 6 / interface / ipv6-policy-based-route

[0186] In addition, any topological sorting algorithm for directed acyclic graphs can be used in this step to achieve topological sorting of the ordered directed graph of views. This embodiment does not make any specific limitations here.

[0187] Step S305: Determine the sorting weight of the paths of the nodes contained in the view according to the order of the node paths in the directed graph of the view.

[0188] In this step, based on the order of the node paths in the directed graph according to the view's order, the sorting weight of the paths of the nodes contained in the view is determined according to the node weight generation rules. Specifically, the sorting weight of a path of a node that appears earlier in the sequence is less than the sorting weight of a path of a node that appears later in the sequence; or, the sorting weight of a path of a node that appears earlier in the sequence is greater than the sorting weight of a path of a path that appears later in the sequence.

[0189] The node weight generation rules can be configured and adjusted by relevant operations and maintenance personnel according to actual application needs, and no specific restrictions are imposed here.

[0190] In one optional implementation of this step, the ranking weight of the first node path in the directed graph can be set to a preset weight value according to the node weight generation rule, based on the order of the node paths in the view. Then, the ranking weights of each node path after the first one in the directed graph can be set to the result of adding a preset increment to the ranking weight of the previous node path. The preset weight value and preset increment in the node weight generation rule can be configured and adjusted according to actual application needs and experience; for example, the preset weight value can be 10, and the preset increment can be 10. No specific limitation is made here.

[0191] In another optional implementation of this step, the sorting weight of the node paths in the directed graph can be set to the sorting order multiplied by the magnification factor, according to the node weight generation rules, based on the order of the views. The magnification factor can be configured and adjusted according to actual application needs and experience; for example, it can be 10, and no specific limitation is made here.

[0192] For example, based on the arrangement order of the node paths shown in Table 4, the ranking weights of each node path are determined as shown in Table 5 below:

[0193] Table 5

[0194] order Yang node path Sorting weight 1 / interface 10 2 / interface / ip-binding-vpn-instance 20 3 / interface / ipv4-address 30 4 / interface / ip-policy-based-route 40 5 / interface / ipv6-address 50 6 / interface / ipv6-policy-based-route 60

[0195] For example, an example of an interface configuration object tree based on the extended Yang model is as follows: Figure 7 As shown. Without using the path sorting weights of each node to control the traversal order, the nodes are traversed sequentially in a left-first manner. Figure 7 The leaf nodes numbered 1, 2, 3, 4, 5, and 6 in the object tree shown are used to generate the following configuration information based on the command generation rules corresponding to each type of node:

[0196] interface HGE0 / 0 / 3 / / Configures the interface named HGE0 / 0 / 3

[0197] ip policy-based-route pbr4-Access / / Configures IPv4 policy routing, with the policy name pbr4-Access

[0198] ipv6 policy-based-route pbr6-Access / / Configures IPv6 policy routing, with the policy name pbr6-Access

[0199] IP address 10.68.248.182 255.255.255.252 / / Configure IPv4 address and subnet mask

[0200] IPv6 address fd00:0:1020:1c9::2 / 64 / / Configure IPv6 address and subnet prefix length

[0201] Based on the automatically generated configuration information above, relevant operations and maintenance personnel need to manually adjust the order of the configuration information. The configuration information for configuring the IPv4 address and subnet mask, "ip address 10.68.248.182255.255.255.252", should be placed before the configuration information for configuring IPv4 policy routing for the interface, "ip policy-based-routepbr4-Access". Similarly, the configuration information for configuring the IPv6 address and subnet prefix length, "ipv6 address fd00:0:1020:1c9::2 / 64", should be placed before the configuration information for configuring the IPv6 address and subnet prefix length for the interface, "ipv6policy-based-route pbr6-Access", to ensure proper configuration.

[0202] Based on the node path sorting weights determined in Table 5 according to the scheme of this embodiment, the nodes with smaller sorting weights are traversed sequentially. Figure 7 The leaf nodes numbered 1, 4, 5, 2, 6, and 3 in the object tree shown generate configuration information in the following order:

[0203] interface HGE0 / 0 / 3

[0204] IP address 10.68.248.182 255.255.255.252

[0205] ip policy-based-route pbr4-Access

[0206] ipv6 address fd00:0:1020:1c9::2 / 64

[0207] ipv6 policy-based-route pbr6-Access

[0208] This embodiment's solution leverages the Yang model's CLI modeling capabilities to parse configuration files from existing network devices and uses a directed graph to model the order of configuration commands. Based on the configuration of all network devices, it generates a sequence relationship graph of each view, effectively modeling the sequential relationships between configuration commands. Furthermore, it performs topology sorting based on the directed graph of view order to determine the arrangement order of node paths within the graph. Based on this arrangement order, it determines the ranking weight of the paths of the nodes contained in each view, which is used to generate the configuration. This ensures that the generated configuration order strictly matches the configuration feedback order of the existing network devices, improving operational efficiency and ensuring the stable and secure operation of network devices.

[0209] In practical applications, the configuration of existing network devices is constantly changing. In one optional embodiment, after determining the ranking weight of the paths of each node in the preset data model, the server can update the ranking weight of the paths of each node in the preset data model for newly added configuration files during this period at regular intervals, so as to update the ranking weight of the paths of each node in the preset data model in real time and improve the effectiveness and accuracy of the ranking of generated configuration information.

[0210] For example, by setting a scheduled task, the previous day's directed graph is stored as the initial directed graph for the next day. This process continues to traverse the network devices, adding newly appearing configuration orders to the existing directed graph, thus obtaining a daily updated directed graph. Then, a topology sort is performed based on the daily updated directed graph to determine the sorting weight of the paths of the nodes contained in each view, and this weight is stored in a database for use during configuration generation.

[0211] Figure 8 A flowchart illustrating a configuration management method provided for another exemplary embodiment of this application. (See attached flowchart.) Figure 8 As shown, the configuration management method also includes the following steps:

[0212] Step S801: Obtain the incremental configuration file within the previous time interval according to the preset time interval.

[0213] The preset time interval can be one day, several minutes, several days, etc., and can be configured and adjusted according to actual application needs. No specific limitations are specified here. The incremental configuration file is a file containing the new configurations from the previous time interval.

[0214] Step S802: Parse the incremental configuration file, determine the view to which the incremental configuration commands in the incremental configuration file belong, and the order of the incremental configuration commands contained in each view and the corresponding nodes.

[0215] Step S803: Update the sequential directed graph of the view according to the order of the incremental configuration commands contained in the view and the corresponding nodes.

[0216] Step S804: Perform topological sorting on the updated ordered directed graph of the view to determine the order of node paths in the updated ordered directed graph of the view.

[0217] Step S805: Update the sorting weight of the paths of the nodes contained in the view according to the arrangement order of the node paths in the directed graph after the view is updated.

[0218] The specific implementation principle of this embodiment can be found in the relevant content of the foregoing embodiments, and will not be repeated here.

[0219] Figure 9 This is a framework diagram of the configuration management method provided in an embodiment of this application. Figure 9 As shown, the configuration management method includes the following functional modules:

[0220] Configuration parsing and sequential directed graph generation: Parses the configuration files of a large number of live network devices and constructs a sequential directed graph based on the parsing results.

[0221] Topological sorting: Performs a topological sort on a directed graph to determine the order of the paths between nodes and to determine the sorting weights of the paths.

[0222] Configuration generation: Based on the data instances of the network device's preset data model, construct the object tree of the preset data model; based on the sorting weight of the paths of each node in the preset data model, traverse the nodes in the object tree and generate the network device's configuration information according to the command generation rules for different types of nodes.

[0223] Scheduled updates: At regular intervals, the directed graph is updated according to the order of newly added configuration files, as well as the sorting weight of the paths of each node in the preset data model, to improve the effectiveness and accuracy of the sorting of generated configuration information.

[0224] This embodiment uses data models such as the Yang model to analyze the configuration output and command echoes of existing network devices line by line, obtaining the correct order of configuration outputs. The node paths corresponding to configuration commands and the order relationships between these paths are continuously added to a directed graph, thus obtaining the order relationship of the configurations of existing network devices. Since device configurations may change, this solution is executed periodically to periodically acquire and analyze the configuration files of existing network devices, adding the newly emerging configuration order to the directed graph. The ranking weight of each node path is determined through topology sorting and stored in a database for use in generating new device configurations, thereby improving the correctness of the configuration generation order. Ensuring the correct configuration order not only helps improve network management efficiency but also significantly reduces the risk of configuration errors, ensuring the stable and secure operation of network devices.

[0225] Figure 10 A flowchart illustrating a configuration management method provided as another exemplary embodiment of this application. Figure 10 As shown, the specific steps of this method are as follows:

[0226] Step S1001: In response to the configuration request for the newly added network device, obtain the data instance of the network device's preset data model. The data instance includes the network device's configuration data.

[0227] In this embodiment, the network configuration application / software running on the end-side device can be various network configuration management platforms, systems, etc. When it is necessary to obtain the configuration information of a newly added network device, the end-side device provides an instance input interface for the preset data model of the network device. Through this instance input interface, the configuration data of the preset data model of the network device can be configured and input to obtain a data instance of the preset data model of the network device.

[0228] The end device sends a configuration request to the server for the newly added network device. This configuration request contains data instances of the network device's preset data model.

[0229] Step S1002: Construct the object tree of the preset data model based on the configuration data in the data instance.

[0230] Step S1003: Determine the sorting weight of the paths of each node in the preset data model.

[0231] Step S1004: Based on the sorting weight of the paths of each node in the preset data model, traverse the nodes in the object tree and generate the configuration information of the network device according to the command generation rules of different types of nodes. The configuration information includes configuration commands and parameters.

[0232] Step S1005: Output the configuration information of the network device.

[0233] After generating the correctly ordered configuration information, the server returns the network device configuration information to the end-side device.

[0234] The specific implementation principle of this embodiment can be found in the relevant content of the foregoing embodiments, and will not be repeated here.

[0235] Figure 11 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Figure 11 As shown, the server includes a memory 1101 and a processor 1102. The memory 1101 stores computer-executable instructions and can be configured to store various other data to support operations on the server. The processor 1102 is communicatively connected to the memory 1101 and executes the computer-executable instructions stored in the memory 1101 to implement the technical solutions provided in any of the above-described method embodiments. Their specific functions and the technical effects they achieve are similar and will not be repeated here.

[0236] Optional, such as Figure 11 As shown, the server also includes other components such as a firewall 1103, a load balancer 1104, a communication component 1105, and a power supply component 1106. Figure 11 The diagram only shows some components and does not mean that the server only includes... Figure 11 The components shown. Figure 11 This example uses a cloud server deployed in the cloud as an example, but the server can also be deployed locally. This embodiment does not make any specific limitations here.

[0237] This application also provides a computer-readable storage medium storing computer-executable instructions. When a processor executes the computer-executable instructions, it implements the method of any of the foregoing embodiments. The specific functions and technical effects to be achieved are not described here.

[0238] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method of any of the foregoing embodiments. The computer program is stored in a readable storage medium, and at least one processor of the server can read the computer program from the readable storage medium. The execution of the computer program by the at least one processor causes the server to perform the technical solution provided in any of the above method embodiments. The specific functions and the technical effects that can be achieved are not described here.

[0239] This application provides a chip, including a processing module and a communication interface. The processing module is capable of executing the technical solution of the server in the aforementioned method embodiments. Optionally, the chip further includes a storage module (e.g., a memory), which stores instructions. The processing module executes the instructions stored in the storage module, and the execution of the instructions stored in the storage module causes the processing module to execute the technical solution provided in any of the aforementioned method embodiments.

[0240] The integrated modules described above, implemented as software functional modules, can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods of the various embodiments of this application.

[0241] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), or other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules from at least one processor.

[0242] The memory may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.

[0243] The aforementioned memory can be object storage (OSS). This memory can be implemented using any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0244] The aforementioned communication components are configured to facilitate wired or wireless communication between the device containing the communication components and other devices. The device containing the communication components can access wireless networks based on communication standards, such as mobile hotspots (WiFi), second-generation (2G), third-generation (3G), fourth-generation (4G) / Long Term Evolution (LTE), fifth-generation (5G), or combinations thereof. In one exemplary embodiment, the communication components receive broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication components also include a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be based on Radio Frequency Identification (RFID), infrared, Ultra Wide Band (UWB), Bluetooth, and other technologies.

[0245] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.

[0246] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.

[0247] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. The processor and storage medium can reside within an application-specific integrated circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components within an electronic device or host device.

[0248] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0249] The order of the embodiments described above is merely for illustrative purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, some processes described in the above embodiments and accompanying drawings include multiple operations appearing in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein or may be executed in parallel. The sequence numbers are merely used to distinguish different operations, and the sequence numbers themselves do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the terms "first," "second," etc., used herein are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types. "Multiple" means two or more, unless otherwise explicitly specified.

[0250] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of the various embodiments of this application.

[0251] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.

[0252] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.< / yangtopologynode> < / yangtopologynode>

Claims

1. A configuration management method, characterized in that, include: Obtain a data instance of a preset data model of a network device, wherein the data instance includes the configuration data of the network device; Based on the configuration data in the data instance, construct the object tree of the preset data model; Determine the sorting weight of the paths of each node in the preset data model; Based on the sorting weight of the paths of each node in the preset data model, the nodes in the object tree are traversed, and the configuration information of the network device is generated according to the command generation rules of different types of nodes. The configuration information includes configuration commands and parameters.

2. The method according to claim 1, characterized in that, Determining the ranking weight of the paths of each node in the preset data model includes: Obtain the configuration files of the devices on the live network; Based on the preset data model, the configuration file is parsed to determine the view to which the configuration commands in the configuration file belong, as well as the arrangement order of the configuration commands contained in the view and the corresponding nodes; Based on the arrangement order of the configuration commands contained in the view and the corresponding nodes, a sequential directed graph of the view is constructed. The sequential directed graph includes vertices and directed edges. The vertices represent the nodes belonging to the view in the preset data model. The attributes of the vertices include the node paths of the corresponding nodes. The directed edges represent the arrangement order between the node paths corresponding to the connected vertices. Perform topological sorting on the ordered directed graph of the views to determine the order of the node paths in the ordered directed graph of the views; The sorting weight of the paths of the nodes contained in the view is determined based on the order of the node paths in the directed graph of the view.

3. The method according to claim 2, characterized in that, Determining the ranking weight of the paths of each node in the preset data model includes: Determine the order in which the views are arranged; The sorting weight of each view is determined based on the order in which they are arranged.

4. The method according to claim 2, characterized in that, The preset data model is obtained by adding extended keywords to the original data model. The original data model is a model that models the configuration information of the network device. The extended keywords are used to declare the node attributes of the preset data model. The node attributes include at least the view attributes used to declare the view to which the node belongs.

5. The method according to claim 2, characterized in that, The directed graph for constructing views includes: Generate corresponding vertices for each node in the preset data model, and configure the attributes of the vertices, including the view to which the corresponding node belongs; Construct a directed graph of each view according to the view to which the node corresponding to the vertex belongs. The directed graph of any view includes the vertices corresponding to the nodes contained in the view. The order of the paths of the nodes contained in each view is determined according to the order of the configuration commands contained in each view and the corresponding nodes. Based on the order of the paths of the nodes contained in each view, add directed edges corresponding to the paths of adjacent nodes to the sequential directed graph of the view.

6. The method according to claim 5, characterized in that, The step of adding directed edges corresponding to adjacent node paths to the sequential directed graph of the views according to the order of the paths of the nodes contained in each view includes: Based on the order of the paths of the nodes contained in each view, for any two adjacent first node paths and second node paths, if the first node path precedes the second node path, and if there is no directed edge in the directed sequence graph of the view pointing from the vertex corresponding to the first node path to the vertex corresponding to the second node path, and there is no path from the vertex corresponding to the second node path to the vertex corresponding to the first node path, then a directed edge pointing from the vertex corresponding to the first node path to the vertex corresponding to the second node path is added to the directed sequence graph of the view.

7. The method according to claim 2, characterized in that, The step of performing topological sorting based on the ordered directed graph of the views to determine the order of node paths in the ordered directed graph of the views includes: For any of the ordered directed graphs of the views described, perform the following topological sorting cyclically: If a target vertex with no predecessor is determined in the ordered directed graph, the node path of the target vertex is added to the end of the sorting result. Remove the target vertex and the directed edge originating from the target vertex from the sequential directed graph; Until the ordered directed graph contains no arbitrary vertices, the obtained sorting result includes the arrangement order of the node paths in the ordered directed graph of the view.

8. The method according to claim 2, characterized in that, The step of determining the sorting weight of the paths of the nodes contained in the view based on the arrangement order of the node paths in the directed graph of the view includes: Based on the order of the node paths in the directed graph of the view, and according to the node weight generation rules, the sorting weight of the paths of the nodes contained in the view is determined, wherein the sorting weight of the path of the node that appears earlier in the sequence is less than the sorting weight of the path of the node that appears later in the sequence, or the sorting weight of the path of the node that appears earlier in the sequence is greater than the sorting weight of the path of the node that appears later in the sequence.

9. The method according to claim 8, characterized in that, The step of determining the sorting weight of the paths of the nodes contained in the view according to the arrangement order of the node paths in the directed graph based on the view, and according to the node weight generation rules, includes: Based on the order of the node paths in the directed graph according to the view, the sorting weight of the first node path is set to a preset weight value. Based on the order of the node paths in the directed graph according to the view, the sorting weight of each node path after the first one is set as the result of the sorting weight of the previous node path plus a preset increment.

10. The method according to claim 8, characterized in that, The step of generating the network device configuration information by traversing the nodes in the object tree according to the path sorting weight of each node in the preset data model and according to the command generation rules of different types of nodes includes: Based on the path sorting weight of each node in the preset data model, the nodes in the object tree are traversed according to the rule of prioritizing the traversal of nodes with smaller sorting weights, and the configuration information of the network device is generated according to the command generation rules of different types of nodes.

11. The method according to any one of claims 2-10, characterized in that, Also includes: Based on a preset time interval, retrieve the incremental configuration file from the previous time interval; The incremental configuration file is parsed to determine the view to which the incremental configuration commands in the incremental configuration file belong, as well as the order of the incremental configuration commands contained in each view and the corresponding nodes. Update the sequential directed graph of the view according to the order of the incremental configuration commands contained in the view and the corresponding nodes; Perform topological sorting on the updated ordered directed graph of the view to determine the order of node paths in the updated ordered directed graph of the view. Based on the updated order of the node paths in the directed graph, update the sorting weight of the paths of the nodes contained in the view.

12. A configuration management method, characterized in that, include: In response to a configuration request for a newly added network device, a data instance of a preset data model of the network device is obtained, the data instance including the configuration data of the network device; Based on the configuration data in the data instance, construct the object tree of the preset data model; Determine the sorting weight of the paths of each node in the preset data model; Based on the sorting weight of the paths of each node in the preset data model, the nodes in the object tree are traversed, and the configuration information of the network device is generated according to the command generation rules of different types of nodes. The configuration information includes configuration commands and parameters. Output the configuration information of the network device.

13. A server, characterized in that, include: At least one processor; as well as A memory that is communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, cause the server to perform the method according to any one of claims 1-12.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1-12.

15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-12.