A method and device for displaying a differential configuration command tree

By generating incremental configuration records and differential configuration command trees, the problem that users cannot trace the transaction execution commands is solved, efficient configuration data traceback and fallback are achieved, and resource consumption for storage and display is reduced.

CN115955397BActive Publication Date: 2025-07-25NANJING NO 3 COMM TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211647589.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-21
Publication Date
2025-07-25
Estimated Expiration
2042-12-21

AI Technical Summary

Technical Problem

In the prior art, users cannot clearly know which commands are executed in each transaction, which leads to difficulty in tracing or rolling back, and the storage and display of full configurations take up a lot of space and takes up time.

Method used

By generating incremental configuration records, the underlying execution commands of the transaction are deduced in reverse, and a differential configuration command tree is generated according to the command hierarchy rules, displaying all commands executed in the transaction.

Benefits of technology

Users can clearly determine the execution process of transactions, facilitate configuration of data backtracking or fallback, reduce storage space usage, and improve display performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115955397B_ABST
    Figure CN115955397B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of communication technologies, and provides a method and an apparatus for displaying a differential configuration command tree. The method includes: when a transaction is committed, generating corresponding incremental configuration records according to the DB records modified by the transaction; obtaining the underlying execution commands executed in the transaction according to the incremental configuration records; and backtracking the upper-level commands of the underlying execution commands according to the command hierarchy rules; generating a differential configuration command tree according to the underlying execution commands and the upper-level commands, so as to display all the commands executed in the transaction to a user. Through the incremental configuration records, the present invention reversely derives the execution commands of the transaction, generates corresponding command line expressions and a differential configuration command tree, so that through the differential configuration command tree, a user can clearly determine the execution process of the transaction, thereby facilitating the execution of configuration data backtracking or data rollback.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technologies, and in particular, to a method and device for displaying a differential configuration command tree. Background Art

[0002] In the prior art, when a transaction submission for network element management configuration is made, the full configuration corresponding to the submission point is usually stored. When displaying the differential configuration corresponding to a certain submission point to a user, a full-text comparison is performed between the full configuration after this submission and the full configuration before the submission for display. For example, when a transaction submission is made, even if only one command is executed, resulting in a change in one data configuration, during display, it is still necessary to perform a full-by-full comparison of the data before and after the submission, and finally obtain the modified differential data. In this case, when the scale of the data configuration is large enough, since a full record needs to be stored for each transaction submission, the occupied storage space is relatively large, and when displaying to the user, a full comparison is required, resulting in a long time consumption.

[0003] Moreover, in the prior art, only the modified data records are displayed to the user. In actual use, network configuration data usually has a certain hierarchical relationship. Just displaying the modified differential data cannot determine the specific location of the modified configuration data. For example, when a certain attribute under a certain interface of a certain node is modified during a transaction submission, just displaying the modified differential data of this attribute cannot enable the user to clearly know which interface this attribute belongs to, or which node it belongs to, and even less can the user know which commands are executed in each transaction. The user is even less able to distinguish which transaction is the one expected by the user, or which transaction has a configuration error and needs to be rolled back.

[0004] In view of this, overcoming the deficiencies of the prior art is an urgent problem to be solved in this technical field. Summary of the Invention

[0005] The technical problem to be solved by the present invention is that in the prior art, the user cannot know which commands are executed in each transaction, resulting in difficulties for the user to trace or roll back transactions.

[0006] The present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a method for displaying a differential configuration command tree, including:

[0008] When a transaction is submitted, an incremental configuration record is generated according to the DB records modified by the transaction;

[0009] According to the incremental configuration record, the underlying execution commands executed in the transaction are obtained;

[0010] And according to the command hierarchy rule, the upper-level commands of the underlying execution commands are inversely queried;

[0011] Generate a differential configuration command tree according to the underlying execution command and the upper-layer command for displaying all the commands executed in the transaction to the user.

[0012] Preferably, obtaining the underlying execution commands executed in the transaction according to the incremental configuration record specifically includes:

[0013] Obtain all possible execution commands corresponding to the configuration class ID according to the configuration class ID in the incremental configuration record;

[0014] In the DB record corresponding to the configuration class ID, find the corresponding parameters according to the display conditions of the possible execution commands, and determine whether the parameters meet the display conditions;

[0015] If the parameters meet the display conditions, the possible execution command is executed in the transaction, and the possible execution command is an underlying execution command.

[0016] Preferably, reverse-looking up the upper-layer command of the underlying execution command according to the command hierarchy rule specifically includes:

[0017] Use the parent command obtained from the previous search as the sub-command for the next search. According to the command hierarchy rule, search for the parent command of the sub-command. The obtained parent command is an upper-layer command of the underlying execution command. Until no corresponding parent command can be found, all the upper-layer commands of the underlying execution command are obtained; among them, in the first search, use the underlying execution command as the sub-command to search for the corresponding parent command.

[0018] Preferably, searching for the parent command of the sub-command according to the command hierarchy rule specifically includes:

[0019] Obtain all possible parent commands of the sub-command according to the command hierarchy rule;

[0020] According to the parent-child parameter inheritance rule, obtain the corresponding parent parameters from the DB record of the possible parent commands, and obtain the corresponding sub-parameters from the DB record of the sub-command, and determine whether the sub-parameters and the parent parameters are consistent;

[0021] If it is determined that the sub-parameters are consistent with the parent parameters, the possible parent command is the parent command of the sub-command.

[0022] Preferably, generating a differential configuration command tree according to the underlying execution command and the upper-layer command specifically includes:

[0023] For the underlying execution commands and upper-layer commands, according to the rule for obtaining expression parameters of the commands, obtain the corresponding parameters; and according to the rule for constructing the command expression, use the parameters to construct the corresponding command-line expression.

[0024] According to the parent-child relationship between the commands, use the command-line expression of the parent command as the parent node and the command-line expression of the child command as the child node to establish a tree-like branch, thereby generating a differential configuration command tree.

[0025] Preferably, the step of obtaining the corresponding parameters according to the rule for obtaining expression parameters of the commands and using the parameters to construct the corresponding command-line expression specifically includes:

[0026] Find the record operation code corresponding to the command, and obtain the operation category of the command according to the record operation code.

[0027] If the operation category of the command is to delete configuration data or create new configuration data, then according to the rule for obtaining expression parameters of the commands, obtain the corresponding modified parameters from the incremental configuration record; according to the rule for constructing the expression and the modified parameters, construct the command-line expression of the command.

[0028] If the operation category of the command is to update configuration data, then according to the rule for obtaining expression parameters of the commands, obtain the corresponding modified parameters and pre-modified parameters from the incremental configuration record; according to the rule for constructing the expression, the pre-modified parameters and the modified parameters, construct the command-line expression of the command.

[0029] Preferably, the method further includes:

[0030] When performing a transaction rollback, generate a corresponding rollback configuration record according to the incremental configuration record of the transaction.

[0031] And generate a corresponding rollback differential configuration command tree according to the differential configuration command tree of the transaction, so as to determine the specific location of the modified configuration data according to the rollback differential configuration command tree.

[0032] Preferably, the step of generating a corresponding rollback differential configuration command tree according to the differential configuration command tree of the transaction specifically includes:

[0033] When performing an overall transaction rollback, use the differential configuration command tree of the transaction as the rollback differential configuration command tree and add corresponding rollback marks.

[0034] When performing a partial transaction rollback, use the rolled-back partial branch in the differential configuration command tree of the transaction as the rollback differential configuration command tree and add corresponding rollback marks.

[0035] Preferably, the command hierarchy rules are stored in an XML file, where sub-commands are stored as subordinate tags of possible parent commands.

[0036] In a second aspect, the present invention further provides a device for displaying a differential configuration command tree, which is used to implement the method for displaying a differential configuration command tree described in the first aspect. The device includes:

[0037] 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, and the instructions are executed by the processor to execute the method for displaying a differential configuration command tree described in the first aspect.

[0038] In a third aspect, the present invention further provides a non-volatile computer storage medium, which stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors to complete the method for displaying a differential configuration command tree described in the first aspect.

[0039] Through incremental configuration records, the present invention reversely derives each execution command of a transaction, generates corresponding command line expressions and a differential configuration command tree, so that through the differential configuration command tree, a user can clearly determine the execution process of the transaction, thereby facilitating the execution of configuration data backtracking or data rollback. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required to be used in the embodiments of the present invention. Obviously, the following described drawings are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.

[0041] Figure 1 is a schematic flowchart of a method for displaying a differential configuration command tree provided by an embodiment of the present invention;

[0042] Figure 2 is a schematic diagram of incremental configuration records in a method for displaying a differential configuration command tree provided by an embodiment of the present invention;

[0043] Figure 3 is a UI schematic diagram for displaying a differential configuration command tree to a user in a method for displaying a differential configuration command tree provided by an embodiment of the present invention;

[0044] Figure 4 is a schematic flowchart of a method for displaying a differential configuration command tree provided by an embodiment of the present invention;

[0045] Figure 5It is a schematic diagram of command display information in a method for displaying a differential configuration command tree provided by an embodiment of the present invention;

[0046] Figure 6 It is a schematic flowchart of a method for displaying a differential configuration command tree provided by an embodiment of the present invention;

[0047] Figure 7 It is a schematic diagram of command hierarchy rules in a method for displaying a differential configuration command tree provided by an embodiment of the present invention;

[0048] Figure 8 It is a schematic diagram of a differential configuration command tree in a method for displaying a differential configuration command tree provided by an embodiment of the present invention;

[0049] Figure 9 It is a schematic flowchart of a method for displaying a differential configuration command tree provided by an embodiment of the present invention;

[0050] Figure 10 It is a schematic diagram of a device for displaying a differential configuration command tree provided by an embodiment of the present invention. Detailed implementation manners

[0051] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0052] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0053] Embodiment 1:

[0054] In the prior art, for each transaction, usually only the modified data records are displayed to the user, and the user cannot know which commands are executed in each transaction. Moreover, the user cannot distinguish which transaction is the one expected by the user, or which transaction has a configuration error and needs to be rolled back, resulting in difficulties for the user to trace or roll back transactions. To solve this problem, Embodiment 1 of the present invention provides a method for displaying a differential configuration command tree, as Figure 1 shown, including:

[0055] In step 201, when a transaction is committed, an incremental configuration record is generated according to the DB records modified by the transaction.

[0056] Among them, the network configuration data is stored in multiple DB records according to the configuration classes it belongs to. Each configuration class corresponds to a DB record (i.e., a record in the database) for storing all the parameters of that configuration class, and each configuration class corresponds to a configuration class ID. The transaction submission is used to modify the DB records. The incremental configuration record is as Figure 2 shown, storing the corresponding configuration class ID, the data before modification, the data after modification, and the corresponding record operation code. One transaction submission may modify multiple DB records. When a piece of configuration data in each pair of DB records is modified, an incremental configuration record is generated, and the configuration class ID corresponding to the DB record is carried in the incremental configuration record. That is, when a transaction submission is made, multiple incremental configuration records may be generated.

[0057] In step 202, according to the incremental configuration record, obtain the underlying execution commands executed in the transaction.

[0058] The underlying execution commands are the commands actually executed in the transaction and ultimately play the role of modifying the configuration data. As Figure 3 shown, among them, "router isis 1" only plays a positioning role. After executing this command, the parameter values in the corresponding DB record do not change, so it is not an underlying execution command. And the command "redistribute bgp level-1" changes the parameter values in the corresponding DB record after being executed, so this command is an underlying execution command.

[0059] In step 203, and according to the command hierarchy rules, reverse-lookup the upper-level commands of the underlying execution commands.

[0060] Among them, the upper-level commands include the direct upper-level command of the underlying execution command, that is, the parent command, and the indirect upper-level commands, such as the parent command of the parent command or higher-level commands, etc.

[0061] The command hierarchy rules are analyzed and pre-stored by those skilled in the art according to the hierarchical relationship between network configuration data.

[0062] In step 204, according to the underlying execution commands and upper-level commands, generate a differential configuration command tree for displaying all the commands executed in the transaction to the user.

[0063] Among them, when one transaction submission corresponds to multiple incremental configuration records, according to each incremental configuration record, obtain all the underlying execution commands of the transaction, and generate a differential configuration command tree according to all the underlying execution commands and the upper-level commands of the underlying execution commands.

[0064] The commands in the differential configuration command tree are all the commands executed when the transaction is committed, and the relationship between the nodes in the differential configuration command tree is the hierarchical relationship between the commands.

[0065] Thus, the user can visually see the commands executed by the transaction and the relationship between the commands through the differential configuration command tree, and then can determine the specific effective configurations in this transaction.

[0066] As an optional implementation manner, at each node of the differential configuration command tree, the command line expression corresponding to the command is stored, and the differential configuration command tree can be displayed in the interactive interface in the form of the command line expression, as Figure 3 shown.

[0067] Since in this embodiment, the underlying execution commands of the transaction are reversely deduced through the incremental configuration record, and the upper-layer commands are reversely deduced through the underlying execution commands, the deduced commands must be the commands effective during the transaction execution. The unexecuted commands and invalid commands during the transaction execution will not be deduced, so that the user can visually confirm the effective commands of the transaction.

[0068] In this embodiment, through the incremental configuration record, the execution commands of the transaction are reversely deduced, and the corresponding command line expressions and differential configuration command tree are generated. Through the differential configuration command tree, the user can clearly determine the execution process of the transaction, which is convenient for performing configuration data backtracking or data rollback. And because this embodiment shows the relationship between the commands in the transaction in the form of a differential configuration command tree, when the number of commands executed in a transaction is large enough and an error occurs in a certain command in the transaction configuration, there is no need to perform an overall rollback of the transaction, but the branch where the command is located and the subordinate branches can be rolled back, that is, only a partial rollback of the transaction is performed to repair the error.

[0069] Compared with the prior art, the prior art stores the full configuration when each transaction is committed. When showing the configuration differences of a certain transaction (even if only one command configuration is changed), it is necessary to compare the command lines one by one in full volume, and the performance is relatively poor in the scenario of large-scale configuration data; while this embodiment stores according to the incremental configuration differences, with small space occupancy and high performance in showing the differential configuration.

[0070] This embodiment also provides an optional implementation manner for the above step 202, that is, obtaining the underlying execution commands executed in the transaction according to the incremental configuration record, as Figure 4 shown, specifically including:

[0071] In step 301, according to the configuration class ID in the incremental configuration record, all possible execution commands corresponding to the configuration class ID are obtained.

[0072] Among them, each configuration class corresponds to a DB record, and a DB record is stored in the corresponding data table. When the data in the data table is modified, the corresponding configuration class ID is obtained according to the data table, and the configuration class ID is carried in the incremental configuration record.

[0073] In step 302, in the DB record corresponding to the configuration class ID, according to the display condition of the possible execution command, the corresponding parameter is found, and it is judged whether the parameter meets the display condition.

[0074] In step 303, if the parameter meets the display condition, the possible execution command is executed in the transaction, and the possible execution command is a low-level execution command.

[0075] Among them, the possible execution commands of each configuration class can be obtained from the command display information of each command. Specifically, the command display information of all commands is stored in the corresponding XML file. Among them, the command display information of each command includes: the command itself, the configuration class ID corresponding to the command, the display condition of the command, the rule for obtaining the expression parameter of the command, the rule for constructing the expression of the command, and the inheritance rule of the parent and child parameters.

[0076] Thus, the corresponding possible execution command can be found through the configuration class ID corresponding to the command. The possible execution commands corresponding to each configuration class ID are all commands that can modify the parameters in the configuration class.

[0077] In actual use, which command or which commands are specifically executed by the transaction still needs to be specifically judged according to the parameters in the DB record, that is, the above steps 302 and 303.

[0078] The display condition is used to judge whether the possible execution command is executed and takes effect. As an optional implementation manner, the display condition includes a parameter ID and a preset parameter value. According to the parameter ID, the corresponding parameter is obtained from the DB record, and it is judged whether the parameter value of the obtained parameter is the preset parameter value. If it is the preset parameter value, the display condition is met; otherwise, it is not met. That is, when the corresponding parameter in the DB record meets the preset parameter value in the display condition, it indicates that the executable command is executed and takes effect. The display condition is analyzed by those skilled in the art according to the corresponding command and is stored in the command display information in advance.

[0079] The command display information is in Figure 5It is stored or presented in the shown form. Among them, the command itself is stored in the ShowRunCmd tag, the configuration class ID of the command is stored in the classId tag, the display condition of the command is stored in the additionalConditions tag, the rule for obtaining expression parameters is stored in the clueExpressionParaList tag, the rule for constructing expressions is stored in the clueExpression tag, and the obtainContextInfo tag is used to store the inheritance rule of parent and child parameters.

[0080] Among them, the elementId in the additionCondions is the parameter ID, which is used to find the corresponding parameter from the DB record according to the parameter ID. The vauleStr is the target value of the parameter. If the value of the parameter found from the DB record is the same as the target value, the display condition is satisfied. The clueExpressionParaList, clueExpressionList, and obtainContextInfo will be elaborated in detail in the subsequent embodiments and will not be elaborated here.

[0081] This embodiment also provides an alternative implementation manner for the above step 203, which specifically includes:

[0082] Using the parent command obtained from the previous search as the sub-command for the next search, according to the command hierarchy rule, find the parent command of the sub-command. The found parent command is an upper-level command of the bottom-layer execution command. Until no corresponding parent command can be found, all upper-level commands of the bottom-layer execution command are obtained; among them, in the first search, use the bottom-layer execution command as the sub-command to find the corresponding parent command.

[0083] This implementation manner can be regarded as an iterative process of continuously finding the parent command through the sub-command. Here, it should be noted that the "previous search" and "next search" described in this embodiment are relative to two adjacent search processes. For example, if three searches have been performed as of a certain time, for the convenience of description, these three searches are called: the first search, the second search, and the third search in chronological order. Then the first search is the "previous search" of the second search, the second search is the "next search" of the first search, the second search is the "previous search" of the third search, and the third search is the "next search" of the second search.

[0084] In actual use, a sub-command may correspond to multiple possible parent commands. To identify which command is the parent command of the sub-command in this transaction, this embodiment also provides the following preferred implementation, that is, according to the command hierarchy rule, find the parent command of the sub-command, as Figure 6 shown, which specifically includes:

[0085] In step 401, according to the command hierarchy rule, obtain all possible parent commands of the sub-command.

[0086] The command hierarchy rule is analyzed and pre-stored by those skilled in the art based on the hierarchical relationship between network configuration data. The command hierarchy rule is stored in an XML file, where the sub-command is stored as a lower-level tag of the possible parent command.

[0087] As Figure 7 shown, each ShowRunCmd tag represents a command, and the value of name in the tag refers to the specific command. Among them, the command ip vpn lp-83004f is stored as a lower-level tag of interface loopback-830006, that is, the command ip vpn lp-83004f is a sub-command of interface loopback-830006, and the command interface loopback-830006 is a possible parent command of the command ip vpn lp-83004f.

[0088] In step 402, according to the parent-child parameter inheritance rule, obtain the corresponding parent parameters from the DB record of the possible parent command, and obtain the corresponding sub-parameters from the DB record of the sub-command, and judge whether the sub-parameters and the parent parameters are consistent.

[0089] The parent-child parameter inheritance rule includes the parameter ID of the parent parameter and the parameter ID of the sub-parameter, so as to obtain the parameters through the parameter ID.

[0090] The DB record of the command is the DB record corresponding to the configuration class to which the command belongs. Obtain the parent parameters from the DB record corresponding to the configuration class to which the parent command belongs, and obtain the sub-parameters from the DB record corresponding to the configuration class to which the sub-command belongs.

[0091] In step 403, if it is judged that the sub-parameters and the parent parameters are consistent, then the possible parent command is the parent command of the sub-command.

[0092] When the sub-parameters and the parent parameters are consistent, it means that the sub-command inherits the corresponding parameter value from the parent command, and thus the parent command of the sub-command can be determined.

[0093] Among them, as mentioned above, the father-son parameter inheritance rule is stored in the XML file in the form of the tag obtainContextInfo. The obtainContextInfo also stores a subordinate tag obtainContext. Each obtainContext represents a father-son parameter inheritance rule. Only when the father command and the son command satisfy all the father-son parameter inheritance rules in the obtainContextInfo, it is considered that the father-son relationship is satisfied, and the corresponding father command is obtained. The fatherElementId in the obtainContext is the father parameter ID, and the elementId is the son parameter ID, so as to obtain the corresponding parameters according to the father parameter ID and the son parameter ID.

[0094] As an optional implementation manner, generating a differential configuration command tree according to the underlying execution command and the upper-layer command specifically includes:

[0095] For the underlying execution command and the upper-layer command, obtain the corresponding parameters according to the expression parameter acquisition rule of the command; and according to the command expression construction rule, use the parameters to construct the corresponding command line expression;

[0096] According to the father-son relationship between the commands, use the command line expression of the father command as the father node and the command line expression of the son command as the son node to establish a tree-like branch, so as to generate a differential configuration command tree.

[0097] Among them, as mentioned above, the expression parameter acquisition rule is stored in the XML file in the form of the tag clueExpressionParaList, the expression construction rule is stored in the XML file in the form of the tag clueExpressionList. The tag clueExpressionParaList stores a subordinate tag clueExpressionPara. Each clueExpressionPara represents an expression acquisition rule. The id in the tag represents the id number used when the parameter constructs the expression, the cmdParaName represents the parameter name, and the elementId represents the parameter ID. When the elementId is 0, directly use the parameter name to participate in the expression construction. When the elementId is not 0, obtain the parameter corresponding to the parameter ID from the DB record, and use the obtained parameter to participate in the expression construction.

[0098] The lower-level tag clueExpression is stored in the clueExpressionList. Each clueExpression represents an expression construction rule. According to this expression construction rule, a command-line expression is constructed. Usually, one command corresponds to only one expression construction rule, that is, the clueExpressionList stores only one clueExpression. In the clueExpression, the ids used when the parameters are used to construct the expression are arranged according to a preset rule, and the expression is constructed according to the expression in the clueExpression tag.

[0099] For example, as Figure 5 shown, two clueExpressionPara are stored in the clueExpressionParaList. Two parameters, namely ipv6 and enable, are obtained according to the cmdParaName. Since their elementIds are both 0, there is no need to obtain the corresponding parameter values from the DB record. And in the expression of the clueExpression is "1 2", then the command-line expression "ipv6 enable" is constructed by arranging the ipv6 and enable according to the expression.

[0100] As a preferred implementation manner, when constructing a command-line expression for an underlying execution command, the corresponding parameters are obtained according to the expression parameter obtaining rule of the command; and according to the expression construction rule of the command, the corresponding command-line expression is constructed using the parameters, specifically including:

[0101] Find the record operation code corresponding to the command, and obtain the operation category of the command according to the record operation code;

[0102] If the operation category of the command is to delete configuration data or create new configuration data, then according to the expression parameter obtaining rule of the command, the corresponding modified parameters are obtained from the incremental configuration record; according to the expression construction rule and the modified parameters, the command-line expression of the command is constructed;

[0103] If the operation category of the command is to update configuration data, then according to the expression parameter obtaining rule of the command, the corresponding modified parameters and pre-modified parameters are obtained from the incremental configuration record; according to the expression construction rule, the pre-modified parameters and the modified parameters, the command-line expression of the command is constructed.

[0104] Among them, the modified parameters in the incremental configuration record are the same as the parameters in the DB record. That is, when the operation category of the command is to delete configuration data or create new configuration data, the process of constructing the command line expression is the same as the process of generating the command line expression according to the expression construction rules and expression parameter acquisition rules. When the operation category of the command is to update configuration data, in order to show the user the changes in the parameter values before and after the transaction submission, both the modified parameters and the parameters before modification are used to participate in the construction of the command line expression. A specific implementation method is as follows: Generate two command line expressions, one using the parameters before modification and the other using the modified parameters, and use the operation category to distinguish the two command line expressions. For example, if the value of the parameter before modification is 32 and the value of the modified parameter is 64, then generate two commands: distance 32 and distance 64, and add "+" and "-" signs before the two commands to distinguish them. Among them, "-" represents deleting configuration data, and "+" represents creating new configuration data. As Figure 3 shown, "-distance32+distance 64" represents updating the value of the parameter from 32 to 64.

[0105] In actual situations, not only the submission of the transaction will modify the configuration data, but the rollback of the transaction will also modify the configuration data. For the convenience of data traceability, the present embodiment also provides the following preferred implementation method, that is, the method further includes:

[0106] When performing a transaction rollback, according to the incremental configuration record of the transaction, generate a corresponding rollback configuration record.

[0107] And according to the rollback difference configuration command tree of the transaction, generate a corresponding rollback difference configuration command tree, so that the user can judge whether the transaction is correctly rolled back according to the commands in the rollback difference configuration command tree.

[0108] Among them, the rollback difference configuration command tree can be adding a rollback mark on the basis of the difference configuration command tree of the transaction, so that the user knows that it is a transaction rollback operation and can determine the specific location of the modified configuration data.

[0109] The generating a corresponding rollback difference configuration command tree according to the difference configuration command tree of the transaction specifically includes:

[0110] When performing an overall transaction rollback, use the difference configuration command tree of the transaction as the rollback difference configuration command tree and add the corresponding rollback mark;

[0111] When performing a partial transaction rollback, use the rolled-back partial branch in the difference configuration command tree of the transaction as the rollback difference configuration command tree and add the corresponding rollback mark.

[0112] Among them, since this embodiment shows the differential configuration command tree for transaction submission, enabling multiple incremental configuration records corresponding to a single transaction submission to be displayed in the form of corresponding command expressions, when performing transaction rollback, only some of the branches can be rolled back. For example, Figure 8 As shown, when performing transaction rollback, only the branch of command5-command3-command1 can be rolled back. When performing rollback, the parameter rollback modification can be directly performed according to the incremental configuration records corresponding to each command in this branch, or the corresponding rollback expression can be generated based on the underlying execution commands in the branch and executed according to the relationship of each command in the branch. For example, when command1 in this branch is the underlying execution command, when performing rollback, the rollback expression is constructed reversely according to command1 and submitted as a single transaction. If the operation category of command1 is to update configuration data, that is, the value of the corresponding parameter a is updated from num1 to num2, then when constructing the rollback expression, the positions of the num1 and num2 parameters in the original expression are replaced to generate a rollback expression. Executing command5, command3, and the rollback expression in sequence can roll back this branch. At the same time, this rollback operation is also submitted as a single transaction to generate the corresponding differential configuration command tree for the user to trace the data or perform the data rollback operation again.

[0113] Embodiment 2:

[0114] Based on the method described in Embodiment 1, the present invention combines specific application scenarios and uses the technical expressions in relevant scenarios to elaborate the implementation process in the characteristic scenarios of the present invention.

[0115] Taking the modification of network configuration data as an application scenario, when modifying the DB records in a transaction, corresponding incremental configuration records are generated according to the modified records and the configuration classes corresponding to the DB records. The incremental configuration records carry the configuration class ID, that is, such as Figure 2 the classid in

[0116] According to the classid, the corresponding possible execution commands are found in the XML file. For example, when the classid is 0x830001, the command with the label classId of 830001 in the command display information is found as the possible execution command. According to the display conditions of the possible execution commands, the corresponding parameters are searched from the DB records corresponding to this configuration class ID. For example, when the configuration class ID is 0x830001, the data table where the corresponding DB record is located is table1, and the display conditions are such as Figure 5As shown, when the elementId in the display condition is 17, obtain the parameter with the id of 17 from table1, and determine whether the value of this parameter is the same as the value of valueStr in the display condition. For example, Figure 5 As shown, it is to determine whether the value of the parameter with the id of 17 in table1 is 2. If the value of this parameter is 2, then the possible execution command is executed in this transaction and is a low-level execution command.

[0117] According to the command line hierarchy rules in the XML file, find all possible parent commands of the low-level execution command. For example, Figure 7 As shown, if there is a low-level execution command of ipv6 enable lp-83001b, and its name value as a lower-level tag of showRunCmd is included in another upper-level tag of showRunCmd, then the name value interface loopback-830006 in the upper-level tag showRunCmd is the possible parent command of this low-level execution command. Then, according to the obtainContextInfo tag in the command display information of the low-level execution command, use the fatherElementId in the obtainContext as the parent parameter Id in its lower-level tag, and use elementId as the child parameter Id. According to the command display information of the possible parent command, obtain the corresponding classId tag, which is the configuration class ID. Obtain the DB record of the possible parent command according to the configuration class ID, obtain the parameter with the id of the parent parameter Id from the DB record, and obtain the parameter with the id of the child parameter Id from the DB record of the sub-command. Determine whether the values of the two parameters are the same. If they are the same, then this possible parent command is the parent command of this low-level execution command.

[0118] Then, take this parent command as the sub-command, and according to the above idea, find the corresponding parent command (each parent command obtained by each search belongs to the upper-level command of the low-level execution command). Repeat this iterative process until no corresponding parent command can be found. Find all low-level execution commands and all upper-level commands corresponding to all incremental configuration records of this transaction.

[0119] For each command corresponding to the transaction (including low-level execution commands and upper-level commands), generate the corresponding command line expression. Among them, for the low-level execution command, also obtain the corresponding record operation code from the incremental configuration record. One record operation code corresponds to one operation category. If the operation category obtained according to the record operation code is to update configuration data, then generate two command line expressions. Otherwise, generate one command line expression according to the normal command.

[0120] The specific process of generating a command-line expression according to a regular command is as follows: According to the tags clueExpressionParaList and clueExpressionList in the command display information of the command, based on clueExpressionParaList, find the corresponding parameters from the DB record of the command, and based on clueExpressionList, construct a command-line expression. For example, Figure 5 as shown, the ipv6 and enable in clueExpressionParaList are constructed into the command-line expression "ipv6 enable" according to clueExpressionList. When the command is a low-level execution command and the operation category of the command is to update configuration data, for example, if the command expression constructed according to clueExpressionParaList and clueExpressionList is "distance k", where the elementId of the parameter k in clueExpressionParaList is not 0, then obtain the corresponding parameter value from the DB record according to elementId (it can also be obtained from the incremental configuration record), which is the modified parameter value, and obtain the parameter before modification from the incremental configuration record. For example, if the value of the parameter before modification is 32 and the value of the parameter after modification is 64, then generate two commands: distance 32 and distance 64, and add "+" and "-" signs before the two commands for distinction.

[0121] Use the command-line expression of the command as a node of the differential configuration command tree, and use the parent-child relationship between commands to construct branches to form a differential configuration command tree.

[0122] For example, if a transaction corresponds to two incremental configuration records, the low-level execution command of the first incremental configuration record is Command1, the parent command of this low-level execution command is Command3, the parent command of Command3 is Command5, and no corresponding parent command can be found above Command5. And the low-level execution command of the other incremental configuration record is Command2, the parent command of this low-level execution command is Command4, and the parent command of Command4 is also Command5. Then, according to the parent-child relationship between commands, generate a differential configuration command tree as Figure 8 shown, where each node mounts the command-line expression of the corresponding command.

[0123] Embodiment 3:

[0124] Based on the method described in Embodiment 1, this invention combines specific application scenarios and uses technical expressions in relevant scenarios to elaborate the implementation process in the characteristic scenarios of this invention.

[0125] Taking the modification of network configuration data as the application scenario, when a transaction modifies the DB record, an incremental configuration record is generated according to the modified record and the configuration class corresponding to the DB record. The incremental configuration record carries the configuration class ID, and the incremental configuration record generated by the transaction submission is stored in the form of a table and records. The specific records in the table are the detailed information generated by the configuration process of this type of configuration.

[0126] The process of generating the differential configuration command tree according to the incremental configuration record specifically includes:

[0127] Parse the showRunCmdOrder field and the showRunCmdList field in the command line XML file; among them, parsing the showRunCmdOrder field is used to obtain the command hierarchy rule; sort out the top-level command linked list and the sub-command hierarchy mounted under the top-level command to prepare for generating the differential configuration command tree later; parsing the showRunCmdList field is used to obtain the command display information. In this stage, the following information is mainly obtained: the command itself, the configuration class ID of the command, the display condition of the command, the rule for obtaining the expression parameters of the command, the rule for constructing the expression of the command, and the inheritance rule of the parent-child parameters.

[0128] In this stage, the corresponding relationship between the configuration class and the command is established at the same time, and the command lines corresponding to the same configuration class are mounted under the unified configuration class node, that is: the configuration class corresponds to the command line linked list, and the node in the linked list mounts the command line display node pointer of the command.

[0129] According to the command hierarchy rule and the command display information, combined with the DB record and the incremental configuration record, generate a differential configuration command tree. Specifically:

[0130] Generate the underlying execution command according to the incremental configuration record. Recursively search for the parent command according to the underlying execution command, generate the command line expression according to the command display information of each command, and generate the differential configuration command tree according to the parent-child relationship of the commands. Among them, the command line expressions of each command are mounted on the nodes of the differential configuration command tree.

[0131] As a more refined step process, the process of generating the differential configuration difference tree specifically includes:

[0132] 1. Obtain the corresponding configuration class ID according to the incremental configuration record.

[0133] 2. In the component management data area, in the storage configuration class and the corresponding command line chain management tree, find the command linked list corresponding to this class according to the configuration class ID, that is, obtain all possible execution commands corresponding to the configuration class ID. The command linked list is the linked list storing all possible execution commands of the configuration class ID.

[0134] 3. Traverse the command linked list, obtain the corresponding parameters from the DB records according to the display conditions of each command, and determine whether the parameters meet the display conditions, so as to determine whether each command is executed. If a command is executed, it is used as a low-level execution command to generate a corresponding command expression string (i.e., command line expression).

[0135] 4. According to the command expression string generated in 3 and the record operation code in the corresponding incremental configuration record, construct a command line display node in the differential configuration command tree.

[0136] 5. According to the command hierarchy rule, determine whether the current command may have a parent command. If not, end here and generate a single-node differential chain.

[0137] 6. If it is determined that the current command may have a parent command, obtain the corresponding parent parameters and child parameters according to the parent-child parameter inheritance rule in the command display information, and determine the corresponding parent command according to the parent parameters and child parameters. Among them, when searching for the parent parameters, first search in the CDB (current uncommitted configuration). If not found, then try to search in the RDB (committed configuration).

[0138] 7. According to the command display information of the parent command, construct a command expression string, the command expression string and the record operation code in the corresponding incremental configuration record, and construct a parent command line display node in the differential configuration command tree.

[0139] 8. Execute steps 4-7 above recursively. Finally, generate a differential chain according to the incremental configuration record in step 1;

[0140] As a preferred implementation, if the record operation code in 1 is UPDATE (update operation), then two command line expressions are included in the corresponding node. One command line expression carries the parameters before modification, and the other command line expression carries the parameters after modification. Two differential chains can also be generated correspondingly in the configuration differential command tree: one differential chain is generated from the record before update, and one differential chain is generated from the record after update. These two differential chains correspond to the same command. As Figure 9 shown.

[0141] Among them, the determination of whether the parameters meet the display conditions to determine whether each command is executed specifically includes:

[0142] 1. Calculate a command line string that meets the display conditions through the incremental configuration record and the command line display information. The main process:

[0143] 2. Determine whether the current command line generation string follows the framework process or user-defined implementation through the command line display information.

[0144] 3. If the command line generation string is implemented by the user and is strongly related to the business, determine whether the command is executed based on the business.

[0145] 4. If the command line generation string is implemented by the framework, the display conditions of the current command are saved in the command line display information. Obtain the corresponding values from the DB according to the display conditions, compare the values obtained from the records with the display conditions, and skip if the display conditions are not met. The current command is not an executed command.

[0146] 5. If the display conditions are met, traverse the linked list of command line elements and obtain the element values from the records.

[0147] 6. Determine whether the element value is equal to the default value in sequence, and write the default value return flag into the element node.

[0148] 7. Determine the element legality in sequence, whether the element value is within the legal range, etc., and write the legality return flag into the element node.

[0149] 8. After all elements are traversed, write the default value flag bit and the legal node flag bit of the element node into the element node.

[0150] 9. According to the command line expression stored in the command line display node by parsing the resource file in the preprocessing stage, find an expression that meets the display conditions through the linked list of command line elements.

[0151] After generating the differential configuration command tree, each generated differential configuration command tree can correspond to a rollback point to facilitate subsequent transaction rollback by the user. Specifically: Each time a transaction configuration is submitted, a rollback point is generated according to the current incremental configuration. The rollback point can be configured with a label to identify this submission, facilitating the user to identify the rollback point; A corresponding rollback command configuration tree and rollback point are also generated for the user's rollback operation; Each branch of the differential configuration command tree can also correspond to a rollback point to facilitate the user to perform partial rollback of the transaction.

[0152] A rollback database file for the current COMMIT_ID command is generated for one submission, which contains N tables. Each table is named after the configuration class ID. The records stored in each table are an instantiated configuration of that configuration class, storing part of the data before and after the configuration change; When performing a rollback operation, the pre-configuration records are used to package and send to the business; When displaying the differences, both parts of the data before and after the configuration are used to generate readable character expressions to display the differential changes; A FLAG field is reserved in front of each record to store the operation type corresponding to this record: create / update / delete.

[0153] If the user determines that the transaction needs to be rolled back according to the differential configuration command tree, for example, if the user makes three configuration submissions, successively forming three consecutive rollback points a, b, and c, and finds that the c configuration is incorrect or not the configuration expected by the user when making the third configuration submission, and the user wants to roll back to the configuration before the c submission. Then, the configuration rollback operation can be executed to roll back to b or a; a new rollback point d will be generated after the user executes the configuration rollback. The specific transaction rollback operations include:

[0154] 1: The user uses the ROLLBACK command to specify a rollback point for rollback.

[0155] 2: The configuration management framework determines the legality of the rollback point.

[0156] 3: According to the rollback point, obtain all configuration class information corresponding to the rollback point in the management data area.

[0157] 4: Traverse the configuration classes in sequence, obtain the component subscription information of the class according to the class ID (this part is obtained according to the component subscription relationship during the component startup process), and finally obtain a distribution tree chain with the component as the KEY. Each component is a distribution tree node, and the concerned class ID is mounted, that is: each distribution tree node hangs the distribution class node below.

[0158] 5: Adjust the class order in the distribution node according to the class definition order of the component and store it in the distribution tree node.

[0159] 6: Traverse the distribution chain, obtain the record from the configuration rollback database according to the class ID, and hang it on the distribution class node of the distribution tree (record pointer); if the distribution chain is empty, it means that no component subscribes to the rollback data, and directly return success.

[0160] 7: Traverse the distribution tree, and perform data distribution according to the class order in the distribution tree node; obtain the distribution class node under the distribution tree node according to the class ID (store the data record pointer / record count obtained from the rollback database).

[0161] 8: Offset the records of the distribution class node in sequence, judge the single-record operation code (reserved field in the configuration rollback record), if it is an update operation, offset the class length, and pack and send the data before the configuration change to the component;

[0162] 9: Wait for the business response. If the return is successful, it indicates that this rollback takes effect.

[0163] 10: The configuration management framework generates a rollback point for this rollback operation according to the configuration rollback data.

[0164] Embodiment 3:

[0165] Such as Figure 10As shown, it is a schematic architecture diagram of the device for displaying a differential configuration command tree according to an embodiment of the present invention. The device for displaying a differential configuration command tree according to this embodiment includes one or more processors 21 and a memory 22. Among them, Figure 10 Take one processor 21 as an example.

[0166] The processor 21 and the memory 22 can be connected through a bus or other means. Figure 10 Take the connection through the bus as an example.

[0167] The memory 22, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs and non-volatile computer-executable programs, such as the method for displaying a differential configuration command tree in Embodiment 1. The processor 21 executes the method for displaying a differential configuration command tree by running the non-volatile software programs and instructions stored in the memory 22.

[0168] The memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 22 may optionally include a memory remotely provided with respect to the processor 21, and these remote memories can be connected to the processor 21 through a network. Examples of the above network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0169] The program instructions / modules are stored in the memory 22 and, when executed by the one or more processors 21, execute the method for displaying a differential configuration command tree in the above Embodiment 1.

[0170] It should be noted that the content such as information interaction and execution process among the modules and units within the above device and system, due to being based on the same concept as the method embodiment of the present invention, the specific content can be referred to the description in the method embodiment of the present invention and will not be elaborated here.

[0171] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the embodiments can be completed by instructing relevant hardware through a program, and this program can be stored in a computer-readable storage medium. The storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.

[0172] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for displaying a differential configuration command tree, characterized in that, Including: When a transaction is committed, generate corresponding incremental configuration records according to the DB records modified by the transaction; Obtain the underlying execution commands executed in the transaction according to the incremental configuration records; And according to the command hierarchy rules, backtrack the upper-level commands of the underlying execution commands; Generate a differential configuration command tree according to the underlying execution commands and upper-level commands, so as to display all the commands executed in the transaction to the user; The backtracking of the upper-level commands of the underlying execution commands according to the command hierarchy rules specifically includes: Use the parent command obtained in the previous search as the sub-command in the next search, and according to the command hierarchy rules, search for the parent command of the sub-command. The obtained parent command is an upper-level command of the underlying execution command. Until no corresponding parent command can be found, all the upper-level commands of the underlying execution command are obtained; among them, in the first search, use the underlying execution command as the sub-command to search for the corresponding parent command.

2. The method for configuring a command tree for display differences according to claim 1, wherein The obtaining of the underlying execution commands executed in the transaction according to the incremental configuration records specifically includes: Obtain all possible execution commands corresponding to the configuration class ID according to the configuration class ID in the incremental configuration records; In the DB records corresponding to the configuration class ID, find the corresponding parameters according to the display conditions of the possible execution commands, and judge whether the parameters meet the display conditions; If the parameters meet the display conditions, the possible execution command is executed in the transaction, and the possible execution command is an underlying execution command.

3. The method for configuring a command tree for display differences according to claim 1, characterized in that The searching for the parent command of the sub-command according to the command hierarchy rules specifically includes: Obtain all possible parent commands of the sub-command according to the command hierarchy rules; According to the parent-child parameter inheritance rules, obtain the corresponding parent parameters from the DB records of the possible parent commands, and obtain the corresponding sub-parameters from the DB records of the sub-command, and judge whether the sub-parameters and the parent parameters are consistent; If it is judged that the sub-parameters and the parent parameters are consistent, the possible parent command is the parent command of the sub-command.

4. The method for configuring a display difference command tree according to claim 1, wherein The generating of the differential configuration command tree according to the underlying execution commands and upper-level commands specifically includes: For the underlying execution commands and upper-level commands, obtain the corresponding parameters according to the parameter acquisition rules of the command expressions; and according to the expression construction rules of the command, use the parameters to construct the corresponding command line expressions; According to the parent-child relationship between commands, use the command line expression of the parent command as the parent node and the command line expression of the sub-command as the sub-node to establish a tree-like branch, thereby generating a differential configuration command tree.

5. The method for configuring a display difference command tree according to claim 4, wherein The obtaining of the corresponding parameters according to the parameter acquisition rules of the command expressions; And according to the expression construction rules of the command, using the parameters to construct the corresponding command line expressions specifically includes: Find the record operation code corresponding to the command, and obtain the operation category of the command according to the record operation code; If the operation category of the command is to delete configuration data or create new configuration data, obtain the corresponding modified parameters from the incremental configuration record according to the expression parameter acquisition rule of the command; construct the command line expression of the command according to the expression construction rule and the modified parameters. If the operation category of the command is to update configuration data, obtain the corresponding modified parameters and pre-modified parameters from the incremental configuration record according to the expression parameter acquisition rule of the command; construct the command line expression of the command according to the expression construction rule, the pre-modified parameters and the modified parameters.

6. The method for configuring a display difference command tree according to claim 1, wherein The method further includes: When performing transaction rollback, generate a corresponding rollback configuration record according to the incremental configuration record of the transaction; And generate a corresponding rollback differential configuration command tree according to the differential configuration command tree of the transaction, so as to determine the specific location of the corresponding modified configuration data according to the rollback differential configuration command tree.

7. The method for configuring a command tree for display differences according to claim 6, wherein The generating a corresponding rollback differential configuration command tree according to the differential configuration command tree of the transaction specifically includes: When performing overall transaction rollback, use the differential configuration command tree of the transaction as the rollback differential configuration command tree and add corresponding rollback marks; When performing partial transaction rollback, use the rolled-back partial branches in the differential configuration command tree of the transaction as the rollback differential configuration command tree and add corresponding rollback marks.

8. The method for configuring a command tree for display differences according to any one of claims 1-7, characterized in that, The command hierarchy rule is stored in an XML file, where sub-commands are stored as lower-level tags of possible parent commands.

9. An apparatus for displaying a differential configuration command tree, characterized in that, The device includes: 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, and the instructions are executed by the processor to perform the method for displaying a differential configuration command tree according to any one of claims 1-8.

Citation Information

Patent Citations

  • Network configuration management method and system based on database

    CN109977097A

  • Visual configuration system and method for Linux kernel device tree

    CN112860256A